So as I am learning about HA I am running into some issues with mqtt switches. If I set up only one switch it works, but if I try to set up two switches only the top ones seems to work.
If I delete one, save and reboot, the one left works great. If I have both of them only the one I list first will show up. Since both of them work fine by themselves I don’t think syntax is the issue, but then again what do I know?
Tom, wow you are quick! I posted since I am about to go to bed and figured I wouldn’t get a reply until tomorrow. Thank you so much. Next time I post code will follow the correct instructions.
well yesterday I was able to get one switch working with MQTT but was having issues getting the second one to work. Since then, and after about 5 fresh installs I can’t seem to get a single switch to work with mqtt
Does the “etcher” format the SD card each time the hass file is flashed? I basically take sd out of the pi, run etcher on it, then put it back in. Or does it just copy files and might leave some of my bad files there?
On my very first install I was able to add my zoneminder cameras without much of an issue. Today on my last install I am having issues as well. The camaras list but don’t display.
Not sure what to think. Things I got going relatively easy on my previous installs I am having a hard time with now. Not sure what else to blame except maybe the SD card. I tried to remove all partitions with gparted but wasn’t able to unmount some partitions so I just gave up and put it back into etcher.
I actually started another mqtt post today. I followed Dr Zzs video first time around, and got one switch to work. Well now, with fresh installs I can’t seem to get it going even when I follow the video step by step as I did the first time
You don’t need to re-flash HA on to the SD card when you have a configuration problem.
Run the configuration validation in the configuration / general menu. If it passes, good, go ahead and restart HA or reload the section you’ve changed (script, group, automation, or core). Ifi it fails, work out what you’ve done wrong and try validating again.
Lurching around reflashing the card isn’t going to help. It’s not working because you have an error in your YAML. You have not yet posted a correctly formatted yaml code so anyone can help you. Start there and stop continually thinking you can do the same thing over and over and get a different result. The answer will present itself simply when you post your code correctly.
I had my original setup of about a week, had added zoneminder, etc. Everything was fine until I did something wrong on the yaml file and I wasn’t verifying my changes. I rebooted and never got the web ui.
I’ve haven’t had much luck in past working with ssh, so basically I didn’t know how to access the web ui again. Didn’t have samba installed either. So figured I could spend hours figuring out how to get back in to fix my file, or just start from scratch. I assumed I could get everything back and going in about 30 minutes.
See that’s the problem. NEVER reboot. Ever. Really. If you reboot and bypass the config checker, if there is any YAML error, HA won’t start and you get no webUI and you then need ssh to be able to check the logfile for errors and then edit the yaml files to correct.
There is a config checker but it sometimes seems to not pick up errors. When you use Configuration->restart server it won’t restart the server if there are any errors.
Are you using hass.io and the MQTT broker add-on? It looks like you are to me. IF you are, then you can delete the mqtt: section from config yaml as it is no longer needed. You then also add the MQTT integration in Configuration->Integrations.
I also created a Home Assistant User for my MQTT and so my addon configuration looks like this:
Those are the bog standard defaults with no username/password defined. I created a user: mqttuser with a password mqttUserPW as per your example and then you don’t need to specify it in the addon and don’t need mqtt: section at all in config yaml. (Unless you have a broker configured some other way or on some other machine and not using the hass.io addon)
You COULD also use MQTT discovery and you would then also delete the whole mqtt switch from config as well as mqtt: section.
To do that, you would delete the mqtt: and mqtt switch and restart HA.
Then from the tasmota (assume you use Tasmota) web interface SetOption12 and you will see switch.xxxxxx in the entities which you can customize.