Sonoff /eWeLink component for original firmware

It’s more than a stretch. It is talking about a different project altogether, one that it does not appear that this component relies on.

A few weeks ago Peter told me that he won’t have any access to real life devices for 3-4 weeks, and that all his “things” is offline for the moment. Don’t know why but I guess he have stuff to do.

That’s what he told me.

So I see that automations don’t go and we have error on websocket that is changed from 0.54 to 0.56. I know that there is a custom component that works with new web socket if some one want to upgrade I can give github page of custom component of sonoff that I founded i try ed but i am not able to use.

1 Like

I have a few Sonoff switches, 2x S20 and 2x POW R2. They were working great until some time in the last few days. I have updated HA to 0.93.2 (on Friday maybe?), and have 3.0.1 on the S20s (this was a fairly recent update too) and 2.8.0 on the POWs.

Now I can still see the four switches, but the History tab no longer shows the power measurements for the POWs (e.g. voltage, current, etc).

The dev-state tab shows the state, and shows some readings for these values, but I can’t find the chart, or any historical data. Is this still recording? Is it a problem with my Sonoff config, or a change in the latest HA?

The only other pertinent info I can find is this stack trace in the logs.

2019-06-04 07:52:56 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform sonoff
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

The exception handlers seemed to throw more exceptions, one part that stands out is this:

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='us-api.coolkit.cc', port=8080): Max retries exceeded with url: /api/user/device?lang=en&apiKey=<redacted>&getTags=1 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6bf37a30>: Failed to establish a new connection: [Errno -3] Try again'))

The error happens every time I reboot the device. Not sure if it’s related, but I haven’t seen it before this issue came up.

I’m real new to Home Assistant, but otherwise technically competent, so I appreciate any help troubleshooting the missing history data.

Mine was working perfectly until yesterday. Now it just doesnt find the sonoff switches. After a restart it tell me it cant find them in components folder. They are in custom components folder where they were working fine. I also tried a restore from last week and it didnt fix the problem so I cant figure out how it suddenly changed???

@teitelbot
yes, after I update to V 0.94.0 " custom_components\sonoff " stops working . I don’t know why they are doing this .

1 Like

That is simply not true. Custom components work in 0.94.

Custom components works, it’s true, but @teitelbot is right, somehow sonoff custom component stopped working on 0.94 version. If you downgrade below 0.94 it will work as before - perfectly. Hope someone will fix this, I will try today to get some free time to investigate problem…

Mine started working again. The only thing I did was change the amount of memory allocated for hassio. Very strange.

Works without any problems for me.

RBPI 3b+
HA: 0.94.0
HassOS: 2.12 / Sup 166
SonOff Component: 17 aprl (Master)
Sonoff Device: S20, FW 2.6.0, 2.6.1 and 3.0.0 tested

1 Like

@teitelbot

how can I do that?

If your installed hassio through a VM like me than you change it in the VM settings.

Unfortunately it is on PI3
with a 32G card the problem is I use influxdb and grafana (they need large memory)

Sonoff returns to work again after I update to Ver 0.94.1.

RBPI 3b
HA: 0.94.1
Python_version 3.7.3
HassOS: 2.12 / Sup 166
Custom_components : sonoff-ewelink-websocket

1 Like

mine is working 0.94.1

1 Like

I’ve just updated to 0.94.1 and I’m not sure if it’s a coincidence or not, but I’ve noticed that my Sonoff TH10 temperature sensor has stopped updating in HA. Earlier today I was on 0.92.2 and it seemed to be working fine and was reading 68.0 degrees, and when I checked the temperature after my update it was still reading as such, but the eWeLink app shows the temperature is 64 degrees. Even after restarting HA the temperature stays at 68.

Any ideas what could be causing this issue? I’m not finding any errors in the logs.

Just did the update to 0.94.1 and everything is back in order. Hooray :partying_face:

Big thanks to the HA devs and of course to @peterbuga for the great component :love_you_gesture:

Up until today I had been stuck on a problem with the Sonoff/eWeLink custom component stalling during HA startup with no message in the log - even though the sonoff_debug standalone worked just fine (HA 94.2, raspbian+virtualenv with python 3.7.3, websocket branch). Just in case this helps others, the issue turned out to be that for sonoff_debug the module dependency only needed “pip install websocket”, but for the integrated component you also need “pip install websocket-client”. The dependency is indeed mentioned earlier in this thread, but just highlighting the debug version runs without it - so I missed the nuance. I am now a happy camper - my Sonoff 4ch Pro is all set to be my new lawn sprinkler controller. @peterbuga - great component, thanks!

Do you have some automation examples?

I’m trying to create an automation to turn on some switches (sonoff 4ch) when I’m getting close to home, but without success…

I’ll send my code:

- id: '1552160713998'
  alias: Turn on Lights when close to home
  trigger:
  - above: '30'
    below: '900'
    entity_id: proximity.home
    platform: numeric_state
  action:
  - alias: ''
    data:
      entity_id: switch.sonoff_100046ac01_3
    service: switch.turn_on
  - alias: ''
    data:
      entity_id: switch.sonoff_100046ac01_1
    service: switch.turn_on
  - alias: ''
    data:
      entity_id: switch.sonoff_100046ab72_2
    service: switch.turn_on

And yeah, I need to add an condition to only run this automation when I’m going towards home, but, for now if I can turn this switches on by automation would be perfect…