timherreijgers / Domotics-base

Project containing base code for domotics projects
MIT License
0 stars 0 forks source link

MQTT publish corrupted when retained message has been received #55

Closed Martijn-Luijckx closed 1 year ago

Martijn-Luijckx commented 1 year ago

When the broker gets connected, it sends the retained messages to update the controller. This recieved data corrupts something in the memory and after that, the MQTT publish only sends corrupted data, sometimes part of a string but most of the time garbled mess.

Probably there needs to be specific code to handle retained variables as soon as the controller is online.

adding a startup delay to the publish function doesn't solve the problem. the debug shows that the retained message is propperly received and handled, and completely intact. It seems that just the publish buffer is corrupted.

after sending an message on the same topic of the retained message clears the problem and everything works as intended.

timherreijgers commented 1 year ago

Seems to be caused by a bug in the controller (https://github.com/timherreijgers/Domotics/issues/70). Closing this issue