|
@@ -1,8 +1,13 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
from fastapi_utils.tasks import repeat_every
|
|
|
+from httpx import AsyncClient
|
|
|
|
|
|
from app.controllers.equipment.ahu.basic import get_freq_controlled, get_supply_air_temperature_controlled
|
|
|
+from app.controllers.equipment.ahu.switch import ahu_switch_control
|
|
|
+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)
|
|
@@ -27,3 +32,36 @@ async def regulate_ahu_supply_air_temperature():
|
|
|
|
|
|
for ahu in _AHU_LIST:
|
|
|
await get_supply_air_temperature_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)
|