diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-06-28 03:22:30 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-06-30 03:47:49 +0300 |
commit | 8f20c9b825cabab7a3f0f5dd2cfe000cc7f72c28 (patch) | |
tree | b5d7446e7b2fcfd42b1e5029aeef33ecb5f9715f /src/home/database | |
parent | ee09bc98aedfc6a65a5026432b399345a30a39c8 (diff) |
polaris pwk 1725cgld full support
- significant improvements, correctnesses and stability fixes in
protocol implementation
- correct handling of device appearances and disappearances
- flawlessly functioning telegram bot that re-renders kettle's state
(temperature and other) in real time
Diffstat (limited to 'src/home/database')
-rw-r--r-- | src/home/database/bots.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/home/database/bots.py b/src/home/database/bots.py index bc490e1..99befc0 100644 --- a/src/home/database/bots.py +++ b/src/home/database/bots.py @@ -5,7 +5,7 @@ from ..api.types import ( BotType, SoundSensorLocation ) -from typing import Optional +from typing import Optional, List, Tuple from datetime import datetime from html import escape @@ -37,7 +37,7 @@ class BotsDatabase(MySQLDatabase): self.commit() def add_openwrt_logs(self, - lines: list[tuple[datetime, str]]): + lines: List[Tuple[datetime, str]]): now = datetime.now() with self.cursor() as cursor: for line in lines: @@ -47,7 +47,7 @@ class BotsDatabase(MySQLDatabase): self.commit() def add_sound_hits(self, - hits: list[tuple[SoundSensorLocation, int]], + hits: List[Tuple[SoundSensorLocation, int]], time: datetime): with self.cursor() as cursor: for loc, count in hits: @@ -58,7 +58,7 @@ class BotsDatabase(MySQLDatabase): def get_sound_hits(self, location: SoundSensorLocation, after: Optional[datetime] = None, - last: Optional[int] = None) -> list[dict]: + last: Optional[int] = None) -> List[dict]: with self.cursor(dictionary=True) as cursor: sql = "SELECT `time`, hits FROM sound_hits WHERE location=%s" args = [location.name.lower()] @@ -84,7 +84,7 @@ class BotsDatabase(MySQLDatabase): def get_openwrt_logs(self, filter_text: str, min_id: int, - limit: int = None) -> list[OpenwrtLogRecord]: + limit: int = None) -> List[OpenwrtLogRecord]: tz = pytz.timezone('Europe/Moscow') with self.cursor(dictionary=True) as cursor: sql = "SELECT * FROM openwrt WHERE text LIKE %s AND id > %s" |