Skip to content

Commit

Permalink
BREAKING CHANGE: Home Assistant Auto Discovery to new naming scheme
Browse files Browse the repository at this point in the history
Please Upgrade to HASS 2023.8 or greater.
Thanks to @LennartF22 for the first implementation
  • Loading branch information
tbnobody committed Nov 7, 2023
1 parent 17e92fc commit 71d1b3b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/MqttHandleHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ void MqttHandleHassClass::publishField(std::shared_ptr<InverterAbstract> inv, Ch

String name;
if (type != TYPE_DC) {
name = String(inv->name()) + " " + fieldName;
name = fieldName;
} else {
name = String(inv->name()) + " CH" + chanNum + " " + fieldName;
name = "CH" + chanNum + " " + fieldName;
}

DynamicJsonDocument root(1024);
Expand Down Expand Up @@ -166,7 +166,7 @@ void MqttHandleHassClass::publishInverterButton(std::shared_ptr<InverterAbstract
String cmdTopic = MqttSettings.getPrefix() + serial + "/" + subTopic;

DynamicJsonDocument root(1024);
root["name"] = String(inv->name()) + " " + caption;
root["name"] = caption;
root["uniq_id"] = serial + "_" + buttonId;
if (strcmp(icon, "")) {
root["ic"] = icon;
Expand Down Expand Up @@ -205,7 +205,7 @@ void MqttHandleHassClass::publishInverterNumber(
String statTopic = MqttSettings.getPrefix() + serial + "/" + stateTopic;

DynamicJsonDocument root(1024);
root["name"] = String(inv->name()) + " " + caption;
root["name"] = caption;
root["uniq_id"] = serial + "_" + buttonId;
if (strcmp(icon, "")) {
root["ic"] = icon;
Expand Down Expand Up @@ -240,7 +240,7 @@ void MqttHandleHassClass::publishInverterBinarySensor(std::shared_ptr<InverterAb
String statTopic = MqttSettings.getPrefix() + serial + "/" + subTopic;

DynamicJsonDocument root(1024);
root["name"] = String(inv->name()) + " " + caption;
root["name"] = caption;
root["uniq_id"] = serial + "_" + sensorId;
root["stat_t"] = statTopic;
root["pl_on"] = payload_on;
Expand Down

0 comments on commit 71d1b3b

Please sign in to comment.