Skip to content

Commit 9e230ea

Browse files
committed
correct HA path
1 parent fc792be commit 9e230ea

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ bool sendHaDiscovery()
929929

930930
haSwitchPayLoad += haDeviceDescription;
931931
haSwitchPayLoad += "}";
932-
sprintf(topBuff, "homeassistant/switch/%s_%s/LOAD_STATE/config", _settings.data.deviceName, jsonDev.key().c_str()); // build the topic
932+
sprintf(topBuff, "homeassistant/switch/%s_%s/LOAD_STATE/config", _settings.data.mqttTopic, jsonDev.key().c_str()); // build the topic
933933

934934
mqttclient.beginPublish(topBuff, haSwitchPayLoad.length(), true);
935935
for (size_t i = 0; i < haSwitchPayLoad.length(); i++)
@@ -950,7 +950,7 @@ bool sendHaDiscovery()
950950
"\"dev_cla\":\"signal_strength\",";
951951
haPayLoad += haDeviceDescription;
952952
haPayLoad += "}";
953-
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.deviceName, jsonDev.key().c_str(), "Wifi_RSSI"); // build the topic
953+
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.mqttTopic, jsonDev.key().c_str(), "Wifi_RSSI"); // build the topic
954954
mqttclient.beginPublish(topBuff, haPayLoad.length(), true);
955955
for (size_t i = 0; i < haPayLoad.length(); i++)
956956
{
@@ -968,7 +968,7 @@ bool sendHaDiscovery()
968968
"\"ic\":\"mdi:ip-network\",";
969969
haPayLoad += haDeviceDescription;
970970
haPayLoad += "}";
971-
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.deviceName, jsonDev.key().c_str(), "IP"); // build the topic
971+
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.mqttTopic, jsonDev.key().c_str(), "IP"); // build the topic
972972
mqttclient.beginPublish(topBuff, haPayLoad.length(), true);
973973
for (size_t i = 0; i < haPayLoad.length(); i++)
974974
{
@@ -1005,7 +1005,7 @@ bool sendHaDiscovery()
10051005

10061006
haPayLoad += haDeviceDescription;
10071007
haPayLoad += "}";
1008-
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.deviceName, jsonDev.key().c_str(), haDescriptor[i][0]); // build the topic
1008+
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.mqttTopic, jsonDev.key().c_str(), haDescriptor[i][0]); // build the topic
10091009
mqttclient.beginPublish(topBuff, haPayLoad.length(), true);
10101010
for (size_t i = 0; i < haPayLoad.length(); i++)
10111011
{

0 commit comments

Comments
 (0)