Hassio Smartthings Mqtt

I recently setup the MQTT bridge addon built into Hassio. I then used the Smartthings Bridge Addon. Everything is communicating great. But my lights randomly turn off. I figured the mqtt db had become corrupt so I reinstalled that addon. Still same issues. Then I noticed I had some smartthings switches configured as dimmers in my configuration. I updated that and still the same issue. I am using retain: true and optimistic: true. Is there something I am missing? HA has no automations setup so its got to be something about the state between the two getting out of sync but I can’t figure it out.

Did you ever figure this out? I have the exact same issue. Just got mine working yesterday but the lights are going off randomly…

Same for me. I got the feedback that the retained state in the MQTT Broker might be the fault. It is required to clear it with a “NULL” command… however i have no idea how to do that… for now i have simply removed the affected switches.

I guess you have different “channels” for each light over mqtt, by channels i mean “state/kitchen” or “state/living_room”, etc.
What happens if you tap into the channel you have problem with? You can do so with the bash command mosquitto_sub after you’ve installed that program.
Do you see an OFF command there when the lights randomly shuts off?
If not, you probably have a bug in your light mqtt source-code regarding the reconnecting to the mqtt broker. Although, to be honest with you. I have no idea, just trying to help!

I’ve been struggling with this myself for a few weeks, and it looks like the ‘retain: true’ flag is the culprit. Once the retain flag is set to true, it’s sort of “stuck” in the database, even if you set it to false afterward. I tested this by completely wiping my hass.io install and starting from scratch. I setup 2 lights with retain true, and the other 8 without. The two with retain:true flags were turning on/off at random. Checking my mqtt logs, it looks like my mqtt is periodically disconnecting and reconnecting, and when that happens, the lights will toggle. (Usually turns on, not sure about them turning off though) Another thread mentioned that you can clear this setting using the command line - but to the best of my knowledge hassio is desinged to restrict command line access? Here’s my sources:
Phantom MQTT Light turning off?
https://www.reddit.com/r/homeassistant/comments/71az95/mqtt_smartthings_lights_turn_off_randomly/
I’m going to try unistalling/re-installing mqtt next and see if that will help. I’ll report back with results, not feeling optimistic though.

You don’t need to send the message from the same computer. Any computer with an mqtt client (such as mosquitto_pub) and access to the broker can send the messsage. So you could send it from a PC or from a phone with an MQTT client installed.

I got lazy and uninstalled/re-installed the hass.io MQTT plugin, and that did the trick. It had never occured to me I could do it from any computer- that’s going to be super helpful for debugging. Thanks for all your help!