#759 use b ase in HA unique_id and object_id

This commit is contained in:
Proddy
2022-11-29 21:15:46 +01:00
parent 4103bad8de
commit 5b5dc6a8cc
3 changed files with 43 additions and 53 deletions

View File

@@ -454,13 +454,11 @@ void AnalogSensor::publish_values(const bool force) {
// snprintf(str, sizeof(str), "%s_analog_sensor_%s", Mqtt::basename().c_str(), sensor.name().c_str());
snprintf(str, sizeof(str), "analog_sensor_%d", sensor.gpio());
config["object_id"] = str;
config["uniq_id"] = str; // same as object_id
snprintf(str, sizeof(str), "%s", sensor.name().c_str());
config["name"] = str;
snprintf(str, sizeof(str), "analogsensor_%d", sensor.gpio());
config["uniq_id"] = str;
if (sensor.uom() != DeviceValueUOM::NONE) {
config["unit_of_meas"] = EMSdevice::uom_to_string(sensor.uom());
}