Set connection status, if MQTT get disconnected

This commit is contained in:
Ollo 2021-03-14 13:44:54 +01:00
parent 9da84127f4
commit dcc660d8d6

View File

@ -117,7 +117,11 @@ function registerMqtt()
end end
end end
end) end)
m:on("offline", function(client)
print("MQTT Disconnected")
mqttConnected = false
end
)
m:connect(mqttServer, 1883, false, function(client) m:connect(mqttServer, 1883, false, function(client)
print("MQTT is connected") print("MQTT is connected")
mqttConnected = true mqttConnected = true