summaryrefslogtreecommitdiff
path: root/src/home/mqtt/module/temphum.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/home/mqtt/module/temphum.py')
-rw-r--r--src/home/mqtt/module/temphum.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/home/mqtt/module/temphum.py b/src/home/mqtt/module/temphum.py
index 0e43f1b..9cdfedb 100644
--- a/src/home/mqtt/module/temphum.py
+++ b/src/home/mqtt/module/temphum.py
@@ -4,6 +4,7 @@ from .._module import MqttModule
from .._payload import MqttPayload
from ...util import HashableEnum
from typing import Optional
+from ...temphum import BaseSensor
two_digits_precision = lambda x: round(x, 2)
@@ -44,9 +45,17 @@ class MqttTempHumNodes(HashableEnum):
class MqttTempHumModule(MqttModule):
- def init(self, mqtt: MqttNode):
+ def __init__(self, sensor: Optional[BaseSensor] = None, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self._sensor = sensor
+
+ def on_connect(self, mqtt: MqttNode):
+ super().on_connect(mqtt)
mqtt.subscribe_module('temphum/data', self)
+ def tick(self):
+ pass
+
def handle_payload(self,
mqtt: MqttNode,
topic: str,
@@ -54,4 +63,4 @@ class MqttTempHumModule(MqttModule):
if topic == 'temphum/data':
message = MqttTemphumDataPayload.unpack(payload)
self._logger.debug(message)
- return message \ No newline at end of file
+ return message