Hi all,
First time poster and new to HA, so don’t be too cruel
I just installed hassio (HassOS 2.11) on Pi 3B+ and find it very hard to get clear and accurate instructions for some items like MQTT.
I created a new file called /config/switch.yaml using the configurator add-on with details of two Sonoff devices with Tasmota 6.5.0, but only the first one is recognized and controllable.
The MQTT topic is the same on both( yes, I know about having unique topics), but I use the fallback topic in my configuration switch.yaml.
I can use MQTT pub message to control both switches manually using the fallback topics, but the second one in the config is not available in HA.
I tried using unique topics on the sonoffs, but there is still just one in HA.
It’s hard to know what the issue is as you’ve posted a config that won’t work and no screenshot of MQTT in the sonoff settings. (Tasmota MQTT settings)
Hey, welcome
I know the struggle, dont worry, we ll figure it out.
First off, is there a line switch: !include switch.yaml in your configuration.yaml or something similar?
Second, In order to improve your current and future troubleshooting, i would start by installing on hassio one of those:
A Mosquitto add-on (there’s two, one just server, one with client) so you can see what is going on on your mqtt server. Unless you have ssh access to check things and you are comfortable with that (I’m not)
I already had the Add-On Mosquitto MQTT broker installed and don’t have any mqtt settings in my configuration.yaml file, what should it contain? The add-on has its own configuration section.
Also, your retain: true has already screwed up the connection behaviour (when the switch reconnects to WiFi after losing connection) so when you get them working I can tell you how to fix that as well…
One other thing, you’ll benefit by installing MQTT explorer…
Hi ,
I have updated the topic and have not posted an updated screenshot, sorry.
How would my entity names “switch.xxx” relate to my config above? Is the xxx supposed to match the topic name or the “name” field?
If you use MQTT Discovery, the switches will be automatically created with the MQTT Integration. They will be called switch.whatever-the-config-name-is by default… (see my screengrabs) You don’t need to manually configure the switches if you use MQTT discovery. (SetOption 19 On turns on MQTT Discovery)
(Note it does drop the ‘-’ from the friendly name)
HA now discovered my Sonoffs and I can see the correct status of both.
One of them is a Sonoff POW R2 and I see the readings for it as well.
My next step is to try and add some ESP32 (running Micropython) with temperature and humidity readings as well.
Any suggestions, I suppose they will need to be added manually?
Thanks for the help so far. It helped a lot.
BTW: I don’t see the MQTT explorer add-on. Do I need another repository?
MQTT Explorer is a stand alone program that makes it easy to see what is happening with MQTT. It will also fix the retained messages issue you will eventually discover.
I don’t even have a mqtt section AT ALL in config - that is not needed if the broker is on the same machine as HA.