mirror of
https://github.com/Tediore/battery2mqtt.git
synced 2025-04-12 03:13:43 +02:00
Revert only send message when state change occurs
This commit is contained in:
parent
6a8ff9fb6c
commit
4c321c66a7
@ -81,8 +81,7 @@ while True:
|
|||||||
try:
|
try:
|
||||||
client.connect(MQTT_HOST)
|
client.connect(MQTT_HOST)
|
||||||
client.publish("battery2mqtt/" + MQTT_TOPIC + '/' + dir, json.dumps(payload), qos=MQTT_QOS, retain=False)
|
client.publish("battery2mqtt/" + MQTT_TOPIC + '/' + dir, json.dumps(payload), qos=MQTT_QOS, retain=False)
|
||||||
last_payload = payload
|
|
||||||
except:
|
except:
|
||||||
print('Message send failed.')
|
print('Message send failed.')
|
||||||
|
|
||||||
sleep(INTERVAL)
|
sleep(INTERVAL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user