Connecting SONOFF to MQTT in hassio

Hi guys,

Very new to all of this. A friend of mine and I are trying to setup Sonoff switches throughout the house. We are having quite a bit of difficulty.

I have had success with setting up the Sonoff. We have been able to flash the switches and connect to them via the IP address.

We have had success in setting up the raspberry pi, installing Hassio and and installing the configurator as well as the onboard MQTT broker.

Adding the Homekit setting in Hassio has also bee successful. I ow have a switch Icon in my phone.

The issue we are running into is connecting the Switch to the MQTT broker. Every time we go into the Sonoff IP and change the configuration of the MQTT to the IP address of the Pi then I can no longer connect to the sonoff through its IP address.

Any help would be great. I will let you know that I am super novice at this so I may not understand some of the jargon. Happy to send through details if need be.

Also a lot of sites show that there is an MQTT.yaml file. Where do I find this? because I cannot find it in the configurator.

thanks

I would recommend watching several of DrZzs Youtube videos. He does a very good job of telling how to use Sonoffs and how to flash Tasmota on them. I believe that he will answer your questions fully.

If you haven’t flashed Tasmota to them I would highly recommend it.

Some people use an MQTT.yaml file (ie create one) for either the MQTT broker information or end up putting their sonoff information in it.

I have a switch.yaml file where I store my code:

 - platform: mqtt
   name: "Heater"
   command_topic: "cmnd/heater/POWER"
   state_topic: "stat/heater/POWER"
   payload_on: "ON"
   payload_off: "OFF"
   qos: 1
   retain: true

I have had an issue where I couldn’t connect to the Sonoff (so much so it wouldn’t even connect to my WIFI) and what the issue was ended up being the version I flashed it with.

Sounds like the broker is doing ok and the Sonoff is working for the most part.

I recommend flashing v5.14.0 of Tasmota as the new version 6.1.1 has wifi connectivity issues.
I’ve been using the Mosquitto broker add-on on HA for MQTT.
the setup process is very simple but feel free to ask if you encounter any issues.
Happy automation

Do you have a link for this?

I flashed 6.1.1 on release and have had zero issues…

Can I also add, if there were significant issues, they would have been fixed but it’s been the latest for a month so I’m guessing it’s not that widespread. I could be wrong of course…

I did as well, flashed it on release on a bunch of brand new sonoff basics and couldn’t get the AP to show up.
Theo is usually on top of things, so i believe they got it fixed right a way.

I’ve got about 15 Sonoff basics running a mix of 5.11.1 and 5.14.0 no issues at all. I also have about 6 Sonoff touches and Sonoff T1s running a mix of 5.14.0 and 6.1.1 no issues.
I flash my B1s with 5.14.0

here’s the link you asked for:
Tasmota V6.1.1 wifi AP issues

So the issue is with access point mode then? I went from 5.1.2 to 5.1.4 to 6.1.1 OTA and didn’t have any issues but I guess because I’m not using AP mode - I have the WLAN already working.

When I originally flashed Tasmota, I did it via PlatformIO and I entered the WLAN details in there so I never tried using WIFI Manager AP mode.

Yes sir. since then i started using the binary file with flasheasy and then send the device settings with the Backlog serial command using termite.

Right… I saw Drzzz using Termite but didn’t really follow why he was doing that…

Have you tried to enable “auto discovery” in configuration.yaml for Tasmota?

I had the same issue when I tried to flash 6.1.1 on a Sonoff iFan02 module.

the fix was to flash version 6.1.1c.

After that it worked perfectly.

Hi, if you are still having issues, I’ve put together a guide and video on how to connect Sonoff to MQTT here.

Hi, I actually opened the switch to turn off the Sonoff Lamp following the following tutorial:


If you have any questions you can ask, I will give you an enthusiastic guide.