Author Topic: Itead / SOnOff smart devices.  (Read 679 times)

0 Members and 1 Guest are viewing this topic.

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4082
  • Country: gb
Itead / SOnOff smart devices.
« on: July 29, 2019, 08:01:09 am »
So I bought two of their basic SOnOff switches.  The PCB layout has changed compared to the YouTube video reviews, teardowns and destruction tests, so they appear to be listening and evolving.   The PCB now, no longer uses solder enforced tracks for carrying the main load, but instead uses, what looks like 2.5mm solid core wire, so the main load only travels one short track to the relay.

However this PCB redesign also came with a new MCU.  Instead of an ESP8266 it now has an ESP8285 which while an upgrade does not appear to function out of the box.  Mine would not pair with their trashy malware app even in compatibility mode.  The furthest it got was detecting a Version 1 device on Wifi, connected to it and then said it couldn't connect and asked me to connect it manually.... but it already was connected.

It turns out in Pairing mode it sets up it's own AP and the app tries to connect to it via HTTP to configure it for your Wifi.  That HTTP service was not functional and hitting the correct IP/path produced a timeout.

Not a big deal as I intended to flash it with ESPEasy anyway.  However that didn't go well either as the ESPEasy setup docs and utils are designed for the ESP8266 and so did not work on my device.

After rolling of eyes I just googled what the device pins were for relay, led etc. and wrote my own firmware.
http://10.0.0.4/on - turns it on
http://10.0.0.4/off - turns it off
http://10.0.0.4/status - tells you it's current on/off status

Can't be simpler really.  I don't understand why these IoT people insist on making things complicated and requiring Internet access to turn a ****ing switch on and off!

Anyway.  Other than there being some debate about it's ability to handle 10A current, although that has been demonstrated on YouTube that it can, some components, such as the terminal blocks do look a bit weedy for 10A mains.  I think these are awesome little devices.  It's basically just a 3.3V switch mode power supply, 240V 10A relay and a functioning, programmable/hackable ESP microcontroller in a neat, tidy package.

With the ability to flash your own firmware things get interesting.  On my road map is the following:

1.  Re-enable the press button for manual override.
2.  Add a timeout - as this will be used to control my heating, I want an "ON" command to timeout after 1 hour if not refreshed, so if the home hub crashes the heating will not get stuck on.
3.  Sticking with heating control a minimum OFF time of 1 minute to prevent short cycling the device with a software bug.
4.  Manual override for running the heating for 1 hour if I hold the button for 5 seconds... and similar variations.

For lights if/when I get round to using their pendant versions, I will flash them to default to on.  So with the switch on the wall OFF the device is not powered, so the light and device is off.  Turn the switch on and the light comes on.  It only becomes smart when you leave the switch on, but use the Wifi to control the light state.

So if you can flash a micro-controller and are looking for neat devices to control things around your home at the price they are selling these things they are a great little idea.
« Last Edit: July 29, 2019, 08:04:42 am by paulca »
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline xani

  • Frequent Contributor
  • **
  • Posts: 400
Re: Itead / SOnOff smart devices.
« Reply #1 on: July 29, 2019, 11:22:18 pm »
You're kinda late to the sonoff party, this seems to be most popular OS firmware for it, including fancy stuff like OTA update.

The usual setup is using them as "remote switches" that just report/take commands via MQTT and leave all the logic for the central controller. That's mostly because you can just "flash and forget" and just have one place to change any logic

 

Offline Illusionist

  • Regular Contributor
  • *
  • Posts: 109
  • Country: gb
  • Why is the rum gone?
Re: Itead / SOnOff smart devices.
« Reply #2 on: July 30, 2019, 01:18:20 am »
  I don't understand why these IoT people insist on making things complicated and requiring Internet access to turn a ****ing switch on and off!

Data fishing, plain and simple.

And yes, those controllers are great. I have a mix of ESP8266 and ESP8285 plugs and controllers around the place with Tasmota on them. The hardest thing about flashing them is getting into some of the welded plastic plug/sockets (hot air gun helps). With Tasmota they can still be linked to my wife's Alexa thing too, for easy voice control, no internet required.
Agilent 34410A, GW Instek 8251A, Thurlby 1905A, Siglent DS1104X-E(unlocked), SDG1032X(unlocked), Micsig DP10013 MX, LeCroy PP008 500MHz Probes, Fluke 179
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4082
  • Country: gb
Re: Itead / SOnOff smart devices.
« Reply #3 on: July 30, 2019, 10:50:29 am »
You're kinda late to the sonoff party, this seems to be most popular OS firmware for it, including fancy stuff like OTA update.

The usual setup is using them as "remote switches" that just report/take commands via MQTT and leave all the logic for the central controller. That's mostly because you can just "flash and forget" and just have one place to change any logic

To be honest, I avoid these frameworks.  They are designed for when you can't/don't want to flash the firmware.  The level of complexity in them is immense when compared to a basic, hardcoded sketch.  All those config GUIs, web UIs, configuration and pairing functionality is 100% useless if you can flash the device yourself.

Also, none of them presently work with the R2 SOnOffs or rather based on their documentation they don't work.  I'm sure if you downloaded the source and manually flashed it, it would be fine.  The MCU has changed in the devices so none of their "Flash utilities" work anymore.

The only downside in my approach is that if I change my Wifi SSID/PSK or my network address range I might have to reflash a handful of devices, however those kind of changes will almost certainly break your Tasmota install too.

Also, keeping the logic in a central controller allows for inappropriate commands being sent to devices.  An example might be short cycling or forgetting to turn things off when your central logic controller crashes and running your heating (or other device) 24/7.

I intend to use a standard engineering approach of layering.  The things closes to the devices under control, eg, the smart switches will have fail-safe and protection logic built in to validate the control they receive.  The command will come from a command controller which makes decisions based on demands.  Those demands come from schedules.  The schedules decide on demands based on conditions and data.  This allows for protection against competing and conflicting demands/schedules and device controls.  It also allows for demands to be served by different devices based on conditions.

Or you could just use some commercial Trojan spyware like EvoHome or Alexa.  Personally I'm writing the software myself.

EDIT:  An OTA system IS however on the list for my LED lamp controller as it will be repeatedly flashed as it develops as the logic there is much more involved and will change a lot over time.  It is also hard to move it off board onto a network without writing a complex API for it.
« Last Edit: July 30, 2019, 11:42:13 am by paulca »
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf