Post by papa on Dec 10, 2018 22:35:18 GMT
Caution: Using mosquitto.retain=true
in mqtt.cfg May Cause Issues
See the discussion starting at the end of this post
When ngy & I were (re)starting our Mosquitto/ Gateway connections, a mysterious ON command was sent to our garage opener nodes, actually opening the garage door. NOT GOOD.
I finally found how I had edited mqtt.cfg's mosquitto.retain setting from the default false to true.
Then I found this community.openhab threa
d where knowledgeable Rikoshak confirmed: "When you send a message with the retain bit, that message will stay on that topic until another message with a retain bit gets published to that topic. This means
any time the device loses its connection from the broker will get the retained message when it reconnects whether or not it has already processed that message. That may be perfectly acceptable in your case or it may be a disaster, [including] momentary actuators like my garage door openers where I absolutely do not want to use the retain bit
I reset mosquitto.retain to false & the mysterious ON command started to go away. Be aware you may need to break the Mosquitto / Gateway connection several times before it is consistently reliable. To break connection, you can unplug network cable from Gateway OR stop & restart the Mosquitto service on the host computer. You don't need to reboot the host computer until maybe a final test.