diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2024-02-24 02:00:40 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2024-02-24 02:00:40 +0300 |
commit | c9b351a08e31aa0c34892065f02f9ef710b6cd34 (patch) | |
tree | 509b7886b76c8f432ad9809945d59b0c5e3aca77 /include/py | |
parent | 2a5c34b28d7842ee2de2937faa36f78a1f5364fd (diff) |
mqtt changes
Diffstat (limited to 'include/py')
-rw-r--r-- | include/py/homekit/mqtt/_wrapper.py | 1 | ||||
-rw-r--r-- | include/py/homekit/mqtt/module/ota.py | 6 | ||||
-rw-r--r-- | include/py/homekit/temphum/base.py | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/include/py/homekit/mqtt/_wrapper.py b/include/py/homekit/mqtt/_wrapper.py index 5fc33fe..68af093 100644 --- a/include/py/homekit/mqtt/_wrapper.py +++ b/include/py/homekit/mqtt/_wrapper.py @@ -44,7 +44,6 @@ class MqttWrapper(Mqtt): except Exception as e: self._logger.exception(e) - def on_message(self, client: mqtt.Client, userdata, msg): try: topic = msg.topic diff --git a/include/py/homekit/mqtt/module/ota.py b/include/py/homekit/mqtt/module/ota.py index 2f9b216..16931e9 100644 --- a/include/py/homekit/mqtt/module/ota.py +++ b/include/py/homekit/mqtt/module/ota.py @@ -42,10 +42,12 @@ class OtaPayload(MqttPayload): class MqttOtaModule(MqttModule): _ota_request: Optional[tuple[str, int]] + _custom_ota_topic: Optional[str] - def __init__(self, *args, **kwargs): + def __init__(self, custom_ota_topic=None, *args, **kwargs): super().__init__(*args, **kwargs) self._ota_request = None + self._custom_ota_topic = custom_ota_topic def on_connect(self, mqtt: MqttNode): super().on_connect(mqtt) @@ -64,7 +66,7 @@ class MqttOtaModule(MqttModule): def do_push_ota(self, secret: str, filename: str, qos: int): payload = OtaPayload(secret=secret, filename=filename) - self._mqtt_node_ref.publish('ota', + self._mqtt_node_ref.publish('ota' if not self._custom_ota_topic else self._custom_ota_topic, payload=payload.pack(), qos=qos) diff --git a/include/py/homekit/temphum/base.py b/include/py/homekit/temphum/base.py index 602cab7..c9d5111 100644 --- a/include/py/homekit/temphum/base.py +++ b/include/py/homekit/temphum/base.py @@ -16,4 +16,4 @@ class BaseSensor(ABC): class SensorType(Enum): Si7021 = 'si7021' - DHT12 = 'dht12'
\ No newline at end of file + DHT12 = 'dht12' |