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

Yes I know your firmware will not support the self locking function that these units have. I use them instead of sonoff SV as they are cheaper. I may get round at some point to making modifications to your firmware so it will fully function on them. If I do will post an update

1 Like

I have tried different client names, Different wifi hotspots and different firmware versions. Is there a way to clear the eprom and start fresh. I am gonna go try a windows machine and see if that makes a difference but my guess is it won.t

Well, that “piece of paper” mean certainly much more than what you claim on this forum… and no the owner of the shop won’t go to prison… a shop can sell an electrical cable, if you plug it holding the other end it’s your problem, not the shop’s problem.

Have you tried changing this value in the firmware to something higher?

int kRetries = 10;                      // WiFi retry count. Increase if not connecting to router.

Really, say what does that piece of paper mean for you . I am all ear

tnx - will do.

First I can say my network is ok, running 20 esp devices, 3 arduino, 7 raspberry, 8 computers 4 tablets, 3 nasses and 2 servers!

second point:
It doesn’t cut the power it can switch the relays to off which might be a reason for overheating stated in other posts, and it was an example if you are worry about the safety. Mine never heated up.

I don’t use a NTC, none at all, but I like to make the esp8266, which isn’t a dumb switch in the first place, I run the rx/tx wires for sda/scl and have displays on it, bmp280 sensors, PIR, direct switches so it is so much more capable. It was a matter of speaking that if you worry well don’t use them or do something to take your worries away.

And yes I do use rules in the SONOFF itself, I won’t go into details about what they need to do because I guess none of my examples will cut wood in your opinion, it is just that I see reason and like to tell others that it is an option.

If you don’t like them or do not trust them or do not find them safe enough, well do not use them, and just mention it here cause it might help other people to decide.

And it is quite easy to get them connected to HASS.

And please don’t get angry for nothing, this forum is to help eachother, and have fun, cheers

I am happy to discuss this so people learn. Overheating like I said is caused by either overloading the Sonoff or a malfunction of the unit itself. If you have overloaded it, adding a NTC to tell you it’s overloaded is just ridiculous. Just don’t overload it in the first place and you wont have an issue.

Now if it malfunctioned, that would happen well before the relay, probably in the switchmode supply. How is cutting off the relay going to help? I have no issue in improving something as long as it’s logical. Illogical improvements are pointless.

I play around with ESP’s too. But what your describing isn’t a Sonoff switch. It’s a custom device based on a ESP8266 chip. The code I have written is specifically for a Sonoff.

Please go into details, but here’s the thing, I guarantee you that it can be done without having rules in the Sonoff and there is very little benefit by doing so. Prove me wrong though, I’d be happy to see a situation that I cannot think of where it benefits users and I can write it in the code for the future.

If I don’t like them? Dude I spend some of my time writing firmware for them. Why would I not like them?

Angry? Who’s getting angry? And actually this thread in the forum is for helping people using my firmware and supporting them as much as I can. If you have a great ESP project why don’t you start another thread where you can explain to people what you’ve done and how good it is.

Also I noticed this on one of your previous posts.

Well maybe you need to spend some time with HomeAssistant and make it work flawlessly. Start by removing automatons out of your Sonoff and do it all in HA. Maybe that’s why you’re having issues. Compared to some of the other the solutions available, HA is probably one of the easiest is very powefull and has an incredible community for help.

2 Likes

Sorry dude I missed this because some of the rubbish that gets posted into this thread.

You need to install the DHT library. That should sort you out.

Thanks!! I got the right DHT library installed after trial and error which is what appears some of the people whining about your efforts are not doing. It has been my experience that when something isn’t working look at your own inputs, most likely it is a typo. All of my issues making your firmware work has been my mistakes. Thanks again for all of your support!! Your firmware is the best and the easiest to use I have found. I am looking forward to seeing your firmware for the https://www.itead.cc/sonoff-4ch.html . It appears some of the people following your thread don’t understand (AC) alternating current, EU or USA it can shock and kill if you aren’t carefull and have no experience!! Maybe these people should pay someone to automate their home!! Thanks again, keep up the great work!!

1 Like

KmanOz, I think it is awesome that you write your own esp firmware, that I can’t. The discussion is/was an alternative esp firmware, I am talking about ESP Easy which I think is just perfect.
And with that firmware it is possible to add displays, bmp sensors Pir and many other input and output devices on a sonoff.
As said the firmware that I use offers the option to use the RX/TX wires as SDA/SCL use which gives the Sonoff two extra GPIO’s, and on that bus you can use multiple devices.
So a just gave an alternative. Which might be helpfull, and it does DHT sensors just choose dht11 or dht22, set gpio and openhab protocol, and remove the extra \ in advanced option. set broker address and mosquito picks it up. Voila

And an example you asked about is I decentralised the pir, when I go into the cellar the lamp switches on by a PIR, it has a timer rule, and a detection rule all in the esp8266, sure I still can switch the light on and off from HASS, And sure I can place my automation rule in HASS, but in HASS it is far more a HASSle, lol.

Try OTA vession,look like more difficult to connect wifi,how does the OTA works? Can I change my router setting over the air?

@KmanOz Hello. I bought a sonoff RF by mistake. If I use the ESPsonoff-v1.01p firmware can I turn on and off the sonoff by the physical button? If I solder two wires on this button and turn on another external pressure switch does it work?

And i would like pay you a beer? Do you have a paypal?

Found this in plattformio.ini:
[env:1ch-inching-debug]
platform = espressif8266
framework = arduino
board = esp01_1m
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = -g -Wl,-Tesp8266.flash.1m128.ld -DDEBUG_PORT=Serial -DITEAD_1CH_INCHING

Could be for a different board but I thought I might try. Have to try again with the info from the iteadstudio forum regarding the non-working TX Pin - cutesy of mudman.

Hello
Is it possible to link those sonoff devices from itead to hue bulbs? Perhaps with some Home Assistant script or automation? I want to use them in my wall switches. They don’t have to switch anything physically (although I’m aware of the relay in the itead sonof devices). They would switch anything / I would not connect anything to them.

At the moment I’m tinkering with ESP-01 chips. It’s fun but for 5$ for an itead sonoff I would stop wasting further time.

Thanks for any hint :wink:

As those sonoff devices show up in HASS it shoud be perfecly possible to integrate them behind your wall switches to remote control your hue bulbs. You have to connect your phase wire and your neutral to your hue bulb. This way it’s powered on always and not switched. Then let your sonoff switch whatever it wants. The important part happens in Home Assistant. Would you agree?

PS: After reading this really big thread I saw there was some discussion about having sonoff synchronized with the physical switch:
Reply by @HVPereira
Another Reply by @HVPereira
Reply by @blackgear

PPS: I realized once again I started developing a solution that was already invented. Anyway was a lot of fun learning about ESP8266

He Guys,

just did not read the whole Thread, since it’s pretty large. So i don’t know if anyone already have another Solution for this.

I made some changes to KmanOZ’s firmware. My Version will not restart the whole device if the MQTT-Connection gets lost (e.g. restart HA-PI, some Network issues, …) It just try reconnecting to MQTT. If you press the Button 4 Seconds it restarts the Device. Since I’m not a dev, just try this on testing Device, if it works correctly for you. Afterwards you can give it a try on productive Devices :slight_smile: . I flashed 3 Sonoff S20 with this and i works well for me, for 3 Days now.

Heres my Code:
https://github.com/outrun0506/Sonoff-MQTT-Switch

BR

Lukas

Have you read the certificates?

One is for ROHS, “This directive restricts (with exceptions) the use of six hazardous materials in the manufacture of various types of electronic and electrical equipment.”

One is for the radio component

None relate to electrical safety as such.

1 Like

Theo Arends has updated his Wiki with HA configuration examples: https://github.com/arendst/Sonoff-Tasmota/wiki/Home-Assistant

It’s no different.

Yes you can change the whole sketch OTA. Setup your OTA environment in the Arduino IDE by installing the right verion of Python (I have 2.7.13) and you will be able to update the Sonoff directly from the Arduino IDE.

Yes you can. Firmware is the same on Sonoff & Sonoff RF.

[email protected] ----- Thank You

Yes give it a try and let me know the result.[quote=“linuxlurak, post:420, topic:2332”]
Is it possible to link those sonoff devices from itead to hue bulbs?
[/quote]

Hi Im not exactly sure what you are trying to achieve. Do you mean Sonoff Touch so you have a nice wall switch? Please explain further.

That’s great. You should have forked it thought rather than creating a whole new Github. Haven’t looked but I’m sure your code will be fine.

It’s still unnecessarily complex firmware for a simple switch. Great if you are using it standalone (without Home Automation software like HA). Steep learning curve to start using it for beginners if you aren’t going to utilize most of it’s features for HomeAssistant. Do you go to his forum and post any upgrades I make to my documentation :smiley: :smiley: :smiley: