Christmas with Sonoff and Alexa

So, as I mention briefly earlier, I’m now the proud recipient of a number of Itead products including Sonoff Basic which I’ve discussed and used in the past, always with 3rd party software, Sonoff POWR2 (I’ve now used this version before) Sonoff S26G – the UK version of Itead’s smart socket. What;s special about their stuff?

Well, price for one thing, Itead products are available from Amazon and many other outlets but if price is an issue (most IOT hardware is to me grossly overpriced, particularly in the UK where it can cost £20 or more for a simple smart light or socket – dream on, people).

For those Brits who like to get their stuff quickly from Amazon.co.uk, you may find the following link useful: https://www.amazon.co.uk/Sonoff-Wireless-Modified-Low-Cost-Solution/dp/B06WWNBD3Y

The normal Amazon price is apparently £9.90, coupon offer is 15% off, i.e. £8.42 after discount. The offer is open from 2018.12.26 to 2019.01.31 – coupon code: F2CYBNAV – this applies to Sonoff Basic. 

Meanwhile….

Sonoff products

I’m particularly interested in the SP26G. The POWR2 and Sonoff Basic products claim compatibility with IFFT and Google assistant (Nest etc.) with POWR2 also referring to IFFT (If This, Then That). They do of course work with the EweLink App for Android (and I guess Apple, I don’t have any Apple products so can’t verify that, I’m sure others can.

For more technical info than you could ask for (in English), visit https://www.itead.cc/

I would normally suggest diving straight into Tasmota custom firmware to use these products but last night I thought I’d try putting the EweLink software on my phone (it turns out I set up an account ages ago and never used it). I plugged the S26G into the wall outlet and as it is a new device, pressed the front panel button for 7 seconds at the end of which I ended up with a new device on my system. I gave it a name “my bed light”and then via the Amazon Alexa website (where I am also registered) added this new device, this is all SO much easier than it used to be.

I kid you not, that was it. I could now press the button on the App to turn the light on and off, or better, just say “echo, turn on my bed light” and my Amazon Alexa device (which I call “echo” (they should add many more names) took over control of the light.

Not only that but (back to the EweLink app) setting up timers and scheduling is easy. All I need now is for someone to tell me how to talk to the device with MQTT (my Node-Red setup) without re-flashing the firmware.

EweLink software

Above you see the view in the EweLink App and below, the Amazon Alexa Devices page.

Alexa App and Sonoff

My biggest fear, that the two ways of controlling the light might not track each other, was, as it happens, unfounded.

That’s the easy one done, next, the ones you have to put a wire and plug on…. First off I set up the Sonoff Basic – again that  took no time… I simply plugged it into power THEN pressed the button for 7 seconds, then released. In the Ewelink App, adding another device is easy. Similarly adding that new device into the Amazon App is easy. So now I had two devices, one I called “my bed lamp” – the other, “my basic one”.

I was out of spare plugs. Something had to go. I disconnected one of my gadgets and connected the Sonoff Powr2. Same as before – within minutes it was up and talking to Alexa. Now the challenge. Could I get an OLD Sonoff board to work. Well, I have one or two but they have been customised and apparently reverting back isn’t that easy. I found an original Sonoff WIFI (v1.6) and it worked after a couple of attempts. I went into settings and attempted to upgrade the firmware (OTA, no effort). Worked first time and now my old Sonoff is as good as new and again, working with Alexa. This just keeps getting better.

Original Sonoff updated

So what’s special about any of this? Now we have a choice of custom firmware or a good package from Itead with Alexa and Google compatibility… and these boards are inexpensive –if you get them from Banggood or AliExpress, REALLY cheap.

More on this later.

Facebooktwitterpinterestlinkedin

41 thoughts on “Christmas with Sonoff and Alexa

  1. I was a big fan of the Itead stuff but within the last 6 months a Sonoff basic and a TH (16 amp) have both failed due to a stuck relay. I’m thinking of replacing them with a Wemos mini + SSR, which is not so elegant.

  2. no mqtt support in ewelink app for sonoffs (while Shelly has native support, but as soon as you enable mqtt, you loose the cloud functionality… the good is that you don’t need to reflash)…

    open that sonoff basic and take a look if it’s the new one: https://tech.scargill.net/more-from-sonoff/#comment-46576

    and for alexa, no problems in having it working in tasmotized sonoffs: as you can see my white echo dot and my desk lamp work with just setting “configuration – extra – Belkin WeMo” in tasmota… it’s then detected by alexa in my network and even autodetected by home assistant, no other config needed, and works without chinese clouds 😉

    1. Is Tasmota Wemo emulation still working for you? I got an Sonos One with Alexa for Christmas and can’t get it to detect a single Wemo or Hue emulated sonoff basic running Tasmota. Also, Yonomi can detect Hue emulated devices but not Wemo.

        1. Yeah it’s me! It seems like there might be an issue with FauxMoESP Hue emulation and Gen 3 devices – I imagine Tasmota uses that library too. I’m not sure whether the Sonos One is Gen 3 or not so was interested to hear from anyone it’s currently working for.

  3. I’m also waiting for a solution to get mqtt messages from stock firmware of ewelink. Hope there is a solution in the future without flashing

    1. I looked at the Shelly website – closed for Xmas, out of stock – and 16 Euros for the simple mains socket. They HAVE to be kidding – that price is WAY too high. Or did I miss something – 4 pack for 68 Euros…

  4. It’s beyond my technical capabilities, but it should be possible for someone to write a Node-Red to Sonoff websockets bridge, similar to the Blynk websockets contrib.
    It seems to me that most of the details needed are in the API linked on this page:
    https://wiki.almeroth.com/doku.php?id=projects:sonoff
    This would make it very simple to have pseudo MQTT integration via Node-Red when using the stock firmware.

    There’s also some interesting info on that page about the way that the Sonoff devices check for new HTTP OTA updates when they boot.

    Of course the disadvantage of running the stock firmware and ewelink app is that you’re devices are under total the control of China.

    Pete.

  5. Hmmm, getting a way to interface MQTT with the Sonoff devices would be REALLY interesting!
    My set up is getting messy with MQTT & web interfaces and Blynk (to get over a network /ISP issue) and Ewelink.

    Ewelink is good, but it would be nice to be able to send it a signal from a RPi or Arduino …..

        1. seen that, don’t like the solution too much… you rely on a 3rd party site to enable YOUR nodered to talk with YOUR alexa… i don’t trust the site nor its future availability…

          better solution, if using Tasmota: enable Belkin Wemo emulation in configuration – extra, then run an Alexa discovery of new devices, then use them, no external services needed (except for Alexa herself, of course)…

          1. Just to add that I have been using that service for well over a year and have had no issues that affected me other than when Alexa is also unavailable. The big advantage over Wemo emulation is that you can query settings such as current temperature and thermostat setting and then change them with acceptable ranges defined – helps when the kids refuse to believe that setting the thermostat to 30 won’t get it to 22 any quicker.

  6. While I was looking to connect Google Home to my Mqtt/node-red setup I found that beebotte provides a free Mqtt server that can be connected to IFTTT through webhooks…
    Checke here for details: https://maker.itnerd.space/from-google-assistant-to-mqtt/

    I didn’t tested this way but maybe:
    In your node red setup, you can write to beebotte topics, then connect beebotte to itead devices using IFTTT.

    I did the other way: using IFTTT to write to a beebotte mqtt topic, my node red setup suscribes to the topic and then trigger some devices and it’s ok.

  7. Hi Peter, first, excuse my english, I’m a french Canadian. I use a Sonoff th-16 (it could be a Sonoff basic) to remote my garage door. I use an Arduino uno that change state of Sonoff for to tell to Ewelink app if my garage door is open ( ON ) or close (OFF). If my garage door open or close by the original remote, Arduino tell to Sonoff to change state in the Ewelink app. The Sonoff is powered from Arduino module with the 5 volts to C7 on Sonoff.
    Now I use Google assistant to command my door. It’s very useful.

  8. I take your point about the cost of this IOT technology. If you think it’s expensive in the UK, you should see Australian prices! They’d make your eyes water! (We call it the ‘Australia tax’). It’s been made worse by our government pandering to a clutch of right-wing retailers who were concerned that they were losing sales, and so we now get slugged 10% GST (=VAT) on ALL purchases – no lower limit at all. In reality, it makes little difference – if you can wait for the inevitable month it takes for Australia Post to deliver the parcel, costs directly from China can be 10% of the “retail” cost in an Australian store. And don’t start me on postage – often $15.00 to $20.00 (halve it for pounds) inside Oz, yet free from China / HK etc.

    Rant over, I have noticed that Tasmota allows a Wemos emulation, but I’ve been loathed to try that. I use Home Assistant running on a Pi with Mosquitto MQTT, but have wondered if the Wemos – Alexa mod would work. It’s good to see that it does.

    1. it’s been suggested on tasmota/espurna issues that you can even use the alternative HUE emulation, in case of a dual relay device… still didn’t try it as some of these emulations don’t work with newer alexa device like the echo 3 or dot 2, but i think it’s now fixed or fix is on the way, didn’t check their issue pages in last days…

      i asked about that because WEMO emulation is for a single device (no dual official WEMO device exists with more, so no support…), but i was hacking a sonoff dual to do a blinds up/down switch (*)… the strage thing will be to say “alexa turn on UP, or DOWN), but these can be fixed setting an Alexa routine to say a more natural phrase…

      (*) in this case you NEED to be sure that the 2 relay will NEVER be on at the same time, or you can burn your motor… i used standard tasmota setting interlock between the relay (**), but many people suggested to use a forked tasmota firmware made by Stefan Bode which is specifically made for this scenario, and has native interlock plus more ad hoc features, but you need to compile it yourself, no precompiled BIN file available: https://github.com/stefanbode/Sonoff-Tasmota

      (**) i’ve found that doing this settings is WAY easier if you use TasmoAdmin web interface, with which you can set these things graphically, without having to go to put commands in tasmota web console or serial cli: https://github.com/reloxx13/TasmoAdmin

    2. The short-sightedness of people in politics right now across the western world beggars belief. Adding tax just makes people LESS likely to purchase. In or around recessions the only thing that matters to people is value for money. Personally I will generally wait the time it takes to get stuff from China etc. Retail shopping in the UK is now almost exclusively for women so I could give two hoots. All the good gadget and tech stores have closed. So, I buy online. The idea of retail was to add value to purchases.. if I’m going to get no knowledge out of store staff I’m no worse off buying online and it is cheaper. Having said that we’ve a small number of stores still of interest to me.. “The Range”, “Poundstretcher”, “B&M”.

      I’ve used Tasmota on Sonoff, mainly as I my own code is too big for the very restrictive FLASH space on Sonoffs.

      1. Peter, why don’t you take a look on how tasmota and espurna manage wemo/hue emulation and add it to your great ESP-GO? It’s a matter of advertising the service via udp on the network, and give an http response if something wants to manage that broadcast

        this is the lib used by espurna, seems well done and surely works: https://bitbucket.org/xoseperez/fauxmoesp

        the espurna sample code:
        https://github.com/xoseperez/espurna/blob/dev/code/espurna/alexa.ino

        and the tasmota one, in this case all in this single file for both wemo and hue:
        https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/xplg_wemohue.ino

  9. Peter, I’m using your node-red big timer to look up weather underground to see when dusk occurs and send that through a web hook to IFTTT and then to EWeLink which switches a sonoff basic connected light on at dusk throughout the year, with time adjustment in big timer, a bit long winded but does the job!
    Regards Ian

    1. Ian, are you aware that the current WU API is being permanently closed down at the end of December 2018? I don’t know what the next freely available option will be from WU. There is also the alternative ‘Dark Sky’ API.

  10. Hi,

    Thanks for the interesting blog! I bought my first Sonoffs (Basic, 2x Dual, 4ch) after the summer and finally got around to flash them. Turns out the Basic was Dead on Arrival, and for some reason I couldn’t get the 4ch to work with Espurna, but luckily Tasmota works great. These have all been bought from Amazon.de.

    So, regarding the one’s at Aliexpress. I buy a lot of stuff from there, but never anything with DC connection (for now at least), because of the risk of a faulty product / lousy quality. I do of course understand that often the products are exactly the same as the ones in the EU market – but not always.

    What are your views on the quality of the Sonoff products you’ve purchased straight from China? Are they 100% the same?

    Thanks!

  11. i asked TasmoAdmin author to add a new config tab to his web gui to allow an easy setup of the tons of “SetOptionXX” settings allowed by Tasmota firmware… so, for example, setting the inching time, or the interlock mode (“SetOption14 1”) for relays, useful for curtain/blinds setups… this way you can easily set them via “talking” menu option instead of reading the docs… if anybody is interested, commenting there will push the author to add this useful feature 🙂 thanks

    https://github.com/reloxx13/TasmoAdmin/issues/265#issuecomment-451479546

  12. Hello, need a bit of help if you are so kind.

    I use a switching power supply powered at 220V to open my gate that has a 12V electro-mechanical lock using a button wired to the power supply. I attached a schematic of the installation.

    The 2 wires from the power supply to the button are powered with 12V.

    Apart from the button, i would like to use a Sonoff wifi switch to open my gate from my smartphone.

    Will the Sonoff SV help me with that? And if so, how should i wire it?

    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.