I’ve just found out by mistake this awesome Home Assistant framework and to my surprise I couldn’t find a component that would support Sonoff Basic switches (I don’t have others right now) out of the box.
with awesome support from @forums2012 the list has been extended to support also Sonoff 4CH Pro (R2)
has been reported to work with WHDTS WiFi Momentary Inching Relay also (needs a custom HA button to simulate the momentary action … i think)
the list of devices keeps extending (thanks everyone for providing the information) and please be sure to check this list before submitting any questions and if it’s a new device to follow these new-device guidelines
List of major features
supports shared devices
most of switch devices are supported (if your device it’s not on the compatibility list give it a try, might actually work)
sensor entities are generated for devices that return values for power/current/voltage/temperature/humidity
There are so many advantages with flashing custom firmware, such as Tasmota, and not using the Ewelink Cloud App and it is such an easy process for 90% of the Sonoff devices.
The main purpose of Home Assistant is to locally control as many items in your home as you possibly can, so you can secure your network as well as not rely on a cloud server and the internet. If Ewelink or your internet goes down, so do all your Sonoff switches.
Flash Tasmota to your Sonoff’s, and all of your automations will work as normal. It’s a no brainer.
There is another third party one. I have mine flashed with Tasmota however it’s no different to me that Xiaomi WiFi plugs or Limitless LED lights or Yeelights… all need some ‘server’ somewhere to get up and running…
Im sure people will find this component interesting. Some people are terrified about flashing them.
Let me start by saying that I’m 100% supporting the custom firmwares for Sonoff (or any kind of) devices. Just the idea of having an alternative to a device’s way of working and not just let it die by the will of the manufacturers.
I started this project to get familiar with HA framework internal stuff (what better why to learn it than having a problem ready to be fixed, right?) and if you wonder why I still have the original firmware is because my connected devices are lamps/speakers and is not the end of the world if they fail to start .
Also, I noticed first hand that even if the people are capable of doing a simple task as flashing a custom firmware they tend not to do it and it’s easier (maybe faster) just to insert 3+ lines in a config file like DavidFW1960 kindly mentioned above.
There are many many more official components in HA that use the same approach (again, as DavidFW1960 mentioned): query in a way or another the official endpoint and put the data/states in HA + send the action, this is from where I got my idea in the first place, so unless you buy a device and know exactly how it’s going to work you’re pretty much cloud dependent anyway.
Unfortunately I’m sorry to say that the listed devices are not supported/implemented right now, only the Sonoff Basic switch (that’s the only devices I have right now to test and probably the last too, I’m migrating to Shelly). The good part is that, by reading the code of ported project, I could (in theory at least, maybe with some help from you testing it a bit) add them quite easily.
If you are willing to help, I could write a small python debug script for you to provide back the json response/data of the ewelink app that will help me identify the devices and properly add them to HA.
In the current version of the code, the component might fail to add them or best case scenario you’ll see them listed in HA and definitely not be able to change their state.
I have only sonoff basics, didn’t flash them just because I’m lazy and didn’t want to tinker with them. Also they are in the wall and didn’t want to dismantle a lot of things to reach them (and risk the wife’s anger…)
I created a serie of automations and input_booleans that replicated in Home Assistant the state of the sonoff, and I could even toggle them via home assistant.
The problem was I used ifttt in doing so and created an half-loop, it worked but was extremely faulty.
For me this project is just what I needed!
I feel only that there is the need of something to prevent the ewe application to disconnect, even for a short amount of time, because actually you don’t even the chance to add new devices to the cloud.
I already mentioned this possible next feature in the project’s description (it’s buried somewhere there in description ). I’ll take this mention as a +1 for this and I’ll add it in a way or another in the near future.
Any ideas/inputs how this could be managed ? Calling an event to disable it for a defined period of time / implement a custom defined wait time between reconnects / a button on dashboard maybe ?
I will create tomorrow a debug of-some-sorts script and give more details about when it’s done. If you have a command line and you can run a basic python sonoff-debug.py <arguments> script then we’re good
I updated the component, check out the new information in the repo!
TL;DR scan_interval option to limit how fast the data is updated in HA grace_period option to set a period of time that will stop sonoff refreshing inside HA to allow you to do various changes inside mobile app, this will kick in (more or less) the moment you login in the app.
Just try to install it & use it and let me know how it works personally for me toggling the switch states work as fast as the mobile app itself, and i have everything installed (raspbian + virtual env) on a Rasp pi W