howanghk / homebridge-ewelink

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

Random errors [{"error":400,"msg":"params incomplete"}] #48

Closed cecildaniel2003 closed 4 years ago

cecildaniel2003 commented 4 years ago

For the past few days getting the below error, due to which there is always a delay or switches fail to respond at all. It seems to happen randomly. Everything was working fine so many days is ewelink discouraging this ?. or is it a simple fix ?.

[2019-9-26 19:53:20] [eWeLink] Requesting power state for [Gate] [2019-9-26 19:53:20] [eWeLink] Requesting power state for [Hall fan 1] [2019-9-26 19:53:20] [eWeLink] Requesting power state for [Staircase] [2019-9-26 19:53:20] [eWeLink] An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}] [2019-9-26 19:53:20] [eWeLink] An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}] [2019-9-26 19:53:20] [eWeLink] An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}] [2019-9-26 19:53:20] [eWeLink] API reported that [Door bell 2] is Off [2019-9-26 19:53:20] [eWeLink] An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}] [2019-9-26 19:53:20] [eWeLink] An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}] [2019-9-26 19:53:20] [eWeLink] An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}] [2019-9-26 19:53:20] [eWeLink] API reported that [Table Lamp] is Off [2019-9-26 19:53:20] [eWeLink] An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}] [2019-9-26 19:53:20] [eWeLink] API reported that [Gate] is Off [2019-9-26 19:53:20] [eWeLink] An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}] send hb to: 0x00000000049e6502

cecildaniel2003 commented 4 years ago

Its completely stopped working for me now.

maxmacstn commented 4 years ago

Yep, this is happened to me too and it's very slow or failed to load eWeLink devices.

yklovett commented 4 years ago

It happen to me too. An error was encountered while requesting a list of devices while interrogating power status. Verify your configuration options. Response was [{"error":400,"msg":"params incomplete"}]

I registered 4 sonoff devices, but it randomly disconnect devices It starts just few days ago.

VoltIcaRus commented 4 years ago

Yes, does anyone know how to solve this problem?

galbartal commented 4 years ago

Same issue here

ravet007 commented 4 years ago

All started 3 days ago. I have the same issue, re-did the whole setup twice and again same issue. I saw my logs and it seems a new Asia server is auto-selected instead of CN. New one - as-api.coolkit.cc Old - cn-api.coolkit.cc I beleive that this is automatic in this release, not using CHARLES, which is good, but I cannot manually change it back to CN-api in the config file. Victor, can you help please.

galbartal commented 4 years ago

All started 3 days ago. I have the same issue, re-did the whole setup twice and again same issue. I saw my logs and it seems a new Asia server is auto-selected instead of CN. New one - as-api.coolkit.cc Old - cn-api.coolkit.cc I beleive that this is automatic in this release, not using CHARLES, which is good, but I cannot manually change it back to CN-api in the config file. Victor, can you help please.

Tried changing it to the old api(cn-api.coolkit.cc) but didnt work either.... [10/3/2019, 3:09:42 PM] [eWeLink] Server did not response with an authentication token. Response was [{"error":301,"region":"as"}] [10/3/2019, 3:09:42 PM] [eWeLink] Server did not response with an authentication token. Response was [{"error":301,"region":"as"}] [10/3/2019, 3:09:43 PM] [eWeLink] Server did not response with an authentication token. Response was [{"error":301,"region":"as"}]

ravet007 commented 4 years ago

I deleted the homebridge and reinstalled on the same My home and there is a delay, but seems to be working now. I also put my Raspberry pi on a sonoff S20 to restart every hour. Some automations work and some do not. I think it’s a server issue. Everything was fine 4 days ago.

ravet007 commented 4 years ago

Ok. So the no response error is back. I am out of options. Tried everything that I could think of. As soon as HomeKit is not being actively used, there is a disconnect between it and eWeLink. I checked it a few times now. EWeLink is working but homebridge does not have any connection. The moment my Raspberry pi restarts, connection is back for a while and then again “no response”. Sometimes the connection returns if I leave the home app open for a few minutes, but this is random, because sometimes the connection does not return until a restart is done at the raspberry pi.

howanghk commented 4 years ago

Hi @ravet007 @galbartal, the api host is mandated by the ewelink server, which is different across accounts. The ewelink server would not let you login (technically, not returning an authentication token) if you connect to a server not responsible for your account. It just tell the ewelink app to connect to the correct server. The homrbridge-ewelink-max plugin properly simulate this behaviour.

Unfortunately, my ewelink-enabled device is out of order for a few months now, I cannot debug the issues on my own. If anyone can provide sufficient information for debugging, I may be able to fix it, otherwise we are out of luck.

ravet007 commented 4 years ago

HI Wong Ho, Thank you for responding. How can I provide the Debug information. Please let me know and I will try to do it. Home bridge is communicating, and api does return with information that the device is on or off. But does not respond to signal from Homebridge to Api. So it is a 1 way issue.

maxmacstn commented 4 years ago

Hi, I'm curious that when this plugin send the request to <apihost>/api/user/device, it doesn't send the parameters like what eWeLink app did. (As I captured using Charles)

Then I try to use only the bearer token to get the information from API, without parameters, just like this plugin does. I got 50/50 chance of getting "params incomplete" error. There was no error if I request with the parameters.

So, I think this plugin might need to add the parameters too.

Screen Shot 2562-10-05 at 00 08 25
ravet007 commented 4 years ago

I just updated to IOS 13.1.2, and the connection is now appearing but delayed 1-2 minutes. If I wait for a minute with the home app open NO RESPONSE disappears and I can access the switches. But there is a good delay before this is possible. That makes automation impossible, because they will run and if no response is encountered they do not retry. Does anyone have any experience with Tasmota, will that help, having a local server on the Raspberry pi. Not sure. That is a lot of work to switch all my 20 switched to Tasmota.

ravet007 commented 4 years ago

Here is my responses on Putty when restarting homebridge Putty homebridge ewelink

ravet007 commented 4 years ago

Ok. I’m back to the No Response error. Don’t know what to do now.

LeJeko commented 4 years ago

For information, I've got the error 400 when I've try to enable the "Interlock" option in the App.

maxmacstn commented 4 years ago

Ok, I think I have fixed this issue, it works very reliable with my setup.

Device Tested

Please help me test by follow the instruction below.

First off all, to avoid conflict, please uninstall your current eWeLink plugin using command sudo npm uninstall -g homebridge-ewelink-max

Next, copy my fork into your homebridge folder. https://github.com/maxmacstn/homebridge-ewelink

And then load the plugin from directory $ homebridge -P ~/.homebridge/homebridge-ewelink/

If it is works with you guys, I will create pull request to join this branch, Thanks.

galbartal commented 4 years ago

Ok, I think I have fixed this issue, it works very reliable with my setup.

Device Tested

* Sonoff Basic RFR3

* Sonoff Mini

Please help me test by follow the instruction below.

First off all, to avoid conflict, please uninstall your current eWeLink plugin using command sudo npm uninstall -g homebridge-ewelink-max

Next, copy my fork into your homebridge folder. https://github.com/maxmacstn/homebridge-ewelink

And then load the plugin from directory $ homebridge -P ~/.homebridge/homebridge-ewelink/

If it is works with you guys, I will create pull request to join this branch, Thanks.

I love you. I works great! thanks

wansaleh commented 4 years ago

What I did was replacing index.js in the homebridge-ewelink-max dir. I'm using hoobs (v3 beta). The npm module is installed at /home/hoobs/.hoobs/node_modules/homebridge-ewelink-max. Copy the index.js from and replace the contents of original index.js. Reload homebridge and rejoice.

maxmacstn commented 4 years ago

Seems to be working fine. I'm very new to JS so any code review would be appreciated ☺️

PR: #49

happy hacktoberfest!

ravet007 commented 4 years ago

Thank you for the fix. I don’t know. I need something more reliable. It’s been painful last 2 weeks dealing with this issue. The project is not being updated either. I tried flashing one of the sonoffs with Tasmota and home assistant and so far no issues. It seems using that method, the RF 433 also works, and everything works with HomeKit, regularly updated and in case of reset, the files can be copied over once set. So no redo’s. I’m still experimenting. But as I mentioned, thank you for the fix. Really appreciate it.

cecildaniel2003 commented 4 years ago

@wansaleh your advice to replace index.js worked for me except I replaced the "index.js" file in the folder /usr/lib/node_modules/homebridge-ewelink-max on my raspberry pi.

Thanks a ton everyone for all your efforts. All my home automations are back in working order now. :)

VoltIcaRus commented 4 years ago

@maxmacstn You're amazing.Thank you. Thank you very much. I just overwritten the index.js file.It's working perfectly now.

yklovett commented 4 years ago

@wansaleh I replaced "index.js" file. It works perfectly now. I love you :)

John88a commented 4 years ago

Hi, im having the exact same error, will try this method later tonight, when u say to replace index.js, i just don't understand where to get the "good" index.js to replace the one in the plugin folder...

howanghk commented 4 years ago

Hi @John88a the fix from maxmacstn have been merged and released. You should upgrade to the latest version instead of patching files.

npm install -g homebridge-ewelink-max@latest
John88a commented 4 years ago

Wonderful, @howanghk thanks a lot for your great help.

John88a commented 4 years ago

@howanghk Hi all, since yesterday im getting the error 400 again... I updated the ewe link max plugin, but still the same, this is the error: [2019-12-24 13:15:03] [eWeLink] WebSocket messge received: {"error":400,"reason":"Bad Request","apikey":"fc37d794-8eff-420f-b91f-55ddef613649","sequence":"1577164503449","actionName":"userOnline"}

howanghk commented 4 years ago

Hi @John88a that is another error, this issue is about "An error was encountered while requesting a list of devices while interrogating power status.", your error was related to the websocket api.

Eivie commented 4 years ago

Hi, i am getting seemingly this error again, {“error” : 400, “msg”:”params is error”}. No authentication token received. Is this because they recently updated their app and the version number is wrong?