From f163e239d2242fbae4821a21f94ff9c2bbeb1086 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Mon, 7 Nov 2022 19:35:29 +0100 Subject: [PATCH] Fix #303: Add inverter name as prefix to HASS auto discovery --- src/MqttHassPublishing.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MqttHassPublishing.cpp b/src/MqttHassPublishing.cpp index 60705b4a..d103281e 100644 --- a/src/MqttHassPublishing.cpp +++ b/src/MqttHassPublishing.cpp @@ -152,7 +152,7 @@ void MqttHassPublishingClass::publishInverterButton(std::shared_ptrname()) + " " + caption; root[F("uniq_id")] = serial + "_" + buttonId; if (strcmp(icon, "")) { root[F("ic")] = icon; @@ -191,7 +191,7 @@ void MqttHassPublishingClass::publishInverterNumber( String statTopic = MqttSettings.getPrefix() + serial + "/" + stateTopic; DynamicJsonDocument root(1024); - root[F("name")] = caption; + root[F("name")] = String(inv->name()) + " " + caption; root[F("uniq_id")] = serial + "_" + buttonId; if (strcmp(icon, "")) { root[F("ic")] = icon; @@ -226,7 +226,7 @@ void MqttHassPublishingClass::publishInverterBinarySensor(std::shared_ptrname()) + " " + caption; root[F("uniq_id")] = serial + "_" + sensorId; root[F("stat_t")] = statTopic; root[F("pl_on")] = payload_on;