Jump to content
C4 Forums | Control4

SONOFF - The $5 Smart Switch gets a proper C4 driver (no MQTT, no Cloud)


Recommended Posts

Here a simple, yet fully featured driver for the cheap SONOFF Wi-Fi Smart Switches you can purchase almost anywhere.

The driver work with the "DIY" version of the SONOFF switches and does not require any custom firmware, no MQTT or any Cloud connection. It's all local control and it will work forever.

Quick features:

  • Auto-discovery of SONOFF devices
  • Two-way communication
  • Auto-IP configuration that will survive IP change
  • Light and Relay proxies bulit-in, no need for external driver

This is by far the cheapest Smart Light solution compatible with Control4.

Check it out: https://www.blackwiredesigns.com/store/sonoff-driver-for-basic-mini-wi-fi-smart-switch-diy-mode/

 

 

Link to comment
Share on other sites


Good Job really, these are very stable switches and incredibly cheap, I use them for automating every single load in my house after the main C4 Panelized lighting I must say it’s a really good combination so far ...

Link to comment
Share on other sites

2 minutes ago, Amr said:

Good Job really, these are very stable switches and incredibly cheap, I use them for automating every single load in my house after the main C4 Panelized lighting I must say it’s a really good combination so far ...

Yes I was also very impress how reliable they are... I've ran few of them in my own home for two months while writing the driver, to make sure the product holds up and sure it do. Very stable and responsive. Only drawback is how it provide feedback, although realtime is possible and the driver allow it (at your own risk),  this is contraindicated by C4 staff so the preferred (and default) way to get two-way communication is polling.

Link to comment
Share on other sites

Yep, am still running it thorough my local MQTT and it’s really amazing, I have some  never lost WiFi signal in years! There is another unit like the mini that can be used as well without a switch, you may need to take a look at Canwing CW-001 this will complete your driver for now 😊

F9C39FA8-540D-4998-A887-287FF3BF32F8.jpeg

Link to comment
Share on other sites

3 minutes ago, Amr said:

Yep, am still running it thorough my local MQTT and it’s really amazing, I have some  never lost WiFi signal in years! There is another unit like the mini that can be used as well without a switch, you may need to take a look at Canwing CW-001 this will complete your driver for now 😊

F9C39FA8-540D-4998-A887-287FF3BF32F8.jpeg

In fact there is tons of those cheap Wi-Fi switch available, and they all seems to be built using a similar "engine" that oddly reassemble how brand name's "Smart Outlet" are built. That's means is pretty easy to build a driver for.

I'm currently doing Shelly, which is a bit pricier but offer a broader range of product, I can do any other Wi-Fi mini switch product if it is popular enough and allow control over local network (I do not do Cloud driver because I don't like service calls)

Link to comment
Share on other sites

Another good example and way to go 👍, I’m only sharing my experience with this hardware, yes there are 1180 brand out their! I can’t test all and will work with the most reliable, so far Sonoff Mini, Canwing and Shelly 2.5 constitutes my most implementation, Shelly needs stronger WiFi for sure, Sonoff Mini are very strong and stable due to external antenna design.

Great driver and congrats for stepping in with this driver, a good addition to the community for sure.

Link to comment
Share on other sites

9 minutes ago, jackstone said:

In fact there is tons of those cheap Wi-Fi switch available, and they all seems to be built using a similar "engine" that oddly reassemble how brand name's "Smart Outlet" are built. That's means is pretty easy to build a driver for.

I'm currently doing Shelly, which is a bit pricier but offer a broader range of product, I can do any other Wi-Fi mini switch product if it is popular enough and allow control over local network (I do not do Cloud driver because I don't like service calls)

Yep Most are using ESP866! it either eWelink echo system or Tuya! So that’s why I use Tasmota with all these devices ... Actually I had added Smart Valves, WiFi buttons, LED strips and finally a Curtin to the punch!

Link to comment
Share on other sites

2 hours ago, jackstone said:

Yes I was also very impress how reliable they are... I've ran few of them in my own home for two months while writing the driver, to make sure the product holds up and sure it do. Very stable and responsive. Only drawback is how it provide feedback, although realtime is possible and the driver allow it (at your own risk),  this is contraindicated by C4 staff so the preferred (and default) way to get two-way communication is polling.

Yep

Feedback is a pain with polling as not always instant and puts extra load on the controller, especially when you have lots of lights.

The Shelly kit does support CoAP, as well as MQTT, which does provide the low level protocol needed. Similar to the Lifx LAN Protocol along with all the same complexity to implement in C4, good fun though!

The ideal would be for C4 to implement an MQTT broker on the controller, low CPU and memory footprint that would open things up to a world of IoT devices.

 

Link to comment
Share on other sites

In fact, instant feedback with SONOFF devices does not add any overhead to the CPU, but it require to keep the mDNS socket running all the time and that's not a good practice because it prevent other driver of using mDNS for discovery or other stuff. My driver allow the use of instant feedback with SONOFF and it work well, it's really fast,  but I have enforced manual enable and must be done my someone who know what he's doing.

 

Link to comment
Share on other sites

18 minutes ago, jackstone said:

In fact, instant feedback with SONOFF devices does not add any overhead to the CPU, but it require to keep the mDNS socket running all the time and that's not a good practice because it prevent other driver of using mDNS for discovery or other stuff. My driver allow the use of instant feedback with SONOFF and it work well, it's really fast,  but I have enforced manual enable and must be done my someone who know what he's doing.

 

I'm aware that the mDNS allows the auto discovery but was not aware it gave device state feedback, does that follow for when the device state changes outside of C4? 

Link to comment
Share on other sites

2 minutes ago, david@berto.co.uk said:

I'm aware that the mDNS allows the auto discovery but was not aware it gave device state feedback, does that follow for when the device state changes outside of C4? 

That's unusual but Sonoff used this for it's device feedback, that's why you get instant feedback from the app or the PC configuration utility. This is also the way I've done the instant feedback option in my driver.

Link to comment
Share on other sites

2 minutes ago, zaphod said:

Or this one for the mini version: https://www.amazon.ca/Wireless-Universal-Automation-Compatible-Assistant/dp/B07TRSWY23/ref=sr_1_4?keywords=Sonoff+mini+diy&qid=1587412338&s=hi&sr=1-4

 

To get them at $5 you need to order then from iTead website in europe

Link to comment
Share on other sites

6 minutes ago, jackstone said:

That's unusual but Sonoff used this for it's device feedback, that's why you get instant feedback from the app or the PC configuration utility. This is also the way I've done the instant feedback option in my driver.

Sorry, you mentioned polling above so assumed that's what you're doing.

I'll take a look at the mDNS feedback.

Thanks

Link to comment
Share on other sites

1 minute ago, david@berto.co.uk said:

Sorry, you mentioned polling above so assumed that's what you're doing.

I'll take a look at the mDNS feedback.

Thanks

I also mentioned I've allowed to turn on the realtime feedback through a manual option. So by default the driver will poll, but if someone need realtime feeback he can turn it ON knowing this may cause issue with other drivers.

Link to comment
Share on other sites

@zaphod Yes it actually work on North American 120v, I live in Canada just like you and I've done all my tests on 120v.

Don't forget to get the DIY version of the Sonoff mini!!!

It's the same price, but it's the only model that allow running without cloud or MQTT.

 

Link to comment
Share on other sites

Not to fearmonger, but if I were a dealer, I would *never* install these products (or any other products direct shipped from China with no local US support/testing, for that matter) in a customer's house.

They're not UL listed, the only mark they show is the EU's CE mark (at least it's not the 'China Export' CE mark  https://www.ybw.com/vhf-marine-radio-guide/warning-dont-get-confused-between-the-ce-mark-and-the-china-export-mark-4607)...

The EU's CE mark indicates a declaration of conformity, which means a self-certification, no testing.

Also, the hardware is a bit questionable, and is definitely 'cost-optimized' (cheap)...

For example, on the Sonoff POW/POW2, the case's plastic isn't sonically welded, and isn't even screwed together.  There is the single screw and cover to bind the input/output plugs that also holds the case together.  The plastic is flimsy, and it wouldn't take much abuse or *any* water, and having the power leads not built in assumes that they're installed safely and stay secure / out of kids' hands...

I don't think they're inherently unsafe, but as a dealer, there's likely some liability there for recommending / installing them, with no recourse upstream if there are problems.

As someone who does some DIY / makes his own hardware also based on the ESP8266/ESP32, they're fun devices, and I have a few in use, but I wouldn't recommend them to customers.

RyanE

 

Link to comment
Share on other sites

I think Europe and Asia dealers does not have to comply to UL, so they can still use it without breaking any building code. The R3 device is not as badly built with screws holding the case, and can be installed safety in a metal 4x4 box.

I would not use the POW/POW2 anywhere though... Anyways the driver I've written is only for the two DIY devices and both come in an enclosed form.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.