diff options
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) |