Sonoff-HomeAssistant (Alternative firmware for Sonoff Switches for use with mqtt/HA)

@KmanOz I must be doing something stupid, but I can’t get it to work:
I flashed the firmware to my sonoff basic, I can see it’s connecting with MQTT server of my HA, but I don’t get anything when I switch the button: the updates simply do not make it to the sonoff.

It’s like I’m not subscribing to the right topic or something (checked it ten times!).

Any hints? Any help appreciated, thank you!

My config:

- platform: mqtt
    name: "Grzej_syp"
    state_topic: "home/sonoff/living_room/1/stat"
    command_topic: "home/sonoff/living_room/1"
    payload_on: "on"
    payload_off: "off"
    qos: 0
    retain: true

EDIT: The issue was not in the code - I was hit with this issue after upgrading:

This only goes to show how you should never do two things at one step…

@outrun i have flashed my one and only S20 and it works 99% BUT i can’t get the button on the S20 to switch on/off, does the button on the switch itself work for you ? Switching on/off from HASS works fine.

I flashed https://github.com/KmanOz/Sonoff-HomeAssistant/blob/master/arduino/ESPsonoff-v1.01tOTA/ESPsonoff-v1.01tOTA.ino to the switch.

1 Like

The S20 code has not been tested by myself but by others. I don’t have one here to test but will have in a few days. I’ll let you know my results and will make changes if necessary.

Kman, great work here. Really enjoying it so far. There is a pic on the github page showing the FTDI adapter connected to the Sonoff POW model with the line / neutral hooked up too. I can definitely confirm that will in fact fry the FTDI adapter and the motherboard of the host PC when you’re using 220V. No hard feelings - the computer was spoils of a failed startup and begging to be replaced anyway. But maybe a warning is in order for the less well informed?

Sorry for the late reply. May be you missed the file named CE-LVD Report-Sonoff Series.pdf.

This seems to be test report related to the Electrical Safety. Seems the select models of SonOff switches have passed these tests.

Probably a fake document. In China is full.

Yeah nah fair enough. If it’s any consolation it’s not plugged it LOL

Sorry about that :slight_smile: I have some updates I’ll be making soon to the Github page, I’ll try and remember to either change the photo or leave a note.

I’ve got some interesting products coming from ITEAD.

Any of it include a PIR sensor? I looking for some easy to do PIR sensor with MQTT. I was planning to go Xiaomi way…but that would mean buying their gateway as well…but would wait if ITEAD had something from their line.

They do already

https://www.itead.cc/smart-home/sonoff-dev.html

plus

https://www.itead.cc/prototyping/electronic-brick/electronic-brick-pir-sensor-brick.html

Wouldn’t a pir sensor connected to a NodeMCU and report as mqtt be a more cheaper and better alternative? Better because you can updated and modify your own way @madtech360

You can add a PIR to gpio 14 on the sonoff, I used a HC-SR501 because you can set the time it’s on for and the sensitivity. They are about £0.80 on Aliexpress.

I am looking for the same. Would be great if itead made one of those.

So for many years now I have been using this RF gateway that I built on an Arduino. It send and receives 433Mhz and talks to my MQTT broker. I use it for wireless PIR’s. Door Switches and for controlling a handful of RF Switches I have around the house. This was a stand alone controller for many years before I moved to HomeAssistant hence the clock module. Sunrise Sunset automatons were micro controller based. The DHT still reports temp though.

ITEAD have now designed an RF Gateway based on a ESP8285 that will have a receiver and transmitter onboard. My plan is to migrate the code I have on my gateway and get it working on the new gateway from ITEAD. Mines been controlling the house for years but I have just never got around to building a case for it. The ITEAD one is a neat looking unit. Anyway I’ll keep everyone posted on the progress.

Kman

1 Like

Do you have a link to this gateway you are referring to ?

Only in Chinese for now. They are still working on English version. http://ewelink.coolkit.cc/?p=850

1 Like

Interesting to see how good it is at learning codes because there are such a big variation of items that are not easy to learn code for.

why not the broadlink rm pro?

I think you’ve missed the point. I am going to write my own code for this unit not use it out of the box. Learning is code dependent, All I care is that they use a sensitive receiver module with a sharp front end. I went to a lot of trouble (and modules) to select the right one I use in my gateway. I get great range (typically 40+ meters). If they’ve used a cheap receiver module (based on an LM358 for example) the unit is useless for the application I have in mind because I have PIR’s and door sensors scattered throughout the whole house and their signal just won’t be received.

If you want a straight RF blaster use a Broadlink RM pro as Claudio said.

Thanks KmanOz for the firmware.

After test various firmwares, That is the best, simple and very functional its that all I needed for my sonoffs

@KmanOz can u send to me a sample code for integrate a sonoff 4ch on Home Assistant.

I try but not work for me whit sonoff 4ch.

The others sonoff, pow and th16 its works fine, but de 4ch not