mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 03:56:57 +03:00
.
This commit is contained in:
@@ -48,11 +48,9 @@ void sendHomeAssistantDiscoveryTopic(std::string maintopic, std::string group, s
|
|||||||
topicT = group + "_" + field;
|
topicT = group + "_" + field;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The name is used as Friendly Name but also to generate the Entity ID! */
|
|
||||||
if (group != "") { // Prepend the group to the name
|
if (group != "") { // Prepend the group to the name
|
||||||
name = group + " " + name;
|
name = group + " " + name;
|
||||||
}
|
}
|
||||||
name = maintopic + " " + name; // Prepend device name to make the entities unique
|
|
||||||
|
|
||||||
topicFull = "homeassistant/sensor/" + maintopic + "/" + topicT + "/config";
|
topicFull = "homeassistant/sensor/" + maintopic + "/" + topicT + "/config";
|
||||||
|
|
||||||
@@ -60,6 +58,7 @@ void sendHomeAssistantDiscoveryTopic(std::string maintopic, std::string group, s
|
|||||||
payload = "{" + nl +
|
payload = "{" + nl +
|
||||||
"\"~\": \"" + maintopic + "\"," + nl +
|
"\"~\": \"" + maintopic + "\"," + nl +
|
||||||
"\"unique_id\": \"" + maintopic + "-" + topicT + "\"," + nl +
|
"\"unique_id\": \"" + maintopic + "-" + topicT + "\"," + nl +
|
||||||
|
"\"object_id\": \"" + maintopic + "_" + topicT + "\"," + nl + // This used to generate the Entity ID
|
||||||
"\"name\": \"" + name + "\"," + nl +
|
"\"name\": \"" + name + "\"," + nl +
|
||||||
"\"icon\": \"mdi:" + icon + "\"," + nl;
|
"\"icon\": \"mdi:" + icon + "\"," + nl;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user