]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Set unique device identifier
authoraaronk6 <aaronk6@users.noreply.github.com>
Sun, 17 Mar 2024 22:02:58 +0000 (22:02 +0000)
committeraaronk6 <aaronk6@users.noreply.github.com>
Tue, 24 Sep 2024 18:32:08 +0000 (20:32 +0200)
mqtt.c

diff --git a/mqtt.c b/mqtt.c
index c85dfeb93b7863697f0bd2c3890da9c21db132fe..cc85e03981800456c1b5606cd3967d4abce2f3eb 100644 (file)
--- 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[] = {