go-udap

discover

Discover Squeezebox devices on the network

go-udap discover [--info] [--timeout DURATION] [--format text|json|csv | --json]

What it does

Broadcasts a UDAP advanced-discovery request (UCP method 0x0009) to 255.255.255.255:17784 and prints the MAC address of every device that replies within the timeout window.

With --info, prints a multi-line metadata block per device (MAC / IP / Name / Model / Firmware / HW Rev / UUID / State) and fires a per-device get_ip to show the device's current network config (IP / Subnet / Gateway). Per-device get_ip failures are soft — the table shows dashes, and a --verbose warning is logged to stderr.

Output

In the default text format:

  • Without --info: one MAC per line, sorted by MAC string.
  • With --info: per-device metadata block, blank line between devices.

With --json (or -o json), an array with one object per device, sorted by MAC. Without --info, each object holds only the MAC:

[{"mac":"00:04:20:16:06:02"}]

With --info, each object holds the device's metadata, with its get_ip answer nested under network. Every field except mac is null when absent, such as an empty name or UUID. In text, both cases below show as -:

  • network is null when the device didn't answer get_ip.
  • A field inside network is null when the device answered without it, for example no gateway, or 0.0.0.0 in factory state.
[{"mac":"00:04:20:16:06:02","ip":"192.168.1.50","name":"Kitchen","model":"Squeezebox Receiver","firmware":"77","hardware_rev":"0005","uuid":"deadbeefcafebabe1122334455667788","state":"init","network":{"ip":"192.168.1.50","subnet_mask":"255.255.255.0","gateway":"192.168.1.1"}}]

With -o csv, a header row and one row per device. With --info, network is flattened into network_* columns, which are all empty when network is null. A null value is an empty cell:

mac,ip,name,model,firmware,hardware_rev,uuid,state,network_ip,network_subnet_mask,network_gateway
00:04:20:16:06:02,192.168.1.50,Kitchen,Squeezebox Receiver,77,0005,deadbeefcafebabe1122334455667788,init,192.168.1.50,255.255.255.0,192.168.1.1

With --info, every device's get_uuid and get_ip queries finish before anything is written, in every format.

When no device replies, stderr says no devices found within DURATION and stdout is empty for text, [] for json, and the header row alone for csv.

The JSON keys and CSV columns are a stable contract: none will be removed or renamed without a major version. New ones may be added. See Output formats.

Flags

FlagDefaultDescription
--infooffPrint full metadata per device including get_ip results
--timeout DURATION2sHow long to wait for device replies
--format FORMAT, -otextOutput format: text, json or csv
--jsonoffShorthand for --format json

Exit codes

  • 0 — success (even if zero devices found)
  • 1 — discovery failed (transport error)
  • 2 — unknown or invalid flag (including a format name other than text, json or csv, or --json with --format), or a stray argument

Examples

Quick scan:

go-udap discover
# 00:04:20:16:06:02

Full metadata:

go-udap discover --info

On a multi-NIC host, scope discovery to one interface:

go-udap --bind-interface en7 discover

See How to discover on a multi-NIC laptop for the longer story.

On this page