SonoffS22 Switch

This is the other version (s22) image that i’ve found on Github under a TASMOTA thread.

The first image shows in the middle of the board that the V pin is closest to the power wires, so the order of the header pins in the 2nd image from top to bottom should be V, RX, TX, Gnd.

Fair enough… However I use Google Home for voice control. Pretty much none of my stuff works without Internet. Xiaomi, Milight, Yeelights and Sonoff…

Maybe I can set all those up with MQTT but I’ve not touched that yet. The Sonoff with Tasmota will be my intro to that black art lol!

I use Google Home and Amazon Alexa for voice control. They do require an internet connection to function, there is no way around that that I’m aware off, so no internet means no voice control, however, all automations that I have in place still function without internet, including Yeelights, Sonoffs, WeMo switches, Xiaomi switches, Osram Lightify, 433toMQTT WiFi bridge etc.

If I am on my local network, I still have full control over all items through the HA web interface as everything is locally controlled and all automations still fire turning lights/switches on/off.

I’d like to know which version the S22 board is. I suspect it may not be the AU one.

1 Like

Well got the usb adapter and header pins.

The USB adapter header looks like this:

Pins are labeled from top:
3.3
RST
5V
TX0
RX0
GND

So the TX and RX are jumpered.
It also came with only 3 wires for patching… I am sure I can find another one here… I’m assuming I need to use 4 wires and I need to remove the jumper from TX-RX and use the 3.3 and gnd pins as well.

Is this correct?

make sour you only GIVE it 3.3 vvc ground the gpio 0 first plug into computer should go beep and them you should here an other beep telling you it in program mode

Yes, remove the jumper, connect 3.3 and gnd to the respective pins on the S22. RX goes to TX and TX to RX. Hold the switch on the S22 down when you connect the 3.3V in order to put the micro controller into program mode.
What are you using to send the program? I use platform io running in VS code.

I was going to use Windows 10 - the instructions seem to have step by steps for that.

Windows 10 is an operating system. You need to run a program on it in order to compile the code and flash the esp8266 micro controller.
The Tasmota source is set up to compile on the platform io IDE. It will compile on the Arduino IDE, however you have to run a non standard one.

I’m wondering if you have previously done any programming?

Very little programming. I used to code in GWBASIC and Quick Basic LOL. I’ve installed packaged from source in Linux etc.
I was just planning on following the instructions in the tutorial. That seems to include the programming software. Arduino I think. I’m going to take a look at it tomorrow.

The Arduino IDE is pretty basic and not the easiest to navigate a reasonably large project. As the Tasmota suite is already set up for platform io, I suggest you download Visual Studio Code from the windows store - its free - and install the platform io plugin. I’ll be around tomorrow and can talk you through the process if you like.

Windows 10 has Skype, we can converse there or by phone. message me a number and I’ll call you.

John

1 Like

Will do John. Thanks! Baby sitting duty tomorrow so maybe Sunday…

Sunday works for me.

That Image @kanga_who posted is exactly how the S22 looks when you open it up.

Gotta say I found DrZ’s blog and video pretty useless unfortunately. It just wouldn’t work.

@bukurat was awesome and we spoke on the phone. I ended up using Visual Studio Code as John suggested and it was pretty straightforward. It didn’t like my complex WLAN password, same as the ewelink app but as I wanted to use it with a repeater I was able to get that to work no issues.

The MQTT configuration suggested by DrZ worked perfectly and once flashed the switch just worked immediately.

Not sure why MQTT is better than the IFTTT and Binary switch I was using except it’s going to have less delay I believe. Pretty sure I was also getting the temperature before but it’s just a switch now.

Anyway, good experience. I’m leaving the other S22 as is as I want to be able to control it if Home Assistant is not working for some reason.

Thanks everyone for the help and advice especially @bukurat

Not sure why I see this in the logs of the Hassio addon for MQTT

1523936682: New connection from 10.90.11.16 on port 1883.
1523936682: New client connected from 10.90.11.16 as DVES_4E6C26 (c1, k15, u'mqttuser').
1523937452: Saving in-memory database to /data/mosquitto.db.
1523938165: Client xxx disconnected.
1523938191: New connection from 172.30.32.1 on port 1883.
1523938191: New client connected from 172.30.32.1 as xxx (c1, k60, u'mqttuser').
1523939253: Saving in-memory database to /data/mosquitto.db.

Local MQTT is better because you have complete control, you’re not relying on some other dude’s server on the internet.

Try changing the S22 config to th10 and see if the temperature works. You will have to change the yaml script to read the temp sensor.

grc.com shields up says 1883 is closed.

So in my config yaml I have the switch configured thus:

mqtt:
  broker: core-mosquitto
  username: !secret mqtt_user_name
  password: !secret mqtt_password

and with the Hassio MQTT Broker options are:

{
  "plain": true,
  "ssl": false,
  "anonymous": true,
  "logins": [
    {
      "username": "my username",
      "password": "my password"
    }
  ],
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

Wondering how to change that to get TH10? Also maybe I should use SSL? (I run SSl for HA)

If I change to SSL, (plain:false, ssl:true and anonymous:false) do I need to edit the config of the Tasmota as well as it seems to be locked to 1883:

Nothing there needs changing. TH10 is another version Sonoff device, essentially a Sonoff Basic with temp sensor. If you tell the Tasmota firmware is running on a TH10 and not an S22 you may see temperature readings sent to the broker. The switch part will still work as Sonoff appear to have the same GPIO port for the relay on all devices.

You will have to change the HA YAML configuration to get the temperature.

I mentioned how I use node- red to see what is sent to the broker yesterday. Once you know what’s sent and to where, you can set up HA to read the temperature.

What changes do I need there?

I just found this thread. It will give you an idea.