I’m new to Home Assistant: I just installed it and try to add two Shellies (a Shelly 1 and a Shelly Dimmer) via MQTT. I installed Mosquitto and via Node-RED I can see messages coming in and I can turn on and off the light, so MQTT is working. I also added them to configuration.yaml, and they do appear, but the status isn’t shown (always off) and if I try to turn the Shelly 1 on (in developer/status) nothing happens and the gui button switches back to off.
I did have that line in configuration.yaml, but I made an error in the IP address. Nevertheless, changing it doesn’t help (Mosquitto’s broker address is the same as the IP address of Home Assistant, 192.168.8.201, if I installed the Mosquitto broker add-in locally, isn’t it?). I also tried removing the entire mqtt section from configuration.yaml and setting broker to localhost, but neither worked.
Can you publish those topics directly from home assistant developer tools >> MQTT
Set the topic and just type “on” or “off” in the field below.
If that works, then the issue is somewhere with the config. If that doesn’t work, it’s with the mqtt agent setup. If your broker is running on the same device, localhost should work fine. Dont’ forget username/password if you configured one.
Looking at your config, I’ll only focus on the Living room stairs one for now. You should NOT set the retain flag to true unless you want your light to turn on/off if it disconnects from the broker and reconnects. Idealy, you should set the retain flag to true in the shelly device, and for the state topic only. The shelly should manage its own power on state should the device lose power and reboot. Otherwise, I don’t see anything wrong with it. Because it’s a relay though, it might make more sense to make it an mqtt switch rather than mqtt light. But in this case, it shouldn’t matter…
The mosquitto add-on is very picky about the configuration. Myself, I never use it, I just install regular mosquitto. But if you use Home Assistant (on HassOS), you can’t.
I tried a fresh installation of Home Assistant, which initially didn’t make any difference. But now I found out what the problem was: I had to set customize.active to true