Skip to content

Commit

Permalink
correct HA path
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarecrash committed Apr 7, 2024
1 parent fc792be commit 9e230ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ bool sendHaDiscovery()

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

mqttclient.beginPublish(topBuff, haSwitchPayLoad.length(), true);
for (size_t i = 0; i < haSwitchPayLoad.length(); i++)
Expand All @@ -950,7 +950,7 @@ bool sendHaDiscovery()
"\"dev_cla\":\"signal_strength\",";
haPayLoad += haDeviceDescription;
haPayLoad += "}";
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.deviceName, jsonDev.key().c_str(), "Wifi_RSSI"); // build the topic
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.mqttTopic, jsonDev.key().c_str(), "Wifi_RSSI"); // build the topic
mqttclient.beginPublish(topBuff, haPayLoad.length(), true);
for (size_t i = 0; i < haPayLoad.length(); i++)
{
Expand All @@ -968,7 +968,7 @@ bool sendHaDiscovery()
"\"ic\":\"mdi:ip-network\",";
haPayLoad += haDeviceDescription;
haPayLoad += "}";
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.deviceName, jsonDev.key().c_str(), "IP"); // build the topic
sprintf(topBuff, "homeassistant/sensor/%s_%s/%s/config", _settings.data.mqttTopic, jsonDev.key().c_str(), "IP"); // build the topic
mqttclient.beginPublish(topBuff, haPayLoad.length(), true);
for (size_t i = 0; i < haPayLoad.length(); i++)
{
Expand Down Expand Up @@ -1005,7 +1005,7 @@ bool sendHaDiscovery()

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

0 comments on commit 9e230ea

Please sign in to comment.