Device discovery - how to get pairing info when no info is provided in docs?

Hey all,

Soon I’ll receive a Hitachi ATW-MBS-02 to communicate though Modbus with my heatpump.

For the discovery I’ll have to set the mdns-sd info as per the SDK docs.

A device broadcasts its presence under a name (as specified by the manufacturer)

The thing is that the device tech docs do not reference this. Is there a network scan command I can preform in the CLI to get my required info?

Depends on your OS, on macOS and Linux you can use tcpdump:

$ sudo tcpdump -n multicast

Taking, for example, the Shelly mDNS discovery configuration, it looks for a service name http and protocol tcp.

Using the command above, this is what’s being logged for one of my Shelly devices:

10:22:13.571628 IP 192.168.23.60.5353 > 224.0.0.251.5353: 0* [0q] 6/0/0 PTR _http._tcp.local., PTR shelly1-XXX._http._tcp.local., (Cache flush) SRV shelly1-XXX.local.:80 0 0, (Cache flush) TXT "id=shelly1-XXX" "arch=esp8266" "app=switch1" "fw_version=1.0" "fw_id=20221027-091427/v1.12.1-ga9117d3" "discoverable=false", (Cache flush) A 192.168.23.60, (Cache flush) NSEC (454)

The first PTR value shows the name and the protocol, prefixed by an underscore.

Other example: the Plugwise app. This is its discovery configuration:

"mdns-sd": {
    "name": "plugwise",
    "protocol": "tcp"
  }

And this is what tcpdump logs:

10:26:17.990690 IP 192.168.23.68.5353 > 224.0.0.251.5353: 0*- [0q] 2/0/0 PTR _plugwise._tcp.local., PTR _http._tcp.local. (89)

Again, you can see that the first PTR value contains the name and the protocol from the configuration.

1 Like

Thanks Robert for the detailed explanation.

Running the dump I get this (a part of it)

10:33:31.223125 IP6 fe80::221f:3bff:fe9d:5639.5552 > ff02::fb.5353: 0 PTR (QM)? _googlezone._tcp.local. (40)
10:33:31.223729 IP 192.168.0.22.5353 > 224.0.0.251.5353: 0*- [0q] 1/0/3 PTR 455433b78-332s6-2c43-afee-a85f7ef0a13f._googlezone._tcp.local. (268)
10:33:31.224151 IP 192.168.0.229.5353 > 224.0.0.251.5353: 0*- [0q] 1/0/3 PTR 7e656134-a436-d281-43c0-ed8d656eb215._googlezone._tcp.local. (214)

I presume this is the Googlenest. Now as a check. I see _googlezone. So I would create:

"mdns-sd": {
    "name": "googlezone",
    "protocol": "tcp"
  }

The fact that I see two of them would be that these are two unique devices. Just use the _googlezone part, right?

Correct.

1 Like