So yours does not turn off on HA restart? It’s odd, as the HA service should not interfere with a MQTT based entity. I’m debugging from a Windows 10 laptop so I don’t directly have access to mosquitto sub tools.
I’ve not had any issues. Expected to want to put tasmota on straight away but got it working with the settings I described. I can confirm it stays on when I restart ha. I am using a shelly 1 though. Not tried a 2 yet.
I am now but I do remember it working ok with the built in server too. I have found that the add on speeds up hassio, particularly at boot up as I have added more Mqtt devices
I’ve just spun up a Docker container with MQTT and connected one Shelly to it. Restarting that instance does not turn off the light but it does with the Hassio MQTT add-on. I also had an issue with the Monitor presence detection where the two Pi’s I had would flood the MQTT add-on with connect/disconnect messages and essentially make all my MQTT devices unusable. It did not appear to behave the same with a Docker instance on my NAS.
I might try flicking everything back to my Docker instance and see how I go.
Found my problem!! Something funky going on with MQTT Light. I have two of the Shelly relays configured as lights. Doesn’t matter whether I have MQTT on/off on the Shelly, clean session on/off, retain true/false on HA, none of it makes a blind bit of difference.
If I restart HA, it sends a command ‘off’ to the Shelly command topic which I’ve tracked using MQTT.fx. however, one of the Shelly relays is configured to control a ceiling fan as a MQTT switch as this does not turn off on HA restart (same device as one of the lights that does turn off).
Some for some reason, HA sends an off command on restart to the command topic of the Shelly lights.
@Crhass Haven’t played with that yet. Focused on keeping the lights going at the moment. I want the relays in HA as lights so I can use all lights off command in Lovelace and UI shows if any lights are on. I know I can do it with a template light as I’ve done with my Xaiomi switches that are controlling lights but I was hopeful of being able to bring them straight into HA as lights. Rob (?) from TheHookup is aware of my problem so I’m waiting to see if he has an answers. He posted a video today of configuring the Shellys in HA using MQTT.
This is my config running with a shelly1 as a light switch and a shelly2 as a roller shutter.
Enable MQTT on your shelly’s, and configure your mqtt broker (I’m using mosquitto in the same PI I’m running HA).
I don’t need the close_cover and stop_cover.
Are you using mosquitto? Can you run
# mosquitto_sub -v -h 127.0.0.1 -p 1883 -t '#'
And listen to what is happening in the broker
My buttons work and they reflect what I manually do, because the shelly switch send to the broker what is happening in the switch
The problem is that the Shelly2 always reports only the current status (close, open, stop). If the shutter is closed, then “close” is reported and at the end “stop”. Thereafter, always “stop” is reported.
With me it is so that when opening or closing the buttons are activated. The status “STOP” is not displayed.
I hope that the MQTT messages will be revised with a new firmware and more information will be provided. The way via REST is also limited, because there are not all status messages available.
Since I have no other firmware (Tasmota would be an alternative) to flash over OTA, I have to wait for the firmware to improve.