1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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')
- for ahu in ahu_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')
- for pau in pau_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')
- for eq in eq_list:
- await ventilation_fan_switch_control(_PROJECT_ID, eq)
- @repeat_every(seconds=60 * 15)
- async def run_control_group():
- await start_control_group_mode('Eq1101080259ea519ed43678481c8a8c108fa85e5aa3', 25.0)
- await start_control_group_mode('Eq11010802598449efe230f444cca826e840dbf67f41', 25.0)
|