From: aaronk6 Date: Sun, 17 Mar 2024 22:02:58 +0000 (+0000) Subject: Set unique device identifier X-Git-Tag: 4.3.5^2~20^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af6d90282e5c223a8682b2088fc329957b08146c;p=thirdparty%2Fshairport-sync.git Set unique device identifier --- diff --git a/mqtt.c b/mqtt.c index c85dfeb9..cc85e039 100644 --- a/mqtt.c +++ b/mqtt.c @@ -100,6 +100,7 @@ void on_connect(struct mosquitto *mosq, __attribute__((unused)) void *userdata, // function to send autodiscovery messages for Home Assistant void send_autodiscovery_messages(struct mosquitto *mosq) { const char *device_name = config.service_name; + const char *device_id = config.airplay_device_id ? config.airplay_device_id : config.service_name; const char *sw_version = get_version_string(); const char *model = "shairport-sync"; const char *model_friendly = "Shairport Sync"; @@ -120,7 +121,7 @@ void send_autodiscovery_messages(struct mosquitto *mosq) { "\"sw_version\": \"%s\"," "\"manufacturer\": \"%s\"" "}", - model, device_name, model_friendly, sw_version, manufacturer); + device_id, device_name, model_friendly, sw_version, manufacturer); // when adding sensors here, be sure to also update sensor_names and icons below! const char *sensors[] = {