Improve handling of redundant cloud commands and error 411 diagnostics - #1848
Open
aferende wants to merge 1 commit into
Open
Improve handling of redundant cloud commands and error 411 diagnostics#1848aferende wants to merge 1 commit into
aferende wants to merge 1 commit into
Conversation
aferende
marked this pull request as ready for review
July 29, 2026 08:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi AlexxIT,
First of all, thank you for your work on SonoffLAN. It is a very useful component, and this proposal is intended to improve its reliability and troubleshooting capabilities while preserving its existing design.
My name is Andrea. I investigated the intermittent eWeLink cloud error 411 reported in #1533 on my Home Assistant installation, with the assistance of Codex. I have been successfully testing this approach in my fork. During the observation period after removing redundant automatic commands in the installation and applying the cloud handling and diagnostics changes, the recurring 411 errors disappeared. This PR adds an integration-level guard so that the same prevention does not depend only on automation design.
Observed cause
In my installation, some Zigbee children are connected through a Sonoff ZBBridge-P and therefore use the eWeLink cloud path. I observed that a cloud command can be issued when the integration already knows that the target switch is in the requested state (for example, an
offrequest for an already-off device). I also observed closely timed commands for the same device, for example from overlapping Home Assistant automations or a manual command near an automation action.Those redundant or concurrent cloud requests were the plausible triggering condition for the sporadic 411 responses in this setup. This does not claim that every 411 has the same root cause or that it proves a LAN/Wi-Fi fault; it addresses the command pattern that was reproducibly correlated with the errors here.
What this PR changes
switch: on/switch: offcommand while holding that lock and skips it if the known device state already matches. This prevents an unnecessary cloud request such as turning an already-off device off again.error: 0response withoutparamsas a successful acknowledgement instead of an unknown-response warning.switch: onorswitch: offcommand. It never retries toggles, scenes, multi-parameter commands, or other non-idempotent actuator commands.Validation
python -m pytest -q --capture=no tests/test_cloud_errors.py tests/test_diagnostics_redaction.pyNo personal Home Assistant configuration, credentials, devices, or automations are included in this PR.
Thanks again for maintaining SonoffLAN. I hope this can help improve the component's effectiveness for users who encounter ambiguous cloud command responses.