Sonoff /eWeLink component for original firmware

Hi i new in the home assistant software and i´m trying to get all of my sonoff devices in home assistant. i have tried to intigrate them with peterbugas instruction on git hub but the onlything i replay is this error, what am i doning wrong? Component error: sonoff - Integration ‘sonoff’ not found.

But where do i write this?
And copy the *.py files in custom_components folder using the same structure like defined here:

 custom_components
    └── sonoff
        └── __init__.py
        └── switch.py
        └── sensor.py

Thanks in advance.
Jonas

I found a fix , you need to add :slight_smile:
"appid’: ‘oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq’,
to the payload of ws on open.
you need edit sonoff_init_.py
found “def on_open(self, *args)” this function, then found payload struct.
add ‘appid’ : ‘oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq’, insert first line.
next step restart HASS

did this, but i think it crashed my hassio, i now can get it back online. :neutral_face:

Anybody else managed to get it fixed?

You need to delete the entry again and do it inside configurator in home assistant to make it work

Anyone else using Ifan03 on the new dev?

Works great on the master branch.

I did log my issue with dev - Issue

i wish i didnt find them, its so hard, if u spend all your life maybe u get it work :unamused:

Thanks Peter. The latest dev release fixed this issue for me :slight_smile:

Started getting these series after the latest HA update, currently the DEV branch

2019-12-24 08:58:11 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-12-24 08:58:12 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for customizer which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-12-24 09:02:22 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-24 09:12:35 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:16:04 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1903801584] Client exceeded max pending messages [2]: 512
2019-12-24 09:18:37 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-24 09:28:50 ERROR (Thread-21) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:28:50 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:29:00 ERROR (Thread-28) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-24 09:29:00 ERROR (Thread-28) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:33:52 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-24 09:44:04 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:44:04 ERROR (Thread-28) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:44:04 ERROR (Thread-21) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:44:04 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:44:05 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:44:05 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:44:14 ERROR (Thread-42) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-24 09:44:15 ERROR (Thread-42) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:49:06 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-24 09:59:19 ERROR (Thread-42) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:59:19 ERROR (Thread-21) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:59:19 ERROR (Thread-28) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:59:19 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 09:59:20 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:59:20 ERROR (Thread-2) [custom_components.sonoff] websocket error: [Errno 9] Bad file descriptor
2019-12-24 09:59:20 ERROR (Thread-42) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:59:20 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:59:20 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:59:20 ERROR (Thread-42) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'sock'
2019-12-24 09:59:20 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 09:59:29 ERROR (Thread-67) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-24 10:04:19 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-24 10:14:31 ERROR (Thread-28) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 10:14:31 ERROR (Thread-42) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 10:14:31 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 10:14:31 ERROR (Thread-21) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 10:14:31 ERROR (Thread-67) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-24 10:14:31 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 10:14:31 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 10:14:31 ERROR (Thread-42) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 10:14:32 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 10:14:32 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 10:14:41 ERROR (Thread-92) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-24 10:14:42 ERROR (Thread-42) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-24 10:14:42 ERROR (Thread-42) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-24 10:14:42 ERROR (Thread-42) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'

In the latest commit, is there any change other than the new commit mentioned by Amit? Since i see more file compared to previous release

Little OT: Is it just me or do eWeLink servers have some issues last few days in europe? Every night my Sonoff plugs disconnects from server and are available only localy until i launch the eWeLink (from outside IP) app and waits some time to reconnect. Or some kind of new power management…?

Merry Christmas :slight_smile:

UPDATE: This has now stopped with the latest HA update 103.5 (bizarr…), now just get the occasational

error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x71bccfb0>>: 'entity_id'

[PRE 103.5 Issue]

Everything stopped working this morning, all sonoff devices unavailable. After a reboot they are available for 5 mins. then go offline.

Updated everything I could think of, rebuild the Hassio instance etc, now back to failing every 15 mins

2019-12-26 14:59:34 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-12-26 14:59:34 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for customizer which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-12-26 15:02:26 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-26 15:12:38 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:12:38 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:12:38 ERROR (Thread-21) [custom_components.sonoff] websocket error: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2508)
2019-12-26 15:12:38 ERROR (Thread-2) [custom_components.sonoff] websocket error: [SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:1076)
2019-12-26 15:12:38 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:12:39 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:12:39 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:18:39 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-26 15:28:50 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:28:50 ERROR (Thread-21) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:28:50 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:28:50 ERROR (Thread-40) [custom_components.sonoff] websocket error: [Errno 9] Bad file descriptor
2019-12-26 15:28:51 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:33:51 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-26 15:44:04 ERROR (Thread-21) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:44:04 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:44:04 ERROR (Thread-40) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:44:05 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:44:05 ERROR (Thread-40) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:44:15 ERROR (Thread-54) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-26 15:49:06 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-26 15:59:19 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:59:19 ERROR (Thread-54) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:59:19 ERROR (Thread-21) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:59:19 ERROR (Thread-40) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-26 15:59:19 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:59:20 ERROR (Thread-54) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:59:29 ERROR (Thread-71) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-26 15:59:29 ERROR (Thread-71) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:59:30 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-26 15:59:30 ERROR (Thread-71) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:59:30 ERROR (Thread-21) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:59:40 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'connected'
2019-12-26 15:59:40 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 15:59:41 ERROR (Thread-2) [custom_components.sonoff] websocket error: 'NoneType' object has no attribute 'is_ssl'
2019-12-26 16:04:21 WARNING (MainThread) [custom_components.sonoff] Grace period activated!
2019-12-26 16:06:24 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1815391056] Client exceeded max pending messages [2]: 512
1 Like

Hi
can someone explain how we can update the component? Can I just copy paste the *py. files to the right directory?

Clone or download the repo and copy the sonoff directory and contents to /config/custom_components/

Its all in Peters readme file on the repo https://github.com/peterbuga/HASS-sonoff-ewelink

1 Like

Hey everyone
I have this sonoff r2 (without tasmota, ewelink app) that is connected to my washing mashing.
It shows all the relevant sensors (power usage) in home assistant BUT the data won’t push to home assistant unless I open Ewelink app.

How can I fix it?

1 Like

unless you’re a developer there’s not much you can probably do :confused: a solution is already available but not implemented.

2 Likes

hi
how can i add a timer option at the ha like i have at the app ?
thanks.

What kind of timer? Anyway, i think “Automation”/“Script” in the Settings got you covered.

Or there is also:

hi,
at the ewelink app you can define a timer for on /off the switch.

there are other solutions to add a timer-like functionality to an entity be it sonoff or not, start google-ing.
the best i could do is to maybe define in the future a service to enable/disable these (pre)defined timers ewelink and nothing more.

thanks, i will look forward for your update.