mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
dallas, analog HA object_id also without basename (commented out)
This commit is contained in:
@@ -419,7 +419,8 @@ void AnalogSensor::publish_values(const bool force) {
|
|||||||
}
|
}
|
||||||
config["val_tpl"] = str;
|
config["val_tpl"] = str;
|
||||||
|
|
||||||
snprintf(str, sizeof(str), "%s_analog_sensor_%s", Mqtt::basename().c_str(), sensor.name().c_str());
|
// snprintf(str, sizeof(str), "%s_analog_sensor_%s", Mqtt::basename().c_str(), sensor.name().c_str());
|
||||||
|
snprintf(str, sizeof(str), "analog_sensor_%s", sensor.name().c_str());
|
||||||
config["object_id"] = str;
|
config["object_id"] = str;
|
||||||
|
|
||||||
snprintf(str, sizeof(str), "%s", sensor.name().c_str());
|
snprintf(str, sizeof(str), "%s", sensor.name().c_str());
|
||||||
|
|||||||
@@ -502,7 +502,8 @@ void DallasSensor::publish_values(const bool force) {
|
|||||||
}
|
}
|
||||||
config["val_tpl"] = str;
|
config["val_tpl"] = str;
|
||||||
|
|
||||||
snprintf(str, sizeof(str), "%s_temperature_sensor_%s", Mqtt::basename().c_str(), sensor.name().c_str());
|
// snprintf(str, sizeof(str), "%s_temperature_sensor_%s", Mqtt::basename().c_str(), sensor.name().c_str());
|
||||||
|
snprintf(str, sizeof(str), "temperature_sensor_%s", sensor.name().c_str());
|
||||||
config["object_id"] = str;
|
config["object_id"] = str;
|
||||||
|
|
||||||
snprintf(str, sizeof(str), "%s", sensor.name().c_str());
|
snprintf(str, sizeof(str), "%s", sensor.name().c_str());
|
||||||
|
|||||||
@@ -1120,11 +1120,13 @@ void Mqtt::publish_ha_sensor_config(uint8_t type,
|
|||||||
// entity id is generated from the name, see https://www.home-assistant.io/docs/mqtt/discovery/#use-object_id-to-influence-the-entity-id
|
// entity id is generated from the name, see https://www.home-assistant.io/docs/mqtt/discovery/#use-object_id-to-influence-the-entity-id
|
||||||
// so we override it to make it unique using entity_id
|
// so we override it to make it unique using entity_id
|
||||||
// See https://github.com/emsesp/EMS-ESP32/issues/596
|
// See https://github.com/emsesp/EMS-ESP32/issues/596
|
||||||
// keep it compatible to v3.4, use english fullname, no prefix
|
// keep it compatible to v3.4, use english fullname, no prefix (basename prefix commmented out)
|
||||||
char object_id[130];
|
char object_id[130];
|
||||||
if (have_tag) {
|
if (have_tag) {
|
||||||
|
// snprintf(object_id, sizeof(object_id), "%s_%s_%s_%s", mqtt_basename_, device_name, EMSdevice::tag_to_string(tag).c_str(), read_flash_string(en_name).c_str());
|
||||||
snprintf(object_id, sizeof(object_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag).c_str(), read_flash_string(en_name).c_str());
|
snprintf(object_id, sizeof(object_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag).c_str(), read_flash_string(en_name).c_str());
|
||||||
} else {
|
} else {
|
||||||
|
// snprintf(object_id, sizeof(object_id), "%s_%s_%s", mqtt_basename_, device_name, read_flash_string(en_name).c_str());
|
||||||
snprintf(object_id, sizeof(object_id), "%s_%s", device_name, read_flash_string(en_name).c_str());
|
snprintf(object_id, sizeof(object_id), "%s_%s", device_name, read_flash_string(en_name).c_str());
|
||||||
}
|
}
|
||||||
doc["object_id"] = object_id;
|
doc["object_id"] = object_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user