summaryrefslogtreecommitdiff
path: root/src/sound_sensor_server.py
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-06-28 03:22:30 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-06-30 03:47:49 +0300
commit8f20c9b825cabab7a3f0f5dd2cfe000cc7f72c28 (patch)
treeb5d7446e7b2fcfd42b1e5029aeef33ecb5f9715f /src/sound_sensor_server.py
parentee09bc98aedfc6a65a5026432b399345a30a39c8 (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/sound_sensor_server.py')
-rwxr-xr-xsrc/sound_sensor_server.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sound_sensor_server.py b/src/sound_sensor_server.py
index 0303d6d..9495678 100755
--- a/src/sound_sensor_server.py
+++ b/src/sound_sensor_server.py
@@ -3,7 +3,7 @@ import logging
import threading
from time import sleep
-from typing import Optional
+from typing import Optional, List, Dict, Tuple
from functools import partial
from home.config import config
from home.util import parse_addr
@@ -18,7 +18,7 @@ server: SoundSensorServer
def get_related_nodes(node_type: MediaNodeType,
- sensor_name: str) -> list[str]:
+ sensor_name: str) -> List[str]:
if sensor_name not in config[f'sensor_to_{node_type.name.lower()}_nodes_relations']:
raise ValueError(f'unexpected sensor name {sensor_name}')
return config[f'sensor_to_{node_type.name.lower()}_nodes_relations'][sensor_name]
@@ -52,7 +52,7 @@ class HitCounter:
with self.lock:
self.sensors[name] += hits
- def get_all(self) -> list[tuple[str, int]]:
+ def get_all(self) -> List[Tuple[str, int]]:
vals = []
with self.lock:
for name, hits in self.sensors.items():
@@ -119,7 +119,7 @@ def hits_sender():
api: Optional[WebAPIClient] = None
hc: Optional[HitCounter] = None
-record_clients: dict[MediaNodeType, RecordClient] = {}
+record_clients: Dict[MediaNodeType, RecordClient] = {}
# record callbacks