I already have 3 locations this would work perfectly, and another 1 or 2 in mind, ordering now!
Edit: Well that’s just crazy, last time I ordered from AliExpress was three years ago to the day, within one hour difference.
I already have 3 locations this would work perfectly, and another 1 or 2 in mind, ordering now!
Edit: Well that’s just crazy, last time I ordered from AliExpress was three years ago to the day, within one hour difference.
Okay I must be missing something…
I figured I would go ahead and attempt to flash the new firmware from this post and use the new Sonoff Connect app.I tried leaving everything in place as far as the existing setup for the other switches I had and just added the new device handler and new app.
So I removed the existing switch from smart things, flashed it and then connected to it. I was able to flash and connect it to my wifi. I can ping the switch via CMD. After installing the Sonoff (Connect) app, it sits at “Discovery Started!” Select Sonoff Switch (0 Found) you cant currently add this, and goes no further.
Is it supposed to say 0 found immediately and then update over time?
Well, doing this killed all my other sonos switches. So I went in, removed all them, removed all the device handlers, all the apps and all the devices and tried again. Still no luck. I attempted the same steps on another switch in network and still no luck,
Any ideas?
Yeah, you are supposed to sit at the discovery page until the switches show up. It usually only takes a couple minutes. Some access points are a little difficult when it comes to SSDP so I would try rebooting your access point first. Also, sometimes SSDP does not work over wireless bridges or other unique network devices. Do you have any other SSDP devices on your network that you use like a Hue Bridge? If you do have a hue bridge connected it isn’t a perfect test though because it is wired.
If all else fails you can skip the connect app and still use the new device handler and firmware. You just have to check the toggle to override the IP in the device handler preferences and setup the IP manually.
I just ran through setting up a switch from start to finish and it was working with overriding the IP. Sometimes the configure function doesn’t run when you edit the preferences and click “done”, so I wonder if that happened. Click configure one or two times to see if you can get it going.
Oh, and I updated the blog post as I forgot to update the device handler link to point to the old one. The old version is labeled 2.0 which is kind of confusing, but I am really hoping that version won’t be used as I won’t really be doing any work on it.
Updated firmware to all 4 (including the one that used your initial firmware) and the connect app found all four but gave an error when I hit next. Went back through, and now it won’t discover. Waiting (way past 5 minutes) again to see if they come back up to get the exact error.
I’m using DD-WRT, any known issues with SSDP there? I disable it on all my PC’s as I hate windows media stuff always listing computers I don’t want. But have not modified my router ACL’s at all.
Edit: And I know retract that entire statement, as I hit save on this post, all four showed up and next/done worked great…sorry!
Ditto. Same thing happened to me. Went to bed mad. Woke up… both lamps work. Two fans updated no issued.
I just tried flashing one of my switches for the first time and all appeared to had went well. I plugged it in the power, however no WiFi network has appeared as yet - its been 10 minutes now. I also notice that the switch, which was previously configured to work on the eWeLink app, has now changed to offline on there - so something has changed… How long does it normally take for the network to appear?
Has anyone encountered this before?
I should also note that when first plugged in, the LED on the switch briefly went on, then stayed off thereafter.
When you press the button does the switch & LED turn on and off?
Pressing the physical button on the switch turns it (and the LED) on and off as expected
Can I just say a huge thanks for putting this together - worked like a charm for me!
One thing though - once the Sonoff is configured how can you change the Wifi its linked to or will it connect directly to the Smartthings hub?
I tried http://IP/config and a few others but no luck
Thanks again
I have always seen the SSID being broadcast after a flash. It should be sonoff.[mac-address].
@LotusMartin On my todo list is to add an easier way to change the wifi. Right now you can go to http://IP/reset and it will clear the saved wifi credentials and allow you to set it up again. Also, plugging it in while it is outside of the range of its currently configured access point will allow you to connect to it and change the wifi settings.
I get this when I attempt that:
File Not Found
URI: /reset
Method: GET
Arguments: 0
And no original SSID shows up.
last night it wouldn’t work after a number of attempts… This morning I took it with me to work. I plugged it in, and the SSID appeared almost immediately.
Strange, but I’m happy its up. Now I need to wait until I get home to continue the setup. Thanks for your comments!
Hmm, maybe I added that today the LED project and not this one. I’ll double check and add it to this one.
I just ordered a few of these. Looking forward to tinkering. I have some wired alarm contacts that i want to try with them. If it will work, itd be a < $6 open close sensor for smartthings. Very cool progress here!
/reset functionality has been added. Get the latest firmware from the repo.
that worked a treat - many thanks.
One other thing I’ve noticed is that if the Sonoff switch is turned on or off on the switch itself that status doesn’t get fed through to Smartthings? So if I then turn it on through smart things it does nothing, but if I then turn it off it does switch it off. Its almost as if the device is not notifying smartthings when the relay is manually switched?
Not a huge problem, but an interesting quirk. I’m just wondering if its possible to hook up a ‘manual’ wall style switch for lighting and then optionally control via the Sonoff - that would be really handy but I’m struggling to come up with a solution.
Funny, mine is the other way round. Physical trigger at the switch updates ST instantly consistently. Triggering in ST works most of the time but not always. I put the Sonoff’s on a completely segregated AP and it’s gotten better though, but I can’t fully rely on them for ST on/off triggering yet.
I sniffed my wifi traffic and see the switches send stuff to the ST hub everytime the button is pressed, but I don’t see the hub even send a thing to the switches when they fail to actuate. The ST hub wants to bogard the packets!
@ericm1231 I finally got the time to segregate my network and test why I’m not getting instant or reliable on/off with these.
I have a factory defaulted Linksys E1500 with an SSID of HA that all the Sonoff’s are connected to.
I then jacked the ST Hub directly into the router, it connects to my normal network as the wan.
SSID is on ch6 which is completely clear of interference on my block.
My phone is connected to the same SSID as well.
Sometimes, all switches turn on/off within a few seconds as they should, sometimes I can trigger one switch on and it sits at TURNINGON forever, sometimes on TURNINGOFF. Sometimes a 5-15 second delay then it actually actuates.
Packet captures (on my Mikrotik, not this setup) show either no packets generated from the ST hub when I tap the app button, or a bidirectional pair of packets if they work as intended. I see a packet generate from the Sonoff’s every single time to the Hub. They delayed scenario shows packets at the time of the switch actuation, not the trigger event, and they seem to be very different.
I was thinking this may be a multicast thing, and it seems I can “trigger” that. If I hit all 4 on very quickly in the app, one or two switches will sometimes trigger on/off more than once, and one or two of the others will do absolutely nothing. I don’t see this in the packet captures which is even weirder.
It really seems the hub isn’t generating the expected packets consistently. I removed and re-added the DTH and Connect app from scratch, no change.
IDE logging only shows this:
72e93b9c-5522-4242-9972-6d3467f75243 9:33:00 PM: debug off()
72e93b9c-5522-4242-9972-6d3467f75243 9:33:47 PM: debug on()
Even weirder, after a trigger appears in the log, the switch doesn’t always show the same status, like the second one listed above, show’s off still, even though the log swears it’s on. I assume this means the response packet from the sonoff isn’t generating, probably because it’s not getting the original from the Hub.
Thanks to the crappy nature of this Linksys I can’t do a packet capture directly, but here’s what a few on and off exchanges with differing results appears as from my Mikrotik. If you want to ignore this, and me, I totally understand, the completeness is more for my own edification than anything at this point! (not sure why this is coloring things funny)
Randomly get this:
Src add 10.54.25.37 (ST Hub) Dest add 224.0.0.251 (multicast, your SSDP packet?)
Src port 5353 Dest port 5353 UDP
0000: 45 00 00 c5 a1 05 40 00 ff 11 d5 cb 0a 36 19 25 E.....@. .....6.%
0010: e0 00 00 fb 14 e9 14 e9 00 b1 ba 5a 00 00 84 00 ........ ...Z....
0020: 00 00 00 04 00 00 00 00 0c 5f 73 6d 61 72 74 74 ........ ._smartt
0030: 68 69 6e 67 73 04 5f 74 63 70 05 6c 6f 63 61 6c hings._t cp.local
0040: 00 00 0c 00 01 00 00 11 94 00 13 10 44 30 35 32 ........ ....D052
0050: 41 38 37 32 38 32 36 37 30 30 30 31 c0 0c c0 2f A8728267 0001.../
0060: 00 10 80 01 00 00 11 94 00 26 06 70 61 74 68 3d ........ .&.path=
0070: 2f 13 69 64 3d 44 30 35 32 41 38 37 32 38 32 36 /.id=D05 2A872826
0080: 37 30 30 30 31 0a 74 79 70 65 3d 68 75 62 76 32 70001.ty pe=hubv2
0090: c0 2f 00 21 80 01 00 00 00 78 00 19 00 00 00 00 ./.!.... .x......
00a0: 1f 91 10 44 30 35 32 41 38 37 32 38 32 36 37 30 ...D052A 87282670
00b0: 30 30 31 c0 1e c0 86 00 01 80 01 00 00 00 78 00 001..... ......x.
00c0: 04 0a 36 19 25 ..6.%
All 4 of my Sonoffs are statically assigned via DHCP so discovery is unnecessary, unless the Connect app requires it? IP's are correct in the app for all.
---------------
On from ST without success (no packet) or LONG delay:
Either no packet from Hub or occasional Get requests get sent:
0000: 5c cf 7f 81 c1 ac d0 52 a8 72 80 33 08 00 45 00 \......R .r.3..E.
0010: 00 b8 6d ae 40 00 40 06 85 a7 0a 36 19 25 0a 36 ..m.@.@. ...6.%.6
0020: 19 5a c4 3d 00 50 61 77 0c d0 00 c5 a9 b1 50 18 .Z.=.Paw ......P.
0030: 39 08 89 fc 00 00 47 45 54 20 2f 6f 6e 20 48 54 9.....GE T /on HT
0040: 54 50 2f 31 2e 31 0d 0a 41 63 63 65 70 74 3a 20 TP/1.1.. Accept:
0050: 2a 2f 2a 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a */*..Use r-Agent:
0060: 20 4c 69 6e 75 78 20 55 50 6e 50 2f 31 2e 30 20 Linux U PnP/1.0
0070: 53 6d 61 72 74 54 68 69 6e 67 73 0d 0a 48 6f 73 SmartThi ngs..Hos
0080: 74 3a 20 31 30 2e 35 34 2e 32 35 2e 39 30 3a 38 t: 10.54 .25.90:8
0090: 30 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 0..Conte nt-Type:
00a0: 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 applica tion/x-w
00b0: 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 ww-form- urlencod
00c0: 65 64 0d 0a 0d 0a ed....
To which Sonoff responds, always instantly:
0000: d0 52 a8 72 80 33 5c cf 7f 81 c1 ac 08 00 45 00 .R.r.3\. ......E.
0010: 00 a2 a5 43 00 00 ff 06 cf 27 0a 36 19 5a 0a 36 ...C.... .'.6.Z.6
0020: 19 25 00 50 c4 3d 00 c5 a9 b1 61 77 0d 60 50 18 .%.P.=.. ..aw.`P.
0030: 16 40 6b 67 00 00 48 54 54 50 2f 31 2e 31 20 32 .@kg..HT TP/1.1 2
0040: 30 30 20 4f 4b 0d 0a 43 6f 6e 74 65 6e 74 2d 54 00 OK..C ontent-T
0050: 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e ype: app lication
0060: 2f 6a 73 6f 6e 0d 0a 43 6f 6e 74 65 6e 74 2d 4c /json..C ontent-L
0070: 65 6e 67 74 68 3a 20 34 34 0d 0a 43 6f 6e 6e 65 ength: 4 4..Conne
0080: 63 74 69 6f 6e 3a 20 63 6c 6f 73 65 0d 0a 41 63 ction: c lose..Ac
0090: 63 65 73 73 2d 43 6f 6e 74 72 6f 6c 2d 41 6c 6c cess-Con trol-All
00a0: 6f 77 2d 4f 72 69 67 69 6e 3a 20 2a 0d 0a 0d 0a ow-Origi n: *....
---------------
Off from ST without success or LONG delay:
0000: 5c cf 7f 81 c1 ac d0 52 a8 72 80 33 08 00 45 00 \......R .r.3..E.
0010: 00 b9 ed 4f 40 00 40 06 06 05 0a 36 19 25 0a 36 ...O@.@. ...6.%.6
0020: 19 5a c4 42 00 50 7f 89 8f 05 00 c6 20 86 50 18 .Z.B.P.. .... .P.
0030: 39 08 dd 10 00 00 47 45 54 20 2f 6f 66 66 20 48 9.....GE T /off H
0040: 54 54 50 2f 31 2e 31 0d 0a 41 63 63 65 70 74 3a TTP/1.1. .Accept:
0050: 20 2a 2f 2a 0d 0a 55 73 65 72 2d 41 67 65 6e 74 */*..Us er-Agent
0060: 3a 20 4c 69 6e 75 78 20 55 50 6e 50 2f 31 2e 30 : Linux UPnP/1.0
0070: 20 53 6d 61 72 74 54 68 69 6e 67 73 0d 0a 48 6f SmartTh ings..Ho
0080: 73 74 3a 20 31 30 2e 35 34 2e 32 35 2e 39 30 3a st: 10.5 4.25.90:
0090: 38 30 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 80..Cont ent-Type
00a0: 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d : applic ation/x-
00b0: 77 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f www-form -urlenco
00c0: 64 65 64 0d 0a 0d 0a ded....
To which Sonoff responds, always instantly:
0000: d0 52 a8 72 80 33 5c cf 7f 81 c1 ac 08 00 45 00 .R.r.3\. ......E.
0010: 00 a2 a5 47 00 00 ff 06 cf 23 0a 36 19 5a 0a 36 ...G.... .#.6.Z.6
0020: 19 25 00 50 c4 42 00 c6 20 86 7f 89 8f 96 50 18 .%.P.B.. .....P.
0030: 16 3f 53 45 00 00 48 54 54 50 2f 31 2e 31 20 32 .?SE..HT TP/1.1 2
0040: 30 30 20 4f 4b 0d 0a 43 6f 6e 74 65 6e 74 2d 54 00 OK..C ontent-T
0050: 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e ype: app lication
0060: 2f 6a 73 6f 6e 0d 0a 43 6f 6e 74 65 6e 74 2d 4c /json..C ontent-L
0070: 65 6e 67 74 68 3a 20 34 35 0d 0a 43 6f 6e 6e 65 ength: 4 5..Conne
0080: 63 74 69 6f 6e 3a 20 63 6c 6f 73 65 0d 0a 41 63 ction: c lose..Ac
0090: 63 65 73 73 2d 43 6f 6e 74 72 6f 6c 2d 41 6c 6c cess-Con trol-All
00a0: 6f 77 2d 4f 72 69 67 69 6e 3a 20 2a 0d 0a 0d 0a ow-Origi n: *....
---------------
On from ST with success:
ST->Sonoff
Src add 10.54.25.37 (ST Hub) Dest add 10.54.25.90 (Sonoff)
Dest port 80 TCP
0000: 5c cf 7f 81 c1 ac d0 52 a8 72 80 33 08 00 45 00 \......R .r.3..E.
0010: 00 3c 05 7e 40 00 40 06 ee 53 0a 36 19 25 0a 36 .<.~@.@. .S.6.%.6
0020: 19 5a bd 8e 00 50 fc 47 9d 33 00 00 00 00 a0 02 .Z...P.G .3......
0030: 39 08 ca 68 00 00 02 04 05 b4 04 02 08 0a 0d fe 9..h.... ........
0040: 98 4d 00 00 00 00 01 03 03 06 .M...... ..
Sonoff->ST
Src add 10.54.25.90 (Sonoff) Dest add 10.54.25.37 (ST Hub)
Src port 80 TCP
0000: d0 52 a8 72 80 33 5c cf 7f 81 c1 ac 08 00 45 00 .R.r.3\. ......E.
0010: 00 2c a2 53 00 00 ff 06 d2 8d 0a 36 19 5a 0a 36 .,.S.... ...6.Z.6
0020: 19 25 00 50 bd 8e 00 9a f5 c0 fc 47 9d 34 60 12 .%.P.... ...G.4`.
0030: 16 d0 ec a5 00 00 02 04 05 b4 ........ ..
---------------
Off from ST with success:
ST->Sonoff
Src add 10.54.25.37 (ST Hub) Dest add 10.54.25.90 (Sonoff)
Dest port 80 TCP
0000: 5c cf 7f 81 c1 ac d0 52 a8 72 80 33 08 00 45 00 \......R .r.3..E.
0010: 00 3c aa a9 40 00 40 06 49 28 0a 36 19 25 0a 36 .<..@.@. I(.6.%.6
0020: 19 5a be ef 00 50 c9 b1 5b 90 00 00 00 00 a0 02 .Z...P.. [.......
0030: 39 08 e4 54 00 00 02 04 05 b4 04 02 08 0a 0d fe 9..T.... ........
0040: f1 39 00 00 00 00 01 03 03 06 .9...... ..
Sonoff->ST
Src add 10.54.25.90 (Sonoff) Dest add 10.54.25.37 (ST Hub)
Src port 80 TCP
0000: d0 52 a8 72 80 33 5c cf 7f 81 c1 ac 08 00 45 00 .R.r.3\. ......E.
0010: 00 2c a2 e3 00 00 ff 06 d1 fd 0a 36 19 5a 0a 36 .,...... ...6.Z.6
0020: 19 25 00 50 be ef 00 9d 8a 3c c9 b1 5b 91 60 12 .%.P.... .<..[.`.
0030: 16 d0 ca ff 00 00 02 04 05 b4 ........ ..
---------------
On from Sonoff success and app update:
Sonoff->ST
Src add 10.54.25.90 (Sonoff) Dest add 10.54.25.37 (ST Hub)
Dest port 39500 tcp
0000: d0 52 a8 72 80 33 5c cf 7f 81 c1 ac 08 00 45 00 .R.r.3\. ......E.
0010: 00 d3 a2 0a 00 00 ff 06 d2 2f 0a 36 19 5a 0a 36 ........ ./.6.Z.6
0020: 19 25 19 9f 9a 4c 00 98 67 37 55 e2 e0 f8 50 18 .%...L.. g7U...P.
0030: 16 d0 99 e1 00 00 50 4f 53 54 20 2f 20 48 54 54 ......PO ST / HTT
0040: 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 31 30 2e P/1.1..H ost: 10.
0050: 35 34 2e 32 35 2e 33 37 3a 33 39 35 30 30 0d 0a 54.25.37 :39500..
0060: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 Content- Type: ap
0070: 70 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e 3b 63 plicatio n/json;c
0080: 68 61 72 73 65 74 3d 75 74 66 2d 38 0d 0a 53 65 harset=u tf-8..Se
0090: 72 76 65 72 3a 20 53 6f 6e 6f 66 66 0d 0a 43 6f rver: So noff..Co
00a0: 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 65 0d nnection : close.
00b0: 0a 0d 0a 7b 22 70 6f 77 65 72 22 3a 22 6f 6e 22 ...{"pow er":"on"
00c0: 2c 20 22 75 70 74 69 6d 65 22 3a 22 31 20 64 61 , "uptim e":"1 da
00d0: 79 73 20 61 6e 64 20 35 3a 31 3a 35 37 22 7d 0d ys and 5 :1:57"}.
00e0: 0a .
ST->Sonoff
Src add 10.54.25.37 (ST Hub) Dest add 10.54.25.90 (Sonoff)
Src port 39500 tcp
0000: 5c cf 7f 81 c1 ac d0 52 a8 72 80 33 08 00 45 00 \......R .r.3..E.
0010: 00 28 f5 3c 40 00 40 06 fe a8 0a 36 19 25 0a 36 .(.<@.@. ...6.%.6
0020: 19 5a 9a 4c 19 9f 55 e2 e0 f8 00 98 67 e3 50 11 .Z.L..U. ....g.P.
0030: 3c b8 d8 ee 00 00 00 00 00 00 00 00 <....... ....
---------------
Off from Sonoff success and app update:
Sonoff->ST
Src add 10.54.25.90 (Sonoff) Dest add 10.54.25.37 (ST Hub)
Dest port 39500 tcp
0000: d0 52 a8 72 80 33 5c cf 7f 81 c1 ac 08 00 45 00 .R.r.3\. ......E.
0010: 00 d5 a1 e1 00 00 ff 06 d2 56 0a 36 19 5a 0a 36 ........ .V.6.Z.6
0020: 19 25 07 88 9a 4c 00 96 bd f9 c9 63 7e bb 50 18 .%...L.. ...c~.P.
0030: 16 d0 0d 96 00 00 50 4f 53 54 20 2f 20 48 54 54 ......PO ST / HTT
0040: 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 31 30 2e P/1.1..H ost: 10.
0050: 35 34 2e 32 35 2e 33 37 3a 33 39 35 30 30 0d 0a 54.25.37 :39500..
0060: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 Content- Type: ap
0070: 70 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e 3b 63 plicatio n/json;c
0080: 68 61 72 73 65 74 3d 75 74 66 2d 38 0d 0a 53 65 harset=u tf-8..Se
0090: 72 76 65 72 3a 20 53 6f 6e 6f 66 66 0d 0a 43 6f rver: So noff..Co
00a0: 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 65 0d nnection : close.
00b0: 0a 0d 0a 7b 22 70 6f 77 65 72 22 3a 22 6f 66 66 ...{"pow er":"off
00c0: 22 2c 20 22 75 70 74 69 6d 65 22 3a 22 31 20 64 ", "upti me":"1 d
00d0: 61 79 73 20 61 6e 64 20 34 3a 35 39 3a 31 33 22 ays and 4:59:13"
00e0: 7d 0d 0a }..
ST->Sonoff
Src add 10.54.25.37 (ST Hub) Dest add 10.54.25.90 (Sonoff)
Src port 39500 tcp
0000: 5c cf 7f 81 c1 ac d0 52 a8 72 80 33 08 00 45 00 \......R .r.3..E.
0010: 00 28 ab c5 40 00 40 06 48 20 0a 36 19 25 0a 36 .(..@.@. H .6.%.6
0020: 19 5a 9a 4c 07 88 c9 63 7e bb 00 96 be a7 50 11 .Z.L...c ~.....P.
0030: 3c b8 82 ff 00 00 00 00 00 00 00 00 <....... ....