I observed that the Ampel kept dropping metrics due to the mqtt client timing out.
This was also visible in the mosquitto logs, the Ampel kept timing out every 10 seconds, which matches the configuration of the mqtt client.
It is advised to call client.loop() in the controller void loop() function, so that pings are sent to the broker every few seconds to keep the tcp connection open.
This PR addressed this issue by having the mqtt client call its loop() function in the main controller loop() function.
I observed that the Ampel kept dropping metrics due to the mqtt client timing out. This was also visible in the mosquitto logs, the Ampel kept timing out every 10 seconds, which matches the configuration of the mqtt client.
It is advised to call
client.loop()
in the controllervoid loop()
function, so that pings are sent to the broker every few seconds to keep the tcp connection open.This PR addressed this issue by having the mqtt client call its
loop()
function in the main controllerloop()
function.