python
python copied to clipboard
Add option to list tcp nodes (avahi / mDNS)
Please add an option to list nodes on the local network that are advertising over multicast DNS (avahi).
Listen for _meshtastic._tcp.
For bonus points, include the shortname and id TXT records.
See: https://github.com/meshtastic/firmware/pull/7162
def add_service(self, zeroconf, type, name):
info = zeroconf.get_service_info(type, name)
if info:
txt = info.properties
print(f"Found Meshtastic node: id={txt.get(b'id', b'').decode()} shortname={txt.get(b'shortname', b'').decode()} longname={txt.get(b'longname', b'').decode()}")
Got a good local unit mock test now. Current output
Discovered 1 Meshtastic service:
- MockNode (mocknode.local:4403)
addresses: 127.0.0.1
shortname: MOCK
id: !welovebeef
extra: demo
- Little more granular
PS C:\Users\tbgor\Desktop\dev\python> python -m meshtastic --discover-mdns --mdns-timeout 2
Discovered 1 Meshtastic service:
- MockNode (mocknode.local:4403)
addresses: 127.0.0.1
shortname: LAB
id: !123456
hw: RAK4631
firmware: 2.4.1
platform: rp2040
last_heard: 2025-10-17T16:00:00Z
Extended mDNS output (main.py) to highlight hardware model, firmware version, platform/OS, and last-heard timestamps when present, while suppressing duplicate TXT fields in the general dump. Ill fork my updates in the next day or so