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

For mqtt or home-assistant I don’t see it being a problem. You should still check your router, some cheap router might have problem when too much device are connected.
But that quickly solved with for example a Xiaomi Router Mini for 25€.

1 Like

Care to share your settings?and code?

This is pretty much the only firmware you’ll need for any of the SonOff devices.

Also check this out he talks all about the things you can do with the SonOffs.

2 Likes

Just a feedback… after small change: “kRetries = 30;” works good :slight_smile:

where did you get the sonoff pow, I don’t find it available

Yeah I wrote it that way so people can modify it to suit the router / environment. Good to hear.

I think people are missing the point of why I developed my firmware. Yes you can connect 1 million devices to the Sonoff through GPIO14 or 4 or whatever. The reality is why would you connect a PIR direct to the Sonoff, when you could just get a PIR solution that integrates with HA directly. By having HA know the state of a PIR you can do many more things than just turn a light on and off in a bathroom. Theo’s firmware is great if you don’t have something like HA that is the central controller of your Home Automation network. The Superhouse video by Johnathan Oxer (another Aussie not far from me actually) is also great if you want your Sonoff to do crazy things using Theo’s firmware. My firmware is for people who DO NOT want to distribute the control logic across the network and do it all in HA, hence it’s simplicity. It’s basically a switch, not a PIR sensor controller or webserver or door minder or whatever. It was never designed to be that and I have no plans to make it that. If you were to get Theo’s firmware to act like mine (as in ON or OFF and nothing else) then his firmware is complete overkill. Plan your network, work out what you need and install the appropriate firmware. But if you are going to use HA to do all of your control logic, then all you need is this.

I am waiting on some Sonoff’s to arrive. My plans are to update the firmware and provide relay state on power up. So basically if the relay was on before power was lost it will come on again else leave it off. As for all the other crazy things you can do internally in a Sonoff, Theo’s software is by far the most comprehensive that I know of or perhaps ESPEasy.

Cheers

1 Like

Has anyone noticed that the Sonoff would randomly turn on without any user interaction? I’ve got one working just perfect and one playing up a bit but can’t find out why.

Which model is it?

My router (ISP supplied) has a maximum of 16 wifi clients. Its a pain in the backside. As others have mentioned you can get another one cheap enough.

I think the one thing I would like to see added to your software is the ability to set some parameters OTA, or perhaps even a complete OTA update. And that’s just in case my network changes or something. I am still in an experimental stage with my home automation setup. The idea of ripping the thing out of the wall to update the firmware is not a pleasing thought.

Please don’t think this is a complaint, merely a comment and perhaps a “feature request”.

Cheers.

Same happens here. I have two of these: https://www.itead.cc/smart-home/sonoff-wifi-wireless-switch.html

Edit: found an error in an automation. Switches are stable now.

@nickrout my router is technicolour TG784n v3

after reading the whole post, im still a little confused.
Is the sketch from @KmanOz able to handle a switch via the GPIO14 port?
and is the option added in the sketch.

EDIT: Yes it does. There is tested code further up this thread that handles it.

I installed two Sonoff POW switches and flashed your firmware, all working fine. I’m logging to Influxdb and I would like to see the usage over time (i.e. “usage last week” or “total usage this year”).

I’m looking for examples or documentation on how to achieve this. Anyone ?

I am very interested as well. You beat me to it. Influx is my next install :smiley:

Have you uploaded firmware to an ESP using OTA before?

The code I have written further up the thread for toggle switches works perfectly with no errors and has been tested on 20 sonoffs for the past few weeks. Hope this helps

I thought I’d seen this before. The thread has got a little long :smiley: Good work, that’s basically along the lines of what I wrote. OK I will merge your tested code it into the Github code over the weekend so it’s available for all.

Kman