python icon indicating copy to clipboard operation
python copied to clipboard

Add option to list tcp nodes (avahi / mDNS)

Open vidplace7 opened this issue 2 months ago • 4 comments

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

vidplace7 avatar Oct 10 '25 20:10 vidplace7

    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()}")

SpudGunMan avatar Oct 18 '25 03:10 SpudGunMan

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

OpenSource-For-Freedom avatar Oct 18 '25 03:10 OpenSource-For-Freedom

  • 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

OpenSource-For-Freedom avatar Oct 18 '25 03:10 OpenSource-For-Freedom

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

OpenSource-For-Freedom avatar Oct 18 '25 03:10 OpenSource-For-Freedom