Revert only send message when state change occurs

This commit is contained in:
Tediore 2021-08-05 14:07:00 -05:00
parent 6a8ff9fb6c
commit 4c321c66a7

View File

@ -81,8 +81,7 @@ while True:
try:
client.connect(MQTT_HOST)
client.publish("battery2mqtt/" + MQTT_TOPIC + '/' + dir, json.dumps(payload), qos=MQTT_QOS, retain=False)
last_payload = payload
except:
print('Message send failed.')
sleep(INTERVAL)
sleep(INTERVAL)