|
@@ -0,0 +1,19 @@
|
|
|
+# -*- coding: utf-8 -*-
|
|
|
+
|
|
|
+from loguru import logger
|
|
|
+
|
|
|
+from app.controllers.equipment.switch import Switch, fetch_data, send_switch_command
|
|
|
+from app.schemas.equipment import VentilationFan
|
|
|
+
|
|
|
+
|
|
|
+class VentilationFanSwitch(Switch):
|
|
|
+
|
|
|
+ def __init__(self, equipment: VentilationFan):
|
|
|
+ super(VentilationFanSwitch, self).__init__(equipment)
|
|
|
+
|
|
|
+
|
|
|
+@logger.catch()
|
|
|
+async def ventilation_fan_switch_control(project_id: str, equipment_id: str) -> None:
|
|
|
+ equip_params, day_type = await fetch_data(project_id, equipment_id)
|
|
|
+ action = await VentilationFanSwitch(VentilationFan(**equip_params)).build_next_action(day_type.get('day_type'))
|
|
|
+ await send_switch_command(project_id, equipment_id, action)
|