|
@@ -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
|
|
|
|