Improve ECHONET Lite discovery robustness with passive probing and multi-response collection#88
Open
nao-pon wants to merge 3 commits intoscottyphillips:masterfrom
Open
Improve ECHONET Lite discovery robustness with passive probing and multi-response collection#88nao-pon wants to merge 3 commits intoscottyphillips:masterfrom
nao-pon wants to merge 3 commits intoscottyphillips:masterfrom
Conversation
…hosts Improve ECHONET Lite discovery robustness by introducing passive probing and enhancing unknown host handling. Key improvements: • Passive discovery probe When INF/INFC packets are received from a host without a discovered instance list, a lightweight unicast discovery probe is scheduled. This allows discovery to succeed even in networks where multicast discovery packets are filtered or unreliable. • Unknown host handling Packets from previously unseen hosts now create a temporary state entry so discovery data can be extracted immediately from the packet itself before a discovery probe is executed. • Instance state management Introduced _ensure_instance_state() to centralize instance structure creation and avoid duplicated logic. • Discovery response window Multicast discovery now collects responses for a short time window instead of stopping at the first response, improving multi-device discovery reliability. • Passive probe scheduling controls Added suppression and caching mechanisms to prevent repeated probing when devices send frequent INF/INFC notifications. • Robust packet handling - Ignore packets originating from local multicast interfaces - Protect packet decoding with exception handling - Improve debug logging These changes improve discovery reliability in mixed networks (e.g. Wi-Fi / mesh / router environments) where multicast traffic may be partially filtered but device notifications are still received.
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.
Summary
This PR improves the robustness of ECHONET Lite device discovery in networks where multicast traffic may be unreliable (e.g. Wi-Fi mesh, router filtering, mixed L2 segments).
Two discovery enhancements are introduced:
These changes allow devices to be discovered even when standard multicast discovery does not work reliably.
Key Improvements
Passive discovery probe
If an INF / INFC notification is received from a host that does not yet have an instance list, a background unicast discovery probe is scheduled.
This allows discovery to succeed in cases where:
To prevent discovery storms, probes are controlled using:
_passive_probe_in_progress_passive_probe_cacheA discovery callback is triggered only when the probe transitions a host from "unconfigured" to "configured".
Improved unknown host handling
Packets from unknown hosts now create a temporary state entry so the current packet can still be processed and discovery data extracted
immediately.
Active discovery is scheduled in the background unless the packet is already a Node Profile response.
Multicast discovery response window
Multicast discovery previously stopped after the first response.
Now responses are collected during a short window (
_discovery_window) so multiple devices responding to the same discovery request can be properly detected.Internal improvements
• Added
_ensure_instance_state()helper to avoid duplicated instance structure initialization logic.• Added
_is_configured_host()helper to centralize the check for whether a host already has an instance list.• Added packet decode protection to prevent malformed packets from breaking the receive loop.
• Added additional debug logging for discovery scheduling and probe results.
• Ignore packets originating from the local multicast interface.
Why this is needed
Some home networks (especially Wi-Fi mesh systems) partially filter multicast traffic between segments. In these environments:
The passive probe mechanism ensures these devices can still be discovered.
Compatibility
No breaking API changes.
All existing discovery behavior remains intact; the passive probe acts as an additional discovery path.
Tested with