|
@@ -52,11 +52,10 @@ def _mqtt_on_connect(
|
|
|
else mqtt_broker_host,
|
|
|
mqtt_broker_port,
|
|
|
)
|
|
|
- _availability_topic_with_prefix = (
|
|
|
- userdata.mqtt_topic_prefix + _MQTT_AVAILABILITY_TOPIC
|
|
|
- )
|
|
|
mqtt_client.publish(
|
|
|
- topic=_availability_topic_with_prefix, payload=_MQTT_BIRTH_PAYLOAD, retain=True
|
|
|
+ topic=userdata.mqtt_topic_prefix + _MQTT_AVAILABILITY_TOPIC,
|
|
|
+ payload=_MQTT_BIRTH_PAYLOAD,
|
|
|
+ retain=True,
|
|
|
)
|
|
|
_ButtonAutomator.mqtt_subscribe(mqtt_client=mqtt_client, settings=userdata)
|
|
|
_CurtainMotor.mqtt_subscribe(mqtt_client=mqtt_client, settings=userdata)
|
|
@@ -96,9 +95,8 @@ def _run(
|
|
|
mqtt_client.username_pw_set(username=mqtt_username, password=mqtt_password)
|
|
|
elif mqtt_password:
|
|
|
raise ValueError("Missing MQTT username")
|
|
|
- _availability_topic_with_prefix = mqtt_topic_prefix + _MQTT_AVAILABILITY_TOPIC
|
|
|
mqtt_client.will_set(
|
|
|
- topic=_availability_topic_with_prefix,
|
|
|
+ topic=mqtt_topic_prefix + _MQTT_AVAILABILITY_TOPIC,
|
|
|
payload=_MQTT_LAST_WILL_PAYLOAD,
|
|
|
retain=True,
|
|
|
)
|