add back obj_id for HA test

This commit is contained in:
MichaelDvP
2025-10-14 08:30:52 +02:00
parent 12b06aa657
commit 9d04058984
6 changed files with 41 additions and 32 deletions

View File

@@ -701,6 +701,7 @@ void AnalogSensor::publish_values(const bool force) {
}
config["uniq_id"] = uniq_s;
config["obj_id"] = uniq_s;
char name[50];
snprintf(name, sizeof(name), "%s", sensor.name().c_str());
@@ -773,7 +774,7 @@ void AnalogSensor::publish_values(const bool force) {
// add default_entity_id
std::string topic_str(topic);
doc["default_entity_id"] = topic_str.substr(0, topic_str.find("/")) + "." + uniq_s;
doc["def_ent_id"] = topic_str.substr(0, topic_str.find("/")) + "." + uniq_s;
Mqtt::add_ha_dev_section(config.as<JsonObject>(), "Analog Sensors", nullptr, nullptr, nullptr, false);
Mqtt::add_ha_avail_section(config.as<JsonObject>(), stat_t, !is_ha_device_created, val_cond);