Set connection status, if MQTT get disconnected
This commit is contained in:
parent
9da84127f4
commit
dcc660d8d6
6
mqtt.lua
6
mqtt.lua
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user