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

15+ minutes and there was nothing generated in the logs for Sonoff Connect.

Kicked off a scan in connect, waited 5+ minutes, nothing generates in the logs. No such category is even generated.

Hmmm, makes me think something on your network is blocking the SSDP. As a workaround you can add the following command to the device handler and then change the ip address with WebCoRE.

command "sync", ["string", "string"]


I added this to line 451 (last) of the device handler:
command “sync”, [“string”, “string”]
Then “saved” and published “for me”.

I then created this in Webcore and ran a test:

Which resulted in this error in my logs:
error groovy.lang.MissingMethodException: No signature of method: script_dth_1ec015f9b33f3be0…933cbf9264215d88b.sync() is applicable for argument types: (java.lang.String) values: [, 80]
Possible solutions: sync(java.lang.Object, java.lang.Object), any(), run(), on(), ping(), run() @line 1741 (executePhysicalCommand)

You need to set two string values for the sync command in webcore.

Worked like a charm and now works all in!

Thank you very much for the workaround, as my odds on getting SSDP working perfectly on a VLAN on a Sophos XG are not too good. :slight_smile:

1 Like

I thought the group following this thread may be interested in my new DH for Tasmota Plugs that support Power Monitoring (Late BETA). Exposes quite a bit of information to the UI as well as via custom attributes.

More info here: BETA Release: Tasmota Device Handler for Plugs with Power Monitoring


Hi I know it’s over a month ago and you’ve probably sorted it now but I’ve just had this exact problem and it was because of the device handler.
I checked mine against the original and even though the dates matched up I noticed mine had about 6 lines of code missing.
So I deleted mine and copied This one and all was fine.

1 Like

Thank you. I still haven’t been able to figure it out. I will definitely try this. Temporarily, I’ve been using a motion sensor which is not ideal. I’ll post my findings. Thank you for responding. I really appreciate it.

1 Like

Flashed a TH16 today. Went well. Went to connect to Smartthings and it recognizes the TH. But when I try to add it I get an error "Error- bad state. unable to complete page configuration. I am able to open IP on on computer. Any ideas on to fix the error? I did download the TH device handler.

Sonoff mini-able to flash, will toggle correctly in Sonoff interface, but cannot get Smart Things APP (Sonoff Connect) to discover.

Any ideas on how I can get this added to my ST devices?

Flashed a TH, discovered as a TH, but when added to ST it comes up as a Sonoff wifi switch instead of sonoff TH. Any ideas??

What smartapp are you using? link? Had a TH connected but no temp showed

I had an issue today adding standard Sonoff basic switches. The smart app gave this error after they had been discovered: “Error- bad state. unable to complete page configuration.”

Using live logging I tracked the issue down to the device IDs already existing - these sonoffs were already in my account on an old, dead, hub that had been sent back to Samsung and replaced. I had to go into the old hub in the IDE and delete all the previous sonoff devices from there first.

The I could add them successfully using the smart app.
Glad this is still working a few years since I last was here! Cheers Eric.

Great video, was going to try flashing a th16… Anything special for that?

Did you every get an answer to this? I am having the same issue and cannot find an answer.

Did you ever get the Auto Off to work? I am having the same problem and have not found a solution.

I could not get Auto Off to work with the app, but by using the IP Address of the devices, I was able to access the configuration menu. Under Advanced, I could set the Auto Off value, Save and Reboot. All through the web interface. This worked great.

I am working with Sonoff Basic (Sonoff RF R2 Power v1.0). Perhaps the Sonoff.ino.generic.bin is not appropriate for this to with SmartThings, but every other aspect of it does work.

Thanks for all the great work making this available.

1 Like

Hi everyone.
I flashed a Sonoff Dual R2, it connected to wifi, the connect app recognized the device but the relays are not working. I tried to reflash it but can’t connect anymore with esptool.
I’ll apreciate any help.

@erocm1231, I’m guessing you haven’t yet modified the f/w for the POW R2, right? I tried your posted POW f/w on the R2 and it doesn’t seem to report power in the web interface, so I wouldn’t expect the DTH to display power stats.

Hi @erocm1231
thank you for your great work, I have 2 Basic working fine.
I’m having trouble with a Dual R2, everything seems ok, I can swith on/off with the app but tha relays do nothng. Could you take a look at the code?
Yhank you!