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

OK so after a bit of reverse engineering it appears that the sonoff mini has the same pin out as the sonoff basic. I have noticed 2 changes

  1. It used as an ESP8285
  2. The External Switch is connected to the Internal Switch and is either is a GND/OPEN discrete.

So I think it will work using the Sonfo.ino. generic.bin

I am in the same boat as you. I donā€™t believe Ericā€™s non tasmota firmware will work with the sonoff mini only because the switch inputs S1 and S2 are on gpio4 and you canā€™t configure this firmware to activate the external switch. Some have had luck with Ericā€™s tasmota fork firmware which does have a configurable gpio4 for the mini switch. Personally I am close but still need some work to do to get it to work correctly. I will post my work next week when I am back home . Take a look at @adamrhoades earlier post on this thread to get the sonoff mini to work with smartthings. Good luck and keep us posted so we can all learn

So I am finally back to testing Ericā€™s tasmota fork 6.6 with my Sonoff Mini. After uninstalling and re-installing S2x tasmota device handler and the Sonoff Connect app I have made no further progress.

firmware https://github.com/erocm123/Sonoff-Tasmota/blob/6.6/sonoff/sonoff.ino.generic.bin
device handler https://github.com/erocm123/SmartThingsPublic/blob/master/devicetypes/erocm123/sonoff-s20-tasmota.src/sonoff-s20-tasmota.groovy
Smartapp https://github.com/erocm123/SmartThingsPublic/blob/master/smartapps/erocm123/sonoff-connect.src/sonoff-connect.groovy

The Sonoff Connect app easily finds the S2x Tasmota device and assigns it the correct IP address and Mac Address. The device in the Classic app shows up with the ON button illuminated even though the switch is off. If I press the Classic toggle button it switches to Turning Off then reverts back to the ON status even though the switch is still off. If I press the button while the status in Turning Off the switch will turn on as well as the light. I have tried the IP Override option in settings with no change in function. Tasmota is configured for Hubitat/Smartthings and Hue emulation and in the configure Hubitat/Smartthings I entered my Smartthings Wifi Hub address and port 39500. Everything seems correct as far as setup but status updates donā€™t appear to be responding correctly. Below is a bit of the live log for the S2X device, it represents pressing the button while ON, Turning OFF and hitting the configue button which has the red dot next to it. I hope these logs help explain my issue. By the way I have 2 of Ericā€™s non-tasmota sonoff basics running flawlessness although the Configure but also has a red dot.

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug Uptime: 0T00:25:18

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug SSId: living joyfully

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug RSSI: 100

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug Channel: 11

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug BSSId: 5E:BA:BA:71:97:30

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug AP: 1

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug SleepMode: Dynamic

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug Sleep: 50

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug LoadAvg: 19

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug POWER: OFF

60f9bead-3a22-4448-af9d-1e63679c46de 3:10:07 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug Uptime: 0T00:20:18

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug SSId: living joyfully

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug RSSI: 100

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug Channel: 11

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug BSSId: 5E:BA:BA:71:97:30

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug AP: 1

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug SleepMode: Dynamic

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug Sleep: 50

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug LoadAvg: 19

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug POWER: OFF

60f9bead-3a22-4448-af9d-1e63679c46de 3:05:07 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug Uptime: 0T00:15:18

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug SSId: living joyfully

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug RSSI: 100

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug Channel: 11

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug BSSId: 5E:BA:BA:71:97:30

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug AP: 1

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug SleepMode: Dynamic

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug Sleep: 50

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug LoadAvg: 19

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug POWER: OFF

60f9bead-3a22-4448-af9d-1e63679c46de 3:00:07 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug Uptime: 0T00:10:18

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug SSId: living joyfully

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug RSSI: 100

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug Channel: 11

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug BSSId: 5E:BA:BA:71:97:30

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug AP: 1

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug SleepMode: Dynamic

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug Sleep: 50

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug LoadAvg: 19

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug POWER: OFF

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug Uptime: 0T00:10:18

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug SSId: living joyfully

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug RSSI: 100

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug Channel: 11

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug BSSId: 5E:BA:BA:71:97:30

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug AP: 1

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug SleepMode: Dynamic

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug Sleep: 50

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug LoadAvg: 19

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug POWER: OFF

60f9bead-3a22-4448-af9d-1e63679c46de 2:55:07 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:29 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:28 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:28 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:27 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:27 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:26 PM: debug SetOption81: ON

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:26 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:26 PM: debug SetOption81: ON

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:26 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug /configGet?name=pos

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug /configGet?name=vreport

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug /configGet?name=autooff1

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug /configGet?name=wreport

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug /configGet?name=areport

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug /configGet?name=ureport

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug /cm?cmnd=HubitatPort%2039500

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:25 PM: debug /cm?cmnd=HubitatHost%20192.168.40.1

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:21 PM: debug POWER: OFF

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:21 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:20 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:20 PM: debug /cm?cmnd=Power%20Off

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:20 PM: debug off()

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:16 PM: debug POWER: ON

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:16 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:15 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:15 PM: debug /cm?cmnd=Power%20On

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:15 PM: debug on()

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:09 PM: debug POWER: OFF

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:09 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:09 PM: debug POWER: OFF

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:09 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:08 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:08 PM: debug /cm?cmnd=Power%20Off

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:08 PM: debug off()

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:08 PM: debug /cm?cmnd=Power%20Off

60f9bead-3a22-4448-af9d-1e63679c46de 2:53:08 PM: debug off()

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:51 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:50 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:50 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:49 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:49 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:49 PM: debug SetOption81: ON

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:49 PM: debug ========== Parsing Report ==========

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug /configGet?name=areport

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug /configGet?name=ureport

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:47 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug /configGet?name=pos

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:47 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug /configGet?name=vreport

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug /configGet?name=autooff1

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:47 PM: debug /cm?cmnd=HubitatHost%20192.168.40.1

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:47 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug /configGet?name=wreport

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:47 PM: debug /cm?cmnd=SetOption81%201

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:48 PM: debug 192.168.40.74:80

60f9bead-3a22-4448-af9d-1e63679c46de 2:52:47 PM: debug /cm?cmnd=LedPower%201

I have searched the thread, and every screen on ST with no luckā€¦

How do I change the IP address of the Sonof Wifi Switch within ST?
I already have the device in there, but it now sits in a different IP range.
I donā€™t want to remove and re-add it because itā€™s tied into other apps.

If I edit the device, there is no place to change the IP.
So, how do I directly change itā€™s IP within Smartthings?

Navigate to the IP address of the device in a web browser. From there you can set a static IP for the device.

Alternatively, you could set an IP reservation from your router if it supports that.

I have the opposite problem.
They are already getting the correct IP, which is now in a different range.
Iā€™m trying to see how to get the existing device in SmartThings to connect to the deviceā€™s new IP (without removing and readding it).

As long as SSDP is working on your network and the device was added with the Sonoff Connect app discovery, the ip address should update automatically. If SSDP isnā€™t working you can try rebooting your router and the Sonoff devices.

Thatā€™s the odd thing.
Iā€™m fairly certain SSDP is on and working (Sophos XG firewall).

ST sees the devices, and gets statuses from it including on/off/uptime.
If I turn the device off manually, ST sees it instantly.
However, ST cannot control the device, and the IP still shows the old.

This is real odd because if the IP hasnā€™t updated, how does ST know the on/off status as it changes?

image

The switch is sending its reports via HTTP. SmartThings is matching it up by the MAC address.

In addition to that, the switch sends out an SSDP message every 5 minutes which the Sonoff Connect SmartApp should catch and process the IP address change.

Is anything showing in the Sonoff Connect logs? Let it run for 10+ minutes.

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"]

image

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:
image

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: [10.5.0.82, 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

2 Likes

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??