HASS-sonoff-ewelink icon indicating copy to clipboard operation
HASS-sonoff-ewelink copied to clipboard

The component stopped working today I see alot of Bad Requests in the log

Open schachar opened this issue 5 years ago β€’ 48 comments

So, I see tons of: error 400 and 406 in the log (below) The interesting part is that state does synchronize after some time (if I manually switch on/off or use the app) so it seems they changed protocol maybe.

I'm using a different account to which I shared my devices and not my main account to login I verified that in the app that account works correctly

I tried using both master branch and the dev branch (log below is from dev)

019-12-17 16:56:04 DEBUG (MainThread) [custom_components.sonoff] Received state event change for: 10008d7ce2 2019-12-17 16:56:04 DEBUG (MainThread) [custom_components.sonoff] Device 10008d7ce2change to: {"switch": "off"} 2019-12-17 16:56:04 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"error":406,"sequence":"15765945641975293"} 2019-12-17 16:56:04 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-17 16:56:04 DEBUG (Thread-2) [custom_components.sonoff] websocket closed 2019-12-17 16:56:04 DEBUG (Thread-2) [custom_components.sonoff] (re)init websocket 2019-12-17 16:56:06 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"error":400,"reason":"Bad Request","apikey":"068468a7-08fe-4e7f-9ace-e357723a788f","sequence":"15765945657868495","actionName":"userOnline"} 2019-12-17 16:56:38 DEBUG (MainThread) [custom_components.sonoff] Received state event change for: 10008d7ce2 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Device10008d7ce2change to: {"switch": "off"} 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Received state event change for: 10007f77df 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Device10007f77dfchange to: {"switch": "off"} 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Received state event change for: 10008d79ea 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Device10008d79eachange to: {"switch": "off"} 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Received state event change for: 1000333ca7 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Device1000333ca7change to: {"switch": "off"} 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Received state event change for: 1000856dae 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Device1000856daechange to: {"switch": "off"} 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Received state event change for: 1000857248 2019-12-17 16:56:39 DEBUG (MainThread) [custom_components.sonoff] Device1000857248change to: {"switch": "off"} 2019-12-17 16:56:39 DEBUG (Thread-2) [custom_components.sonoff] websocket msg: {"error":406,"sequence":"15765945990022745"} 2019-12-17 16:56:39 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.

schachar avatar Dec 17 '19 15:12 schachar

It happen with me too.

thangman22 avatar Dec 17 '19 16:12 thangman22

happen with me, too

2019-12-18 01:33:32 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:33:33 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:33:43 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:33:44 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:33:44 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:33:45 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:33:46 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:36:00 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:36:01 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:36:02 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:36:02 ERROR (MainThread) [custom_components.sonoff] websocket is not connected 2019-12-18 01:36:03 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:36:03 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:36:53 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 01:36:53 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.

lesydat avatar Dec 17 '19 18:12 lesydat

Hi Same problem nothing is working. I keep receive this error in the log (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. Please help Regards David,

david78455 avatar Dec 17 '19 19:12 david78455

Same issue here.

2019-12-18 09:04:58 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 09:05:02 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 09:05:04 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-18 09:05:05 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.

Regards Scott,

yklovett avatar Dec 18 '19 00:12 yklovett

hi.. im facing the same issue also...

websocket error: Connection is already closed. 8:02 PM custom_components/sonoff/init.py (ERROR) - message first occurred at 8:02 PM and shows up 2 times

This is the Sonoff debug . --------------COPY-FROM-HERE--------------

2019-12-17 21:18:39.820 [S] {"entity_id": "1000359fa9", "new_state": "on", "outlet": 0}

2019-12-17 21:18:39.864 [W] {"error": 406, "sequence": "15765887198143337"}

2019-12-17 21:18:40.212 [W] {"actionName": "userOnline", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "error": 400, "reason": "Bad Request", "sequence": "15765887201624284"}

2019-12-17 21:18:43.276 [S] {"entity_id": "1000359fa9", "new_state": "on", "outlet": 1}

2019-12-17 21:18:43.322 [W] {"error": 406, "sequence": "15765887232747319"}

2019-12-17 21:18:43.668 [W] {"actionName": "userOnline", "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "error": 400, "reason": "Bad Request", "sequence": "15765887236189022"}

ijan1st avatar Dec 18 '19 02:12 ijan1st

"houston we have a problem" type of situation here :expressionless:

unfortunately the timing is quite bad for me, i'll try to take a look at it but i'm quite swamped today in particular... weekend the latest

peterbuga avatar Dec 18 '19 07:12 peterbuga

@peterbuga An update Miraculously sometime during the night it started working again

schachar avatar Dec 18 '19 08:12 schachar

its still doesnt work for me even now..

ijan1st avatar Dec 18 '19 08:12 ijan1st

It's work again for me

david78455 avatar Dec 18 '19 09:12 david78455

@peterbuga An update Miraculously sometime during the night it started working again

same here! this is a must have component. wish @peterbuga had more time for updates.

myownkaos avatar Dec 18 '19 11:12 myownkaos

I think there was a problem with the as region Websocket server , i succeed to connect to us and eu region's servers. now its working so i guess they fix something...

moshezvili avatar Dec 18 '19 11:12 moshezvili

its working for me now.. i think there is some problem with as region servers and theyve fix it now..

ijan1st avatar Dec 18 '19 13:12 ijan1st

its working for me now.. i think there is some problem with as region servers and theyve fix it now..

Had the same issue on AS region for the time being I'm using EU region and everything is back to normal.

"houston we have a problem" type of situation here πŸ˜‘

unfortunately the timing is quite bad for me, i'll try to take a look at it but i'm quite swamped today in particular... weekend the latest

peterbuga long time no c . Hope everything is fine with u.

elserge82 avatar Dec 19 '19 07:12 elserge82

Had the same issue on AS region for the time being I'm using EU region and everything is back to normal.

I can't make it work using eu. How can you switch region without getting this:

found new region: >>> as <<< (you should change api_region option to this value in configuration.yaml)

Thanks.

difelice avatar Dec 19 '19 13:12 difelice

Had the same issue on AS region for the time being I'm using EU region and everything is back to normal.

I can't make it work using eu. How can you switch region without getting this:

found new region: >>> as <<< (you should change api_region option to this value in configuration.yaml)

Thanks.

I just ignored the warning. :D

elserge82 avatar Dec 19 '19 13:12 elserge82

Had the same issue on AS region for the time being I'm using EU region and everything is back to normal.

I can't make it work using eu. How can you switch region without getting this:

found new region: >>> as <<< (you should change api_region option to this value in configuration.yaml)

Thanks.

I just ignored the warning. :D

it doesnt works for me even with other region.. tried changing to as, eu, us and cn region. all sonoff doesnt works.. :(

ijan1st avatar Dec 19 '19 14:12 ijan1st

Had the same issue on AS region for the time being I'm using EU region and everything is back to normal.

I can't make it work using eu. How can you switch region without getting this:

found new region: >>> as <<< (you should change api_region option to this value in configuration.yaml)

Thanks.

I just ignored the warning. :D

it doesnt works for me even with other region.. tried changing to as, eu, us and cn region. all sonoff doesnt works.. :(

There is no sense behind what I'm going to say:) but you can try your luck. Open ewelink app change the state of several sonoff switches. add grace period to 300 set the region to eu reboot HA and leave it for a while. (Went to sleep. I walk up the second day without any issue.) That's what I did while troubleshooting my prob from the beginning.

elserge82 avatar Dec 19 '19 14:12 elserge82

i have same issue.

2019-12-19 23:14:31 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-19 23:14:39 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed. 2019-12-19 23:14:40 ERROR (Thread-2) [custom_components.sonoff] websocket error: Connection is already closed.

LW-Ho avatar Dec 19 '19 15:12 LW-Ho

does anyone with this problem, experience any problems with mobile app too? (i'm EU region and so far i had no problems on my side, can't properly debug the problem)

peterbuga avatar Dec 19 '19 16:12 peterbuga

does anyone with this problem, experience any problems with mobile app too? (i'm EU region and so far i had no problems on my side, can't properly debug the problem)

Just joined the club component stopped 😁

elserge82 avatar Dec 19 '19 16:12 elserge82

Still got the problem even change region

thangman22 avatar Dec 19 '19 17:12 thangman22

does anyone with this problem, experience any problems with mobile app too? (i'm EU region and so far i had no problems on my side, can't properly debug the problem)

same with the mobile device

david78455 avatar Dec 19 '19 17:12 david78455

debug

Can use with app but not with hass component

thangman22 avatar Dec 19 '19 17:12 thangman22

It's work again for me

And now again every thing not working

david78455 avatar Dec 19 '19 17:12 david78455

no working again here too

schachar avatar Dec 19 '19 21:12 schachar

이 λ¬Έμ œκ°€μžˆλŠ” μ‚¬λžŒμ€ λˆ„κ΅¬λ‚˜ λͺ¨λ°”일 앱에 λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆκΉŒ? (λ‚˜λŠ” EU 지역이고 μ§€κΈˆκΉŒμ§€ λ¬Έμ œκ°€ μ—†μ—ˆμŠ΅λ‹ˆλ‹€. 문제λ₯Ό μ˜¬λ°”λ₯΄κ²Œ 디버깅 ν•  수 μ—†μŠ΅λ‹ˆλ‹€)

Try restarting the HASS service.

It resolves after time, but appears unconditionally after restarting the service.

corsair-kr avatar Dec 19 '19 21:12 corsair-kr

What I tried the following:

  1. Service to restart = same issue.
  2. Update HASS package = same issue.
  3. Downgrade HASS package = same issue.
  4. Component upgrade = same issue.
  5. Region change = same issue. (all EU, US, AS, CN)
  6. Same problem with ewelink plugin for home bridge. Only works properly in the ewelink app.

After 2 days, it worked normally.

But restarting the hass service today started to fail again.

Normal operation until restarted.

corsair-kr avatar Dec 19 '19 21:12 corsair-kr

@elserge82 thanks for your suggestion.. ive tried but still no luck.. ive tried again this morning with all the region change n everything but still it doesnt work..

ijan1st avatar Dec 19 '19 22:12 ijan1st

i found a fix , you need to add : 'appid': 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq', to the payload of ws on open. (this is where i found it : https://github.com/CoolKit-Technologies/apiDocs/blob/28e8c33cbb70d63651b8824539ff0b4f28a4aca4/pages/mydoc/application.md)

moshezvili avatar Dec 20 '19 02:12 moshezvili

i found a fix , you need to add : 'appid': 'oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq', to the payload of ws on open. (this is where i found it : https://github.com/CoolKit-Technologies/apiDocs/blob/28e8c33cbb70d63651b8824539ff0b4f28a4aca4/pages/mydoc/application.md)

can you explain further. The exact entry to the config.yaml file

ashoktvm avatar Dec 20 '19 02:12 ashoktvm