Sonoff /eWeLink component for original firmware

Tags: #<Tag:0x00007fd0762d4d28>


I tried installing it on an account with only 1 sonoff basic.
The switch shows in UI, state is reflected every 60 seconds, however the turn off/on switch is not working

Don’t see any errors in the system log

Config settings:
only email & password


By any chance did you test it using a 2nd account with a shared device attached to it?

I remembered you mentioned above the idea of another account and out of curiosity I’ve just done this test (didn’t thought of it earlier :confused:) and I get the same problem mentioned above + some glorified errors, which is good because clearly there’s another request structure here ready to be reverse engineered (hopefully).


On point. Was literally just editing the post to mention that.

Thanks a lot for looking into this!
Really appreciate your contribution.

I kind of want to do it this way so that I can control from both places. App and HA.


You can now use an account with shared devices too :wink: check it out. Small reminder: currently still/only for Sonoff Basic switches.


Awesome. You’re the (wo)man!


How do I update the Custom component? (other than copy paste?)

I mean would love to learn some cool git pull or something?

Sorry real newbie here. :slight_smile:


Also any disadvantage of reducing scan_interval to the fairly common 5-10s?



Working with shared sonoff Basic device!
Latency of about 2 seconds.

Thanks a lot


It looks like you’re adding device_name from eWeLink API, why not also change friendly_name to that?

entity_id can still be switch.sonoff_xxxxx


:grin: a man, you’re welcome!

Unfortunately I just discovered HA last week myself and I’m still not familiar with the proper custom components updating methods. i haven’t tested install or anything other then above mentioned raspbian+virtual env, i do not know what you have there so it’s better to say for the sake of simplicity to copy-paste the files for now.

Refreshing too fast it’s like trying to pull-down-to-refresh in mobile app, depends on what hardware you have HA installed, on my rasp pi w it gets into timeouts sometimes. you can try to lower the value and keep an eye on the logs for a while and see how it works for you. i wouldn’t take it lower than 10sec though, but then again do you really need it to refresh that fast :face_with_raised_eyebrow:?

The latency can be lowered down even further if I’m using the websocket to listen realtime for all the events (this will make almost instantly the refresh part mentioned above) basically I’m getting closer to simulate the mobile app. But because I started this small project just to learn HA framework and this will require some serious code refactoring, I might do it this component it presents enough interest for more people and for me to do a pull-request on HA project :crossed_fingers::heart_eyes:

The naming part, again fresh project, I really prefer id’s because they have a real link to the hardware and it’s easier to change it in automations if needed. I might add an option or change it as you mentioned aaand just like it’s already specified in README file :stuck_out_tongue:


Great Work!

scan_interval: 10 seconds so far works well on a Rpi2 with Hassio

Hopefully this will pick up attention as there seem to be a lot of people who want to get started with sonoff devices on HA without flashing. (in order for them to work with Google assistant as well without having to integrate that into HA by exposing HA to internet or pay for HA cloud)

Yup naming the entity with device_id seems to be perfect, I was just wondering if adding friendly_name attribute with device_name info from API just makes it a little polished. :slight_smile:

For now, I have just used a customization for friendly_name on Hassio.


Hope the websocket thing works out. Somehow the app on my phone updates instantly when I turn on/off switch using google home.
HA basically updates every 10 seconds.


For you and for anyone else willing to help (themselves) I created this little script that can provide me useful data on the details of various devices. Please read the description carefully :slight_smile:


eWeLink integration to use Sonoff

Awesome. Will give it a try tomorrow. Will add other devices to the shared account as well


For the naming part, I used the customize.yaml and so far all is working well:

  friendly_name: Sonoff Soggiorno
  friendly_name: Sonoff Cucina


I have two sonoffs and they are working as expected.


For you and for anyone else willing to help (themselves) I created this little script that can provide me useful data on the details of various devices.

As I said I’m on, I logged on the terminal but it seems that I don’t have a python command to work with, sorry :sweat:


i see it’s pretty common to have a hassio install so i’ll guess this seems to fit the bill for my request above

i would like to mention that the script can be ran from anywhere be it a linux/macos/windows command line (as long as the highly common dependencies are met), it’s totally independent from HA install.

thanks for trying it out :wink:

eWeLink integration to use Sonoff

Yup doing the same right now.
Just wanted to be get my hands dirty with coding myself. :stuck_out_tongue:


Check out the GitHub repo.
Added JSON dumps.

Adding Sonoff 4Ch pro to account currently breaks the platform/component. (Error added on GitHub)

Let me know if I can be of any other help.


Any setting need in Charles in order to catch the login from ewelink app on iphone?

I have installed Charles on my notebook and share the wifi hotspot, my iphone can connect and use internet share from the notebook. However there is no any display in Charles. I noticed that the ip address received to my iphone is in different subnet mask. I also try to change it manually to the same subnet mask but if do so I can connect to wifi hotspot but cannot use internet and cannot login to ewelink app.