Sonoff /eWeLink component for original firmware

@peterbuga, Does SONOFF L1 work with this?

When I use the physical button of the sonoff it sometimes does not update in the home assistant. my scan is at 60. Anyone with the same problem?

  username: xxxxxx
  password: xxxxxx
  scan_interval: 60 
  grace_period: 600 
  api_region: 'us' 

@denis.besir L1 can work with it but not implemented yet

@jgasparelo it might be a normal expected output, when you manually change the status of sonoff devices you’re there next to it and i don’t think they pro-actively report this status. not sure a lot of people use it this way… (ps: per a request from a person working - i assume - in itead team the scan_interval will be removed in the future and replaced with something else, assuming faster and more reliable)

Hey Everyone,
First off, great work on this @peterbuga its made a lot of people really happy!

OK So most of my hardware is flashed with another firmware but I do have one device that I can not get an alternative firmware for, it is an energy monitor made by Wemeter in China. Its a 3 phase unit and been working quite nicely on Ewelink. BUT when I saw this integration I thought maybe it may allow me a way to get that data into HA.

So I started tinkering and trying to set it up but I am no expert in code or HA (Ex Openhab sorry!) and am struggling.
Here is my config-:

 sonoff:
  username: ###username###
  password: ###password###
  scan_interval: 60
  grace_period: 600

I have put the latest files off Github into the correct folders as stated on the readme but I can not get any entities to show up in developer tools.
There are 3 other sonoff POWS as well as the energy meter in my Ewelink App that I shuld be able to pick up.
What am I doing wrong or have I totally missed something??

Cheers

Simon

Hello All!
I just stuck with websocket module:

2020-02-25 22:27:27 ERROR (MainThread) [homeassistant.components.homeassistant] Component error: sonoff - Integration 'sonoff' not found.
2020-02-25 22:27:28 ERROR (SyncWorker_17) [DenonAVR] Host 192.168.8.51 returned HTTP status code 403 to GET request at end point /goform/formMainZone_MainZoneXmlStatus.xml
2020-02-25 22:27:37 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.sonoff. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/loader.py", line 346, in _load_file
    module = importlib.import_module(path)
  File "/usr/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 "/home/homeassistant/.homeassistant/custom_components/sonoff/__init__.py", line 34, in <module>
    import websocket
ModuleNotFoundError: No module named 'websocket'

While module installed:

$ python
Python 2.7.16 (default, Apr  6 2019, 01:42:57) 
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import websocket
>>> print(websocket.__version__)
0.57.0

What I am missing?

If I remember correctly you need websocket-client or maybe websockets.

hi,
does it suppose to support also Sonoff MINI ?
Thanks

Hi,
i get this error : “This entity does not have a unique ID, therefore it’s settings can not be managed from the UI”. any idea ?
the sonoff part in the configuration.yaml looks like this :

sonoff:
  username: !secret sonoff_user
  password: !secret sonoff_pass
  scan_interval: 60
  grace_period: 600
  api_region: 'eu'
  entity_prefix: True
  debug: False

and the custom_components:

custom_components/sonoff/
 __init__.py
__pycache__/
 sensor.py
switch.py

tks

This is not really an error. You can’t manage entities from this integration via the entity registry yet. In fact, it’s only with the latest version of HA that entities from this are even listed in the entity registry. I see this message as well but all my devices from this integration are working fine.

Hello!
I have a home assistant system through windows python.
I have successfully added some 3 X tp-link HS110, a sonoff pow r2 and a sonoff TH10.
I have 2 users for sonoff. I am using an account for the ha and another one for my mobile phone.
Problem is that on order to have real time values for my sonoff devices, i need to check my mobile phone app, then i have ha values refreshed.
Any ideas?
This is my config :

sonoff:
  username: [email protected]
  password: XXXXXXXX
  scan_interval: 60 
  api_region: 'eu' 
  entity_prefix: True 
  debug: False     

what values are you referring exactly? if it’s POW’s current/voltage check this State is not updating POW (R2) · Issue #128 · peterbuga/HASS-sonoff-ewelink · GitHub [not a fix, an explanation]

I managed to make a workaround.
I made a virtual phone through memu, i installed ewelink and i logged in through my main ewelink account.
Then i logged in with my 2nd account inside ha and shared the devices.
A a result i have a 60secs refresh in values now just fine.
Is there a solution without this workaround?

complex (and not too mention heavy on resources) workaround but if it works it works.

if you bothered to read the above thread this is exactly what is the fix! in short: right now this component is simulating the ewelink app and “the fix” would be to create a separated thread (aka a 2nd simulated app) to keep the reporting alive

1 Like

Hello again.
I decided to create a hassio through virtual box in order to have official addons. I managed to do that.
Problem is that i have no idea of how to access, create, copy,paste etc the py files. Is there a guide?
Thanks

This add-on may help you to work with configuration files:

I have allready added that.
I am talking about the step of the instructions, of copy paste the py files inside the custom components folder. I don’t know how to access the folders inside hassio.

This add-on has a functionality to copy (upload) files to the custom components folder. This is a workaround for you.
Alternatively, you can connect through ssh to the virtual box machine and work with the folder through ssh.
Or may be you need to describe your setup in more details. Some one can help you…

1 Like

I used the file editor addon, i created the folder and i uploaded the py files inside, but with no success.
Any help?
af2b6b11a5e19a83285f9c5f758cdd92
383a95dd1221a459f9251aa8a918ab5d Inkedbd9d1c65cf0db37f105449c18ae78e18_LI

Ok, it’s working today. I did ha server restart. Maybe 106.6 update did the trick.

No, sometimes it may happened. A couple of restarts may fix it. I do restart of the whole NAS with docker applications.