From 2a4b8296d71f25e5a29a07ea6cc9f3ac31676c48 Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Fri, 17 Jul 2026 19:49:46 -0500 Subject: main: advertise mac in mDNS TXT Stable identity for the Scrypted plugin's discovery/auto-heal: the viewport name is user-editable and the IP can renumber, but the MAC is fixed. Discovery matches on it to relocate a device after a DHCP change. --- main/mdns_service.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/mdns_service.c b/main/mdns_service.c index 05d8c23..e5b2b3a 100644 --- a/main/mdns_service.c +++ b/main/mdns_service.c @@ -23,12 +23,14 @@ static esp_err_t apply_state(bool include_hostname) { char hostname[80]; char name[64]; + char mac[18]; const char *resolution, *orientation; viewport_state_lock(); viewport_state_t *st = viewport_state_get(); snprintf(hostname, sizeof(hostname), "viewport-%s", st->viewport_name); snprintf(name, sizeof(name), "%s", st->viewport_name); + snprintf(mac, sizeof(mac), "%s", st->mac_str); resolution = viewport_state_resolution_str(); orientation = (st->orientation == VIEWPORT_ORIENTATION_PORTRAIT) ? "portrait" : "landscape"; @@ -42,6 +44,9 @@ static esp_err_t apply_state(bool include_hostname) { "resolution", resolution }, { "orientation", orientation }, { "name", name }, + // Stable identity for the Scrypted plugin's discovery/auto-heal: + // names are user-editable, the MAC is not. + { "mac", mac }, }; return mdns_service_txt_set(SERVICE, PROTO, txt, sizeof(txt) / sizeof(txt[0])); -- cgit v1.2.3