[OBSOLETE] Sonoff, Sonoff TH, S20, Dual, 4CH, POW, & Touch Device Handler & SmartApp ($5 & $10 Smart Switches)

I don’t know the answer to the question, but this put a smile on my face. :slight_smile:

1 Like

Last night I had a chance to work on and I’m just about finished with the firmware / device handler for the Sonoff Dual. It is about 90% complete with just a few things missing (the auto-off feature, power on state, and some dual specific options that I want to add). Other than that, things are pretty solid on it. For those that wan’t to start using it while I finish things up.

This device is a composite device and requires 2 handlers to be installed. They are both posted below. Also, make sure you update the Sonoff Connect app.

It has clearly labeled headers (other side of the board), but putting it in flash mode is not as straight forward. Connect the right side of the shown resistor to GND. I’ll try to post a better photo later.

Frimware:

https://github.com/erocm123/SmartThingsPublic/raw/master/devicetypes/erocm123/sonoff-dual-wifi-switch.src/SonoffDual.ino.generic.bin

Main Handler:

Child Handler:

3 Likes

Yes the NO/NC contacts are dry.

Eric,

Thank you so much for a great example of using the new Composite Device Handler. I have been working this morning on incorporating the Composite Device Handler (CDH) into some of my ST_Anything device handlers. I have it working pretty well, however I do have a question that I thought you might be able to answer.

In your image posted above, the two CDH’s show up in the parent with text as “Relay 1” and “Relay 2”. I understand that this text is set during the creation of the child devices (i.e. “componentLabel:”). Since you also set “isComponent: false”, these child devices show up in the Things List, where a user can change their Display Name.

I have this all working, however I am stuck trying to figure out how to change the “componentLabel” of the child devices to match the displayLabel of the child devices. It would be nice if they matched so inside the parent device view, the text displayed matched the text in the Things view.

I probably made that more complicated that it needed to be. If you have any ideas, please let me know.

Thanks,
Dan

Thanks Eric I have it working finally now :slight_smile:
To anyone like me who flashed it ok but you couldn’t do the next bit I had to unplug from the mains and plug the 3.3v back in and while the led was of I held the power button for 20 seconds like someone mentioned and it flashes 5 times and when I plugged it back into mains and pressed the switch it showed up as I new Wi-Fi access point on my laptop.
Also for anyone else from the UK like me when you’re adding the new device handler you need to make sure you’re in the correct region of the website otherwise it won’t show up to install on the app.
Quick question though I’ve added 2 sonoffs to SmartThings goodnight routine and they work well but I can run it through Alexa as it says some devices are not supported is there a way around that.
Thanks again for the Mood :slight_smile:

Well, I tried the obvious things (which you probably already tried) and they did not work.

it.setComponentLabel(“New Label”)
it.componentLabel = “New Label”

So I am not sure how to do it.

1 Like

Hi. Having some dificulties flashing the sonoff dual. Can you add some pictures and how to. Found diferent explanations on the web how go get it in flashing mode.

1 Like

Perfect!! Thank you!!

Thank you sir! I know just enough to be dangerous. :wink: If I were to get you a sonoff inching/self locking, any chance of incorporating its’ capabilities into your DH and App? I’m ok with wiring and following instructions… coding not so much.:confused:

Thanks for trying and your amazing support of the various ESP8266 devices out in the wild! If I figure it out, I’ll let you know.

Hi Duwayn, can you help with the connections.
how do you enter the sonoff dual into flashing mode?
Eric post says to connect GPIO0 to GND. But which one? the one in the header or directly to the FTDI/USB adapter?
Do you keep it connected during the process or just when powering device?
Sorry but have tried a few thing without luck.
Thanks

I’m sorry, Paulo, I have no experience with any of the Sonoff devices and am just starting to learn about them myself.

You can attach it to the GND on the header or the FTDI adapter. You can also attach it to the GND that is on the header that is perpendicular to the one marked in my photo.

It should only need to be connected to during initial boot to get it into flash mode.

Thank you for your reply Eric and also for your great job in integrating these devices in ST.
Connect GPIO0 to GND on the header of FTDI and after a few seconds disconnect it?
FTDI adapter GDN doesn’t need to be connected after that for flashing?

You can disconnect GND to GPIO0, but not to the GND terminal on the 4 pin header. It still needs to be connected. You are going to have two wires that go to GND during this process. One of them (the one to GPIO0) can be removed after initial boot.

Thank you. Can see where the problem was now.

Still nothing. Adapter at 3,3V. the ed light on the Dual doesn’t do anything with or without the GPIO to GND shunt in or out. the only change is on the small light on the FTDI adapter dimm down a bit when shunt applied.

Hi Eric, I have been using the Sonoff POW for about 6 months now and they have worked perfectly since day one, so thank you for all your work.

I have finally got around to updating the firmware and device handlers for the POW versions tonight and everything seemed to go fine, but I can’t seem to get any power reporting reporting from them.

I have gone into the IDE and changed the device type from TH switch to the POW switch and they still work fine as switches but the power values don’t show.

Any ideas what could be wrong ?

This is all I get.

Hi Eric, was just trying to update Sonoff TH10 for DS18B20 sensor but the bin file (fromTOP) doesn’t have the choice of sensor. Has the old file slipped in there or is the new file with DS18B20 support located elsewhere. It was also suggested that it may be dangerous to use this probe in a swimming pool but I have had a probe that appears the same in my pool for about 20 years. Do you have any insight into the safety aspect.
Thanks again for your great contribution.

Finally managed to flash my sonoff dual. Then another long fight to get it to be discovered by sonoff connect. Finally discovered as a sonoff dual but working as a One relay switch.

What am i doing wrong?