howanghk / homebridge-ewelink

Homebridge plugin to control Sonoff relays with OEM firmware
MIT License
81 stars 46 forks source link

Web Socket gets closed (400 Bad Request) #67

Closed aswathraja closed 4 years ago

aswathraja commented 4 years ago

The devices toggles without the request being successfully acknowledged. The device is not controlable through the api. I keep getting WebSocket closed messages in my log and reconnecting each time i toggle a device.

And I understand they recently updated the ewelink app and might have changed the API. any help to fix this or a change in the plugin would be much appreciated.

howanghk commented 4 years ago

Hi @aswathraja are you using the latest version (0.1.18)? Would you please post the homebridge logs here?

galbartal commented 4 years ago

Hi @aswathraja are you using the latest version (0.1.18)? Would you please post the homebridge logs here?

98AD2EA1-2629-444D-8050-DA4F52DB9B96

howanghk commented 4 years ago

Yes I can confirm their WebSocket protocol changed. It will take quite some time to update this plugin to emulate the new protoal in the latest ewelink app. If you guys happen to know programming, please consider contributing! This is an open source project that I maintain in my free time, to keep this plugin working we need more developers to help.

Lgl692 commented 4 years ago

@howanghk same question.... please see as below

[12/22/2019, 1:51:42 PM] [eWeLink] Setting power state to [on] for device [空氣清淨機]
[12/22/2019, 1:51:42 PM] [eWeLink] WebSocket messge received: {"error":406,"sequence":"1576993902636"}
[12/22/2019, 1:51:42 PM] [eWeLink] WebSocket was closed. Reason [1006]
WebSocketClient: reconnecting...
[12/22/2019, 1:51:48 PM] [eWeLink] Sending login request [{"action":"userOnline","userAgent":"app","version":6,"nonce":"157699390811300","apkVesrion":"1.8","os":"ios","at":"3xxxxxxxxc0019414a0e44350efac775510e0e11","apikey":"xxxxxxxxx-72d4-4b65-800c- bc0df4e10b87","ts":"1xxxxxxx908","model":"iPhone10,6","romVersion":"11.1.2","sequence":1576993908113}]
[12/22/2019, 1:51:48 PM] [eWeLink] WebSocket messge received: {"error":400,"reason":"Bad Request","apikey":"cxxxxxxxx-72d4-4b65-800c-bc0df4e10b87","sequence":"157xxxxxxxx113","actionName":"userOnline"}

在此非常非常感謝您對此應用的付出。

aswathraja commented 4 years ago

@howanghk i have updated v 0.1.19 just now. But the issue seems to be persistent. Please find my logs below.

Dec 23 04:22:44 raspberrypi homebridge[13800]: [12/23/2019, 4:22:44 AM] [eWeLink] Setting power state to [on] for device [***** CH 1]

Dec 23 04:22:44 raspberrypi homebridge[13800]: [12/23/2019, 4:22:44 AM] [eWeLink] WebSocket messge received: {"error":406,"sequence":"1577055164483"}

Dec 23 04:22:44 raspberrypi homebridge[13800]: [12/23/2019, 4:22:44 AM] [eWeLink] WebSocket was closed. Reason [1006]

Dec 23 04:22:49 raspberrypi homebridge[13800]: WebSocketClient: reconnecting...

Dec 23 04:22:49 raspberrypi homebridge[13800]: [12/23/2019, 4:22:49 AM] [eWeLink] Sending login request [{"action":"userOnline","userAgent":"app","version":6,"nonce":"1577**6974300","apkVesrion":"1.8","os":"ios","at":"***","apikey":"****","ts":"1577055169","model":"iPhone10,6","romVersion":"11.1.2","sequence":1577055169743}]

Dec 23 04:22:49 raspberrypi homebridge[13800]: [12/23/2019, 4:22:49 AM] [eWeLink] WebSocket messge received: {"error":400,"reason":"Bad Request","apikey":"**","sequence":"1577055169743","actionName":"userOnline"}

Edit : Cleaned the cosmetic formatting of the logs

ddong3000 commented 4 years ago

we must waiting howanghk please check We look forward to solving

ddong3000 commented 4 years ago

It's working! thanks😆🥰🤩 Merry christmas🎄

John88a commented 4 years ago

Thanks a lot, its working again Merry Christmas 🎄

Lgl692 commented 4 years ago

獻上最大的感謝,再度動起來了。。。

聖誕快樂~~~

aswathraja commented 4 years ago

I can confirm its back working again, i wonder if it was their server side issue and changes they had to do at their end. Merry Christmas Thanks

benjackson1111 commented 3 years ago

This is doing this for me again now, almost a year later. I did have internet go down for a day and it wrecked a few things, but this error is the only one I can't fix. App working fine, status working fine, importing devices working fine - but as the OP said, just not toggling the device on or off etc. I wonder if the API has changed again and it's just a coincidence when they took down our power/internet for fire safety? I've never had this problem. I wish I could flash these to work on the local network but I never did. It's a shame the homebridge plugin requires the ewelink cloud to work. As they will do local processing within the app, so that means the app is capable of doing something locally that I just wish the homebridge plugin would replicate. Oh well.

John88a commented 3 years ago

This is doing this for me again now, almost a year later. I did have internet go down for a day and it wrecked a few things, but this error is the only one I can't fix. App working fine, status working fine, importing devices working fine - but as the OP said, just not toggling the device on or off etc. I wonder if the API has changed again and it's just a coincidence when they took down our power/internet for fire safety? I've never had this problem. I wish I could flash these to work on the local network but I never did. It's a shame the homebridge plugin requires the ewelink cloud to work. As they will do local processing within the app, so that means the app is capable of doing something locally that I just wish the homebridge plugin would replicate. Oh well.

Hello, im also having the exact same problem, also had it last year. At first i though there was some problem on my end as yesterday there was a update to the UI-X plugin, but i think it wouldn't cause this problem, now i see your message, and seems im not the only one.

jmgutierrezc1 commented 3 years ago

I am also having the same issue since yesterday. I tried updating the Imei but no success.

benjackson1111 commented 3 years ago

Ok I'm glad to hear I"m not the only one 👍 I also tried updating the imei tried changing the API server Tried adding country code just in case (mine is 1) Very weird that it works just fine getting devices and their statuses but won't actually do anything.

bwp91 commented 3 years ago

please try uninstalling homebridge-ewelink-max and installing homebridge-ewelink

benjackson1111 commented 3 years ago

Confirmed working swapping plugins - thanks @bwp91 And as far as I can see from the logs, this is finding the devices LOCALLY via the LAN IP addresses. That's amazing!

bwp91 commented 3 years ago

@benjackson1111 glad you like my plugin 👍

benjackson1111 commented 3 years ago

@bwp91 Dude this is what I've been looking for for almost a year now. Thank you so much. All my (3) gates all have sonoff relays and a bunch of outside lights, and I rely on them to even open for me when i arrive home etc. Without local processing, it can be real buggy! You're a legend.

bwp91 commented 3 years ago

@benjackson1111

You’re a legend

Nicest compliment i’ve had in a long time! thanks! 🤣

John88a commented 3 years ago

Thanks so much for the new plugin, all working great now for me as well. Thank you !!!