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/homekit/mqtt/module/ota.py | |
parent | 2a5c34b28d7842ee2de2937faa36f78a1f5364fd (diff) |
mqtt changes
Diffstat (limited to 'include/py/homekit/mqtt/module/ota.py')
-rw-r--r-- | include/py/homekit/mqtt/module/ota.py | 6 |
1 files changed, 4 insertions, 2 deletions
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) |