Browse Source

fix some bugs and amend some params

chenhaiyang 4 năm trước cách đây
mục cha
commit
2cf75fc7ab

+ 2 - 2
app/controllers/equipment/events.py

@@ -58,5 +58,5 @@ async def regulate_ventilation_fan_switch():
 
 @repeat_every(seconds=60 * 15)
 async def run_control_group():
-    await start_control_group_mode('Eq11010802593129d7ff3d9b4fd296f30927fd8fb76d', 26.0)
-    await start_control_group_mode('Eq11010802598449efe230f444cca826e840dbf67f41', 26.0)
+    await start_control_group_mode('Eq11010802593129d7ff3d9b4fd296f30927fd8fb76d', 25.0)
+    await start_control_group_mode('Eq11010802598449efe230f444cca826e840dbf67f41', 25.0)

+ 5 - 4
app/controllers/equipment/fcu/on_ratio.py

@@ -2,6 +2,7 @@ import asyncio
 from typing import Tuple
 
 import arrow
+from fastapi import HTTPException
 from httpx import AsyncClient
 from loguru import logger
 
@@ -50,9 +51,9 @@ class OnRatioController:
     def select_water_valve(self) -> bool:
         mode = self.select_mode()
         if mode == 'off':
-            switch = True
-        elif mode == 'normal':
             switch = False
+        elif mode == 'normal':
+            switch = True
         else:
             switch = True
 
@@ -60,7 +61,7 @@ class OnRatioController:
 
     def calculate_on_ratio(self, delta_on: float, delta_off: float) -> float:
         if self.period_num == 0:
-            ratio = 0.5
+            ratio = 0.9
         else:
             if delta_on <= 0:
                 ratio = 1.0
@@ -167,7 +168,7 @@ async def start_on_ratio_mode(device_id: str, target: float, period_time: int):
                 period_num = 0
                 last_on_ratio = 0.0
                 await asyncio.sleep(period_time)
-        except (KeyError, IndexError, TypeError):
+        except (KeyError, IndexError, TypeError, HTTPException):
             await asyncio.sleep(period_time)
             continue