Переглянути джерело

Set mqtt-homie messages to retain=True

The Homie Convention defines that all message shall be published as retained messages.

Signed-Off-By: Tobias Lorenz <tobias.lorenz@gmx.net>
Tobias Lorenz 7 роки тому
батько
коміт
daf6f86bdf
1 змінених файлів з 1 додано та 1 видалено
  1. 1 1
      miflora-mqtt-daemon.py

+ 1 - 1
miflora-mqtt-daemon.py

@@ -391,7 +391,7 @@ while True:
         elif reporting_mode == 'mqtt-homie':
             print_line('Publishing data to MQTT base topic "{}/{}/{}"'.format(base_topic, device_id, flora_name))
             for [param, value] in data.items():
-                mqtt_client.publish('{}/{}/{}/{}'.format(base_topic, device_id, flora_name, param), value, 1, False)
+                mqtt_client.publish('{}/{}/{}/{}'.format(base_topic, device_id, flora_name, param), value, 1, True)
             sleep(0.5) # some slack for the publish roundtrip and callback function
         elif reporting_mode == 'mqtt-smarthome':
             for [param, value] in data.items():