123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- from fastapi_utils.tasks import repeat_every
- from httpx import AsyncClient
- from app.controllers.equipment.ahu.basic import get_freq_controlled
- from app.controllers.equipment.ahu.switch import ahu_switch_control
- from app.controllers.equipment.fcu.on_ratio import start_control_group_mode
- from app.controllers.equipment.pau.switch import pau_switch_control
- from app.controllers.equipment.ventilation_fan.switch import ventilation_fan_switch_control
- from app.services.platform import DataPlatformService
- @repeat_every(seconds=60 * 5)
- async def regulate_ahu_freq():
- _PROJECT_ID = 'Pj1101050030'
- _AHU_LIST = [
- 'Eq1101050030b6b2f1db3d6944afa71e213e0d45d565',
- 'Eq1101050030846e0a94670842109f7c8d8db0d44cf5'
- ]
- for ahu in _AHU_LIST:
- await get_freq_controlled(_PROJECT_ID, ahu)
- @repeat_every(seconds=60 * 15)
- async def regulate_ahu_switch():
- _PROJECT_ID = 'Pj1101020002'
- async with AsyncClient() as client:
- platform = DataPlatformService(client, _PROJECT_ID)
- ahu_list = await platform.get_items_by_category('ATAH')
- ahu_id_list = [item['id'] for item in ahu_list]
- for ahu in ahu_id_list:
- await ahu_switch_control(_PROJECT_ID, ahu)
- @repeat_every(seconds=60 * 15)
- async def regulate_pau_switch():
- _PROJECT_ID = 'Pj1101020002'
- async with AsyncClient() as client:
- platform = DataPlatformService(client, _PROJECT_ID)
- pau_list = await platform.get_items_by_category('ATFU')
- pau_id_list = [item['id'] for item in pau_list]
- for pau in pau_id_list:
- await pau_switch_control(_PROJECT_ID, pau)
- @repeat_every(seconds=60 * 15)
- async def regulate_ventilation_fan_switch():
- _PROJECT_ID = 'Pj1101020002'
- async with AsyncClient() as client:
- platform = DataPlatformService(client, _PROJECT_ID)
- eq_list = await platform.get_items_by_category('VTSF')
- eq_id_list = [item['id'] for item in eq_list]
- for eq in eq_id_list:
- await ventilation_fan_switch_control(_PROJECT_ID, eq)
- @repeat_every(seconds=60 * 15)
- async def run_control_group():
- await start_control_group_mode('Eq1101080259d666795232564546ac19b7042f1f52b9', 27.0)
- await start_control_group_mode('Eq11010802598449efe230f444cca826e840dbf67f41', 27.0)
- await start_control_group_mode('Eq1101080259ea519ed43678481c8a8c108fa85e5aa3', 27.0)
|