Repository navigation
Examples: adopt ebus-service-discovery for mDNS discovery and advertising - #104
Merged
Merged
Conversation
The mdns extra now installs ebus-service-discovery[zeroconf]>=0.4.0. - utility-meter --discover uses mdns.find_broker() and BrokerEndpoint.mqtt_cfg(), and the meter advertises _ebus._tcp and _device-info._tcp with mdns.Advertiser (--no-advertise opts out). - simple-span-controller browses _secure-mqtt._tcp with mdns.browse(), accepts only the instance whose SRV target is span-<serial>.local, and connects by that host name. - README, examples/README.md and CHANGELOG updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T32pvgqCzp1qCz7K5gS9Wm
- simple-span-controller connects to the matched SRV target (not the TXT `broker` value), and to the panel's most-preferred advertised address when this host cannot resolve `.local` names. - utility-meter --discover browses with mdns.browse_many, rank_brokers and select_broker in a loop whose last browse is cut to the time left, so it returns by --discover-timeout. find_broker's fixed browse window overran it by up to 3 s. - .ebus-spec.json notes describe the mdns extra as it now is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T32pvgqCzp1qCz7K5gS9Wm
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.
Fixes #100.
The
mdnsextra now installsebus-service-discovery[zeroconf]>=0.4.0in place of barezeroconf, and both examples use it instead of their own browse code.simple-span-controllerbrowses_secure-mqtt._tcpand accepts only the advertisement whose SRV target isspan-<serial>.local(it matched a substring before). It connects by that host name, and to the panel's advertised address when this host cannot resolve.localnames.utility-meter --discoverranks and selects brokers with the library and stays within--discover-timeout. A plain broker config now also accepts_mqtt._tcp.utility-meteradvertises_ebus._tcpand_device-info._tcp(framework.md requirement 6) under its device id when the extra is installed;--no-advertiseturns it off.Behavior changes: discovery now waits for the browse window (5 s for the span controller, 3 s per meter attempt) instead of returning on the first answer.
Verified live:
simple-span-controlleragainst a panel on the LAN found the same 25 devices and values asmain, including with.localresolution forced to fail;utility-meter --discoverfound a locally advertised mosquitto, published, and appeared in an_ebus._tcpbrowse. 874 tests pass; ruff check and format pass on the repo and both extension-less examples.🤖 Generated with Claude Code
https://claude.ai/code/session_01T32pvgqCzp1qCz7K5gS9Wm