oh i bypass using UNO instead of FTDI adaptor, i think is uoload to the board, if not my sonoff original firmware how can be gone. my serial monitor did not show anything which i dont know why, maybe i will wait for my FTDI to arrive an try.thanks let me know if you have any updates
That sounds like a good idea
HAppy New Year!!! try again this morning now myc serial monitor show this
HAppy NY to you too. What is that the output of, the Sonoff? And if so how are you connected to it?
KmanOz, Thanks for your work.
Hi,ya from sonoff I don’t understand the output,is still bypass by my uno board
I don’t actually know what you mean bypass by your Uno board. If you have the Sonoff connected to the Uno, then stop wasting your time. Wait until you get a FTDI adaptor.
You would of had this done in 2 minutes instead of wasting hours and hours.
Hey @KmanOz
Thanks, your firmware works well on the Sonoff SV (https://www.itead.cc/wiki/Sonoff_SV). They have some GPIOs, but haven’t played around with them yet.
How do you handle reconnects, for instance when HASS (embedded mqtt) or mosquitto restart?
Which version did you use on the SV? Did you have to modify it in any way. If not I may include it in my Github supported devices list. Let me know please. I knew it probably would work but didn’t have one here to test so was not confident to tell people to use it.
As for reconnects, It’s already built into the firmware. Basically I check every minute for WiFi/mqtt. If it’s disconnected from either, I reboot the Sonoff until it comes back. Dirty? Probably, but it’s quick and easy and it doesn’t really matter because rebooting is less than a couple of seconds.
I can stop my mqtt server and bring it back online and switch will reconnect without fail every time and stay connected. It’s pretty bulletproof. I had a very complex routine for checking a while ago and opted for quick and dirty
@KmanOz
I have wired a DHT22 to the origin sonoff switch and flash the firmaware. Would you please me how to use the DHT22 sensors with the HA? what should I do with the yaml file? Thanks and Happy New Year!
Everything is here GitHub - KmanOz/Sonoff-HomeAssistant: Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant
Thansk a lot. I use the sensor.yaml.
I used the “v1.0p” without any modifications.
The only drawback with the reboot is that it always turns off.
Fair call. I guess I only ever designed this firmware for my environment and never thought about other situations. In my environment, mqtt is on UPS with all the other gear and never goes down. Lemme think about it but good point. I just remembered I’ve run out of Sonoff’s to test with LOL. They’re all doing something. I will order some more and look into it for you.
I have 5 sonoff plain old switches (not POW, not SV etc) and could post one from NZ - glad to contribute to your development.
PS why reboot? Why not just go into a loop detecting when mqtt comes back?
Believe it or not I have my old code that did exactly that. It’s a while ago though and I can’t remember why I changed it. It had to do with reliability and getting stuck in a loop that they couldn’t get out of for whatever reason. I figured if I was going to put them in a location that was physically inaccessible a reboot was fairly successful at starting them up again from an issue. For a stable environment that’s not a problem because they almost never reboot. But what @kellerza said is a fair point and I’ll need to brush up the code to make it stable. Thanks for the offer Nick. I’ll send you my deets with a PM.
Itead are pretty smart. I actually think that version will also work on the iTEAD Touch product which from what I can tell is a just a Sonoff repackaged so it looks like a normal switch that fits in a wall. Anyway good to know.
It has a slightly different chipset, esp8285, but it is programmable. The touch panel drags GPIO0 low when touched, and up again when you let go. (This is what I learned on the itead comments section, no original work here.) There are sample firmwares on the same comments page. I would think your code would make a good base, but you’ll need to handle GPIO0 as well. (or perhaps you do as I think the standard switch has the little press button connected to GPIO0)
Yep already does. That’s why I say should slip straight in. I have no use for them here but maybe someone who has one can try and let me know. 8285 or 8286 basically the same. 8285 has flash on board but everything else the same.
#define BUTTON 0 // (Don't Change for Sonoff)
#define RELAY 12 // (Don't Change for Sonoff)
#define LED 13 // (Don't Change for Sonoff)
That’s the only changes you would need to make on the touch JIC they use different pins but I don’t think they do, they use the exact same ones but wouldn’t be hard to figure out and adapt. The basic Sonoff sketch ESPsonoff-v1.0p.ino will work fine basically same for the SV. 1 design used 3 different ways by ITEAD. Smart !!
Got the Sonoff POW working in Home Assistant last night.
My HA database was corrupted after a power outage so the history component was not working.
A bit of Googling and it was just a simple delete and HA restored a clean DB next boot.
So thanks Kmanoz for your efforts, the Sonoff POW’s are now alive and well in my HA ecosystem.
RAWB