Sonoff /eWeLink component for original firmware

hello, i update all my sonoff basic frimwares to 3.0.1 and now hassio is not available to show them or connect. Any solution for that??

Did you disable the integration before update (as suggested)? All of my Sonoffs are on v3.0.1 and this firmware works fine for me.

Btw: How did you manage to update to v3.0.1 now when the latest firmware is 3.3.0?

I disabled but after I updated the sonoff basic’s. I update them through the app it still telling me that is the latest firmware!

image|690x479

I think I have to keep looking for solutions thank you for the input

Hi,

I am running HA 0.102.3 and have an sonoff temp/hum/switch which is located at a remote location.

I am running the latest Sonoff /eWeLink component; sonoff FW 2.9.0.

So far everything is running fine for some time but after a couple of days the sensors are getting unavailable in HA (in eWELink App they are fine).

Not sure if the problem is related to power failures at the sonoff location (HA can not connect to the sensors even after the power comes back).

What I have to do is restart HA to get the sensors back which is a bit annoying.

Having this error in the log file:

Thu Dec 12 2019 19:48:55 GMT+0100 (CET)

error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x7fe9bd9a8410>>: string indices must be integers

Any idea what I can do to get the connection more stable (even after power failure).

Thanks

fregatte

Hi
Has anyone manage to add a sonoff RF Bridge device to HA? If yes what is the procedure because I can not find the device no matter what I tried. Thanks

@Makis have a read here

@fregatte unfortunately that error is not much i can work with, you’d have to enable the debug mode for sonoff component and search for the entire error lines in the log

@JessyLugo PM me the output of sonoff-debug.py (you’ll find it in the repo along with details)

@peterbuga,

thanks for coming back to my issue; I just activated debug and will post results once the connection stops. tnx fregatte

@peterbuga,

the first thing I noticed is that the debug log states one reading per second (which is causing a lot of traffic) even though my configuration is set to “300”.

Is this correct?

Tnx

fregatte

ff:
username: [email protected]
password: mypassword
scan_interval: 300
grace_period: 600
api_region: ‘eu’
entity_prefix: True
debug: True

2019-12-13 23:51:06 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:07 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:08 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:09 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:10 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:10 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:11 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:12 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:13 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}
2019-12-13 23:51:14 DEBUG (Thread-2) [custom_components.ff] websocket msg: {“action”:“update”,“deviceid”:“1000b11a7e”,“apikey”:“50bxxxxx-zzz6-47e7-9ddd-6d82bdddeee”,“userAgent”:“device”,“ts”:0,“params”:{“sensorType”:“AM2301”,“currentHumidity”:“65”,“currentTemperature”:“17”},“from”:“device”}

There are 2 types of updates in this component: first (that acts like a fallback too) is poll-ing data and refreshing the entities status every 300sec, the 2nd one (the one above) it’s data received via websocket meaning each device pushes update information and this way you get the almost-instant updates in HA. the websocket updates are not something that I can control, looks like there might be something weird/wrong with your device sending same data information every second (usually updates over websocket are sent only when a state/value has changed)

@peterbuga,

tnx for the quick response and the clarification. Might the WebSocket update each second be caused in general by FW 2.9.0? There are for sure not that much users checking their debug log maybe this situation is quite common but nobody notices? The only thing I can do is to update to FW to 3.3.0 but this one is as I read not 100% compatible with your custom component (and I doubt that I can do a FW update just via VPN to my remote network). tnx

i was able to replicate the keep-app-open-to-have-sensor-data flow on FW 3.3.0 reported by some people in this thread, but as it might have it in order to make it work i need to constantly send back some messages via websocket :see_no_evil: clearly not every second as it happens in your case but still some maybe 1 every minute or so (don’t when i’m going to implement this though, if ever… )

@peterbuga,

thanks for the info; as it is likely that sonoff will update the FW again some time it might be wise to check if this 3.4.0? has the same issues. It is likely that they improve the communication part and therefore it does from my point of view not make sense to invest valuable time to circumvent the issues just for 3.3.0.

Maybe a hint on your github page is helpfull that users do not update to 3.3.0.

In my case the sensor.sonoff update (last seen) is between every minute and every 1 or 2 hours. It is just the watchdog traffic which is a bit annoying but with just one sensor I can live with that.

Again many thanks for th sonoff custom component what you are doing for the community.

fregatte

@peterbuga

Thank you for your amazing work!
need some help with some issues:
stooped working this from log file
“2019-12-17 21:59:44 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-17 21:59:47 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.
2019-12-17 21:59:50 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.”

running the latest version of the component + latest Hassio version.

the weird thing is that i can see the entities and state of the switches correctly , i just cant control them using Hassio, if i turn off/on the light via ewlink, the state is updating in ha. so weird, working perfectly until today.
model : sonoff s20
config:

sonoff:
  username: email
  password: pass
  scan_interval: 60 
  api_region: 'eu'  

every time i try to control the entity i’m getting the following error:
2019-12-17 22:33:37 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.

tried :
restart hassio
restart modem

any suggestions?

Thanks!

It was working fine. Now the entity even shows. I upgraded to 103.2 and now the device does not respond to turning on and off

Same error now.

Me too , now i can only view status but can’t control.

LOG file websocket error: Connection is already closed.

12:07 PM custom_components/sonoff/init.py (ERROR)

1 Like

Hoping this is fixable…else, would have to tasmotise all my sonoff, and that s a lot of works. Lol

1 Like

Same error - please update if you find out how to fix it.
Thanks

fix available

Where ?
Please send a link.
I don’t see the fix in the git.

1 Like