Sonoff /eWeLink component for original firmware

Component error: sonoff - No module named 'websocket'

All good, had to manually install websocket and websocket-client.

Thanks for this great share.

FYI, using a dual relay board, see here.

@Coolie1101 what firmware version the dual relay board uses? to add to compatibility list

for anyone familiar with alarm systems in HA and/or persons interested in RF Bridge integration I would appreciate if you help me to figure out how this should actually work :blush:


thanks

I upgraded my HA to v. 0.101, and now Sonoff custom component dosen’t work.
I get this from the log:

2019-10-31 12:03:44 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.sonoff. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 346, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/sonoff/__init__.py", line 10, in <module>
    from homeassistant.util.async_ import run_coroutine_threadsafe
ImportError: cannot import name 'run_coroutine_threadsafe' from 'homeassistant.util.async_' (/usr/src/homeassistant/homeassistant/util/async_.py)'

Anyone else with this issue? or does anyone know how to fix? :slight_smile:

Are you running the latest version of the Sonoff custom component?
( https://github.com/peterbuga/HASS-sonoff-ewelink )

2 Likes

Wow… that did the trick. Stupid me. Thanks @plonkis!

Happy to help!

@peterbuga It’s currently on the latest firmware, 3.3.0

new beta integrations here https://github.com/peterbuga/HASS-sonoff-ewelink/tree/dev :tada::
Sonoff iFan02/03, Sonoff RF Bridge & Sonoff B1 support for latest HA versions. quite a lot has been changed so be aware bugs might show up, keep an eye on the error log.

feel free to try it and report back if you want. :blush:

1 Like

Hi,

Just cross posting this issue I raised, think it may be Sonoff specific…

https://community.home-assistant.io/t/problem-with-group-of-switches

One of the issues is that switching a switch off instantly changes the state to OFF regardless of whether the switch is actually off. The timeout for this ‘Error’ used to be 10 seconds (i.e. Switch OFF, 10 seconds later the switch state would change back to ON if the request to switch off had been unsuccessful), however now this timout appears to be 60 seconds, which IMHO is far too long…, can we have this back to 10 seconds please ??

i’m interested on this but i have POW R2 upgraded to 3.3.3.0 but when i run sensor.py ,i got nothing data ,can anyone help me?
all i want to show the voltage ,Amps and Watts .

@aamhm POW R2 fw 3.3.0 has been reported multiple times that is not updating/sending the A/W/C values over websocket or api requests without having an ewelink app open (another world class itead b.s. fix) so you’re kinda out of luck. regarding the sensor.py i’m not sure what your trying to say/achieve TBH

@peterbuga my POW R2 fw is 3.3.1 and it show me on ewelink app with all the volt , amp and watt perfect with no problem ,so is 3.3.1 can let me see on the command prompt ur python sensor.py to show me the volt amp and watt ,will it work? cause i’m not good in programming and stuff , i did the folder custom_components --> sonoff and create the configuration file configuration.yaml with the data of my email and password ,but still give me nothin, so did i mess something,thanks

no, you got everything wrong. this is not how this component works, sorry but it’s better if you just drop this idea.

1 Like

Hi Peter,

Many thanks, The B1’s are working again, colour, brightness, warmth all seem to be correct.

Thanks again.

@peterbuga ok drop the idea , now i understand what is HA 100 and i can use it on Virtualbox and i’ll try to make it work and see the wat and amp on it, thanks peter

@peterbuga ,now i got HA 101 working on Virtualbox ,how can i add the Sonoff POW r2 to it ,can you help me?

@peterbuga i’m stuck now at how can i make ur custom_component run inside my HA 101.2,wish u help me?

i have add in configuration.yaml ,i have copy the files inside \config\custom_components\sonoff

but still cannot make ur component run as switch on or switch off my sonoff Pow R2?

@peterbuga take a look on this screenshot

At Last i fixed it by remove the sonoff folder from custome_components then put it back and put second account email and password and it works ,thanks @peterbuga

i confirm that it works with POW R2 switch on and off ,also sensor shows voltage ,amp and watt , on HA 101.2 and Sonoff R2 in Latest Firmware 3.3.1 ,thanks to you

Sonoff no longer works with 101.3 November 5th release. I think the problem is related to this:

Breaking Changes
Removed - The following integrations have been removed:

Direct authentication via trusted networks or API password - It is no longer possible to make authenticated requests using trusted networks or by appending ?api_password=X to the URL. You will now first need to get an authentication token and use that token to make requests. Auth providers for trusted networks and API passwords are still available. - (@balloob - #27656) (auth docs) (http docs) (websocket_api docs)