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

Yes don’t know why it works!good!but I had a question,is it possible to turn on straight away instead of press the button,plan to use for lighting

where to buy the sonoff pow?

I bought 3 from 3 sources and all 3 cancelled the order …

You buy it direct from ITEAD. Not sure why you’d pay more from other suppliers. https://www.itead.cc/sonoff-pow.html?acc=70efdf2ec9b086079795c442636b55fb

There will be an upgrade to the firmware soon that will allow that. Right now you either have to do it yourself. Instructions are all further up the thread if I recall right.

Oh thanks not good in coding as for now the relay has no constant state whenever on and off.whether is recall from last state?maybe I had to wait for your update.thanks great works from you!if can implemented to HA without flashing will he even better…hahaha

They are out of stock

@KmanOz - thanks for the code, have just flashed a POW with your version and working well at the moment.

Is there an ability for it to remember the state at power off (eg in a blackout) and restore this state?
There are certain situations we want it to power up after a power outage (eg a fridge), but others such as lighting that might not want this feature (in case you are away from home when its restored).

this firmware is good also for the WiFI-RF version correct?

In your opinion is better to get the WiFi only version, or the WiFI+RF?

The RF will I be able to command through a Broadlink RMPRO?

Yes I am going to work on storing the relay state in EEPROM and restoring on bootup. Haven’t had a chance and also have no Sonoff’s on hand either. Will update soon.

I haven’t tested on the RF model or bothered looking at the schematic so without doing that I dunno. Not sure why you’d want to use RF when you have them on WiFi with mqtt. The RF OOK protocol is very basic and unreliable.

Slow flashing green light

Well… I’ve tried to solve this on my own.

Standard ITEAD Sonoff Wifi switch.
Using ESPsonoff-v1.0p
Mac OS 10.10.5
Arduino IDE 1.6.13
ESP8266 v2.3.0
UART: TTL-232R-V3v3

After a successful Upload, all I get is a slow steady blinking green light

  • I’ve tried multiple sonoffs
  • I can’t get Serial Monitor to work. I’ve tired every setting and all I get as garbage. (this must be a Mac thing or related to my UART). I get the same results using SCREEN or minicom
  • I’ve tried two different WIFI hubs

I’ve edited
int kUpdFreq = 1;
int kRetries = 20;

Everything else is standard.

I’m out of ideas… HELP. Thanks.

Arghh saw your message too late. I bought the RF version. My doubt is that in some areas the WiFi has not great coverage, and I see also WiFi in general not beeing so reliable (in terms of stability of connection), and my idea was that having WIFi+RF is better then WiFi only.

But HASS integration is my main concern (I want it!!). I asked the seller to change the order. Anyway you think the RF version will not accept your new firmware?

There’s nothing in my code that flashes the green led slow and steady. You sure it actually flashed because that doesn’t sound like the behavior of my firmware. That sounds like the default Sonoff firmware waiting in WiFi access point mode for their app to connect and configure.

Then you have other issues. WiFi should be rock solid. mqtt relies on a solid network. If your network is flaky then your whole setup is going to suffer. Not sure about firmware. Without studying the schematic or having one here, I cannot confirm anything sorry.

Interesting. Not fully uploading when explain a lot. It appears to be uploading, but I’m definitely getting a blinking green light. Here’s the process.

  1. It compiles: ~ 1 min
  2. Status changes to “Uploading” ~3-4 min
  3. Status changes to “Done uploading”

I’ll check for some more detailed logging. Here is a screen shot after it finishes the “upload”

Any idea what causes the Serial Monitor to look like this? I’ve tried all of the baud settings. It does the same thing in Screen and minicom. Points to a bad FTDI, but I use this cable successfully frequently (never with sonoff, though).

Thoughts?

Dude you have an issue. I’d say it’s cable too because the comms between the IDE and the Sonoff is cactus. 3-4 minutes to upload is not right. It’s not happening.

It’s there.

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

I do believe the firmware will work on this. I don’t have one to test but maybe you can confirm for me.

@KmanOz Is it reliable to connect 20 sonoff to my router? Is it able to support so many along with mqtt? It makes me some confusion to have 20 different ips.

That’s about how many I have. I forget they’re there until I do a Fing scan on my network and see all the stuff hanging off it :smiley: Dude there is so little traffic between these things it makes no difference how many you have. Stop thinking about IP’s. mqtt does not care about ip addresses for it’s communication. It’s a lightweight protocol and uses very little network resources that’s why it’s so good for IoT.

Facebook Messenger is built with an mqtt backend https://www.facebook.com/notes/facebook-engineering/building-facebook-messenger/10150259350998920/ mqtt is very very powerful but very lightweight. Read the article. It;s very interesting. Relax

1 Like

Is it possible to use gpio 14 to a pir motion sensor?so that can save energy for lighting?

That’s what I did :slight_smile: for my bathroom lighting