AlexxIT/SonoffLAN

Cloud error 411

Closed this issue ยท 28 comments

Hi, I often find several of these 411 errors in the logs and occasionally some 504 errors (the device id changes)..

[W] Cloud ERROR: {'error': 411, 'deviceid': 'a4800aad2b', 'apikey': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322', 'sequence': '1732798064352', 'uid': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322'}
[W] Cloud ERROR: {'error': 504, 'deviceid': 'a4800aad2b', 'apikey': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322', 'sequence': '1732798064352', 'uid': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322'}

Now the 504 (bad gateway) is probably due to a timeout error of the ITHEAD/Sonoff servers in Cloud.
I would like to know if the 411 error depends on the SonOffLan integration or if this is also an error of their Cloud (but what type?)
Http 411 is "Length Required" ... but what does it mean?
Is it receiving a Json payload of the wrong length?

Thanks
home-assistant_sonoff_2024-11-28T18-02-37.106Z.log

Looks like it's undocumented error https://coolkit-technologies.github.io/eWeLink-API/#/en/OAuth2.0?id=v2-interface-error-code
I have no idea what it means.

Ty @AlexxIT
I wanted to try to verify if this error depends on APPID and APPSECRET. Since I registered on the ewelink developer portal and I have my pair, could you tell me how I can test them in the SONOFFLAN integration? Where in the code should I put them?
Thx,
Andrea

sonoff:
  appid: xxx
  appsecret: xxx

I receive this error:

IMG_20241129_153759.jpg

So your appid can't use this API

I registered here to get appid and secretid: https://dev.ewelink.cc.
Is this the correct link?

I have no idea. Never tried her this keys.

how did you get yours?

Ewelink give it personally for SonoffLAN project.

Hi @AlexxIT,
is it possible to know what is the request and the json payload that then triggers this error response? if you help me I'll try to write to the support collkit to find out the nature of this 411 error.
Thanks,
Andrea

Try to enable debug logs for integration

I tried both like this:
image

and like this:
image

but when the error occurs I have no further logs.
image

image

Am I enabling debug logs correctly or is there another way?

Hi @AlexxIT,
there seems to be the same information also in debug log but the requests are missing which then generate these 504 and 411 errors in response.
image

logs.zip

By the way, coolokit support responded to me a little while ago and wants to have an example of a Json request.
image

How can it be done? Thanks as usual for your support

Coolkit support claims that it is not their cloud that responds with error 411 (but I don't believe it).
It becomes essential at this point to give them evidence of the request that the integration sends them

image

I found this solution:

image

In this way I have full payload to send to coolkit support.

{'action': 'update', 'apikey': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322', 'selfApikey': 'XXXXXXXXXXX', 'deviceid': 'a4800aad2b', 'params': {'switch': 'on'}, 'userAgent': 'app', 'sequence': '1733313770787'}

I'll keep you updated
Ty,
Andrea.

Are you sure this is request for your errors? Is field sequence same?

Yes I am sure.
See here.
Can you think of any solutions or possible causes?
Anyone else get this error?

image

But you showing response without error.

Sorry I had taken a sequence without errors.
See this one from a few minutes ago:

image

It's bad you're wiping out device IDs. Was the first line (local query) sent with the same identifier? It ended with an error, too.

Sorry. It's just that I still haven't figured out if the device id is sensitive data or not :-)
I don't think so, since it's in the debug info.
In any case, this is the text that is visible in plain text:

2024-12-04 15:14:44 [D] 10022bd4a5 => Local4 | 192.168.100.223:8081 | {'switch': 'off', 'subDevId': 'a4800aad2b'} <= {'sequence': '1733321684291', 'seq': 2, 'error': 400, 'encrypt': True}
2024-12-04 15:14:44 [D] a4800aad2b => Cloud4 | {'switch': 'off'} | 1733321684291
2024-12-04 15:14:44 [D] a4800aad2b => Cloud4 | {'switch': 'off'} | 1733321684291 payload: {'action': 'update', 'apikey': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322', 'selfApikey': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322', 'deviceid': 'a4800aad2b', 'params': {'switch': 'off'}, 'userAgent': 'app', 'sequence': '1733321684291'} 
2024-12-04 15:14:47 [W] Cloud ERROR: {'error': 411, 'deviceid': 'a4800aad2b', 'apikey': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322', 'sequence': '1733321684291', 'uid': '34d8fdc6-4a0d-4771-a2d2-ee0d9a5b5322'}
2024-12-04 15:14:47 [D] 10022bd4a5 => Local4 | 192.168.100.223:8081 | None <= {'sequence': '1733321687578', 'seq': 2, 'error': 400, 'encrypt': True}

In fact, I'm attaching the latest complete debug where there are other 411 errors:
logs.zip

Let me know what you think

Is it possibile we are exceeding the limit of 50,000 calls per month?
Only in the log I attached in the previous message there are 215 calls in 5 hours.
Doing a quick count, I alone make 30,000 calls per month (I have 27 sonoff devices).
In the coolkit documentation they say that for each cloud site you can make (free) a maximum of 50,000 calls per month.

image

Are these 50,000 calls per account or overall per Appid?

Don't think so. My devices works fine over cloud.

You have problems ONLY with ZBMINIL2. Looks like you have Zigbee Pro bridge.
Do you never have these devices working at all? Or do they only have certain commands that don't work?

I confirm that I have a Zigbee Pro Bridge (with a recently updated firmware to version 2.2.0 - see bug #1529)
These devices work with all commands but sometimes (several times a day) they give these errors (411,504).
In addition to the error in the log, obviously the effect is that the light does not turn on or a sensor remains stuck on "motion detected" and does not update its state in cloud.
The only way to solve it is to turn the light on/off again or pass near the sensor (after 1 minute) to force the status update in the cloud.
The only peculiarity is that in all ZGMINIL2 I have activated the RSSI entities (which are disabled by default) just to monitor signal quality.

Hi @AlexxIT, this is the answer given by ewelink support.
What do you think about?

image

The signal from the devices seems to have no problems:
image

There's a logic to it. Signal strength isn't always the most important thing. Even with a strong signal, commands may not be received. It's radio. Many devices can cause interference.

It's really incredible. I managed to find the cause of the 411 error and solve the problem.
It was actually an interference problem on Zigbee channel 25.

I should point out that I have a SonOff Bridge Pro that in its settings (eWeLinkApp) allows you to change the Zigbee channel and is also able to scan the best channel.
The scan always suggested that channel 25 was the most free from interference and therefore it was on that channel.
In reality, the problem was exactly this; on this channel I had a lot of interference probably due to the many wifi access points that reach me from the neighborhood.

image

I had already configured my WiFi on a channel whose interference did not overlap with that of the Zigbee.
In short, after several 411 errors that were driving me crazy, I decided to change the Zigbee channel again.
Every time you change the Zigbee channel, all the devices are automatically removed and reset and must be re-added manually.
During this process, I did a fundamental test.

I tried all the channels one by one and tried to add all the devices together (for each single channel).

From here I realized that the only channel with which all the devices were added was channel 11, which the pro bridge doesn't recommended because it was indicated as the most crowded.

After changing the channel now I finally have all the devices stable and for 3 days not even a 411 error (before I had several a day).

Now incredibly the Pro Bridge reports channel 25 as the most crowded. Something must not be working well in this algorithm.

image

Thanks to the ewelink support that reported to me that the 411 error (not documented) concerns unreachable devices and to @AlexxIT support now everything is stable.
I hope that this information can help others who have encountered this problem.

I also leave the link with the guide on how to avoid interference between zigbee and wifi.

ZigBee Network Optimization (and Repeaters/Router) Mesh: https://community.home-assistant.io/t/zigbee-network-optimization-a-how-to-guide-for-avoiding-radio-frequency-interference-adding-zigbee-router-devices-repeaters-extenders-to-get-a-stable-zigbee-network-mesh-with-best-possible-range-and-coverage-by-fully-utilizing-zigbee-mesh-networking/515752

image

I think this thread can be closed.
Thx.