New Component - Sonoff S20 running ESPEasy

Hey, there are pro’s and con’s for every solution.

I’m pretty sure your solution will help a lot of people who don’t want to mess around with MQTT - or who don’t have the knowledge to do so.

Thanks for your work on this component :+1:

cheers :slight_smile:
I’ll get round to figuring out MQTT at some point and then wonder why i waited so long lol

I’m not trying to change your mind like some seem to think but if you want to give Mqtt a go and decide for yourself it really is stupidly simple. You’ve probably been overthinking it like I did and why I avoided it for so long. I then took it at face value and it just worked with no effort. You don’t need any technical knowledge, I haven’t, to either get it going or use it.

I’d be glad to try it out…

From what i can tell, i simply add

mqtt:

to my configuration.yaml

from that point on, i’m little lost mainly on the plug settings side of things…

I’m going to have to flash Tasmota to fix this i think…i’ll get back to you.

1 Like

I now understand your confusion, can’t find any concrete info on what you need to do to set the Sonoff up for MQTT using that, it’s appalling documented software.

If you are going to try flashing Tasmota as you suggested to @elRadix let me know because that genuinely is a 30 second job to get MQTT set up then.

The Tasmota wiki will be a breath of fresh air after ESPeasy as it tells you everything you need to know about just about everything and is easy to navigate straight to what you want.

2 Likes

I know it’s easy to setup, but I like having options not being depended on other tools like mqtt.
Direct communication is always better than passing through a middle man.

1 Like

OK, i think i’m configured to flash Tasmota now… but i can’t do it until i get home unfortunately…

Ill let you know how it goes

Lol, again I know what you mean but what exactly do you think this component is :slight_smile:

Anyway, as you can see, my answer was directed to @danmed who is interested in trying it.

Cool, if you want to use the built in component you just need to put…

mqtt:

in your config yaml as you said, if you want to use the hass.io addon instead just install it and start it, then add…

mqtt:
  broker: core-mosquitto

to your config yaml, then add this to your switches or lights…

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

The “sonoff” in the two topic lines lines is what you call the Sonoff in it’s config, either when flashing or in the web interface after, just make sure they match. Adding another just by changing that name.

When you flash it in user_config.h you can prefill the name at #define project, it will default to ‘sonoff’ which is why most people just add a number after for new ones, your wifi ssid at #define STA_SSID1 and password under it at #define STA_PASS1. Scroll down a little bit to the second #define MQTT_HOST and put your Pi’s IP address in. I’ve ringed what you need to change below…

After a successful flash it should just work, nothing else needed, you can tweak the config in the Sonoff’s built in web page if you want to as well as change anything you may have incorrectly entered in the config :slight_smile:

That’s literally it, good luck :+1:

Hey, thanks for this… i got one of my new Sonoffs on Tasmota but i found the response time to the MQTT requests and the basic HTTP requests really slow… in some cases up to 10 seconds response time… i’ve no idea why that would be…

I’ve gone back to ESPEasy and the response times over http are instant again…

Bizarre, my Basics are instantaneous. Really glad your component gets the job done for you, perhaps the S20 is one of the odd not so similar versions.

Possibly.

I’ll probably give it another go some time… but for now i don’t need MQTT… i’m sure i’ll come across a scenario where i do and i’ll be abit more motivated to give it a go.

1 Like

I’ve got 4 of those S20’s and they’re working perfectly with Tasmota firmware and MQTT.

The most important reason is: MQTT doesn’t need to know the ip-address off the device.

Just configure the name and you’re done!

1 Like

Glad it works for you with MQTT… i know the IP’s of all my devices as i set static leases for everything so that’s not a problem for me.

With Bobby_Nobbles pointers I now have got one switch working, but not two at the same time it seems. HA only shows control graphics for Sonoff switch2 currently.

Question that might sort me out. In the configuration.yaml can I do this for two switches.

switch:

  • platform: mqtt
    name: “Sonoff switch1”
    command_topic: “cmnd/sonoff1/power”
    state_topic: “stat/sonoff1/POWER”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

switch:

  • platform: mqtt
    name: “Sonoff switch2”
    command_topic: “cmnd/sonoff2/power”
    state_topic: “stat/sonoff2/POWER”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

Is it valid to have two switch: blocks individually, or must I group them under one instance of switch: ?

Nope must be under one. Once you get a bit more into it, follow this doc to tidy things up with separate files for each component group…

Have a read up on groups.yaml too as that is what dictates what shows in the front end and may explain why you can only see one switch…

https://home-assistant.io/docs/configuration/group_visibility/

Cool. That what I needed to do thanks. Actually both those documents didn’t explain it in a way I that could have really worked that out myself. I must be too old for this stuff now…

So my two Sonoff 20’s are now listed and will switch from the HA GUI.

What I’ve found out now though is partly why I had so much trouble. One of the two switches is behaving strangely, it takes 10 seconds or longer to switch outlet from HA, while the other switch is more like half a second very reliably. Also I have real trouble getting into it’s own web GUI, while the other good one is easy (first time every time).
I think the other switch has corrupt settings on the WiFi side or is generally a dud device.

so dumb question i have a switch with ESP_3B1707 do i need to flash it to set it up or is this already esp-easy?

Since deploying them, some of mine are a bit lazy at loading the web interface but switching is still instant.