ESP8266 reconnect MQTT issue (auto get subscription status)

Hi… everytime my ESP8266 reconnects to the MQTT server (mosquitto on raspberry pi), it gets the status of my subscriptions (two switches im my case). I’m using arduino IDE with PubSubClient.

Its not supposed to… Its supposed to get the status of my switches only if i change them…
I also set the retain flag “false” in my openhab.cfg.

Can anybody help me?

Are you publishing your switch state changes as retained? If so when you re-subscribe the broker will publish the retained values.

Its exactly whats happening… But I can’t disable the retained messages… In the openhab.cfg can only configure if the broker retain the messages sent to it… 2 days trying and still can’t find a solution… :frowning:

I realy need help… Im thinking about not using openHAB becaus of this little problem… :frowning:
I just need to disbale retained messages from an item…
I dont want the last value after I subscribe… :frowning:

You can create two MQTT connections (in openhab.cfg), one which is retained, one which is not. Then depending on what you need to do you use the different connection ids in your item binding.

I dont need retained messages, i set it false in openhab.cfg, but i still got the same problem. No diference. :frowning:

Your message is probably already there - once it is retained it remains on the broker. It is, afterall, retained!

You need to publish a retained null payload to that topic to clear it.