Skip to content

Commit

Permalink
Set mqtt-homie messages to retain=True
Browse files Browse the repository at this point in the history
The Homie Convention defines that all message shall be published as retained messages.

Signed-Off-By: Tobias Lorenz <tobias.lorenz@gmx.net>
  • Loading branch information
tobylorenz authored and ThomDietrich committed Mar 28, 2020
1 parent 49df854 commit daf6f86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion miflora-mqtt-daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def flores_to_openhab_items(flores, reporting_mode):
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():
Expand Down

0 comments on commit daf6f86

Please sign in to comment.