Skip to content

Improve ECHONET Lite discovery robustness with passive probing and multi-response collection#88

Open
nao-pon wants to merge 3 commits intoscottyphillips:masterfrom
nao-pon:improve_discovery
Open

Improve ECHONET Lite discovery robustness with passive probing and multi-response collection#88
nao-pon wants to merge 3 commits intoscottyphillips:masterfrom
nao-pon:improve_discovery

Conversation

@nao-pon
Copy link
Copy Markdown
Collaborator

@nao-pon nao-pon commented Mar 10, 2026

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:

  1. Passive discovery probe for unknown hosts
  2. Multi-response collection window for multicast discovery

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:

  • multicast discovery packets are filtered
  • multicast routing between Wi-Fi and wired segments is unreliable
  • devices send notifications but do not respond reliably to multicast

To prevent discovery storms, probes are controlled using:

  • _passive_probe_in_progress
  • _passive_probe_cache
  • per-result cache TTLs

A 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:

  • devices may still send INF notifications
  • but multicast discovery may fail

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

  • devices sending periodic INF notifications
  • networks where multicast discovery is unreliable
  • mixed wired / Wi-Fi network segments

…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.
@nao-pon nao-pon requested a review from scottyphillips March 10, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant