Skip to content

Commit

Permalink
Merge pull request #1517 from arturzx/dev
Browse files Browse the repository at this point in the history
fix: Fixed dev section in analog sensor HA discovery
  • Loading branch information
proddy authored Dec 28, 2023
2 parents 0058632 + 3163a14 commit 62b341a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/analogsensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void AnalogSensor::reload() {
}
if (!found) {
sensors_.emplace_back(sensor.gpio, sensor.name, sensor.offset, sensor.factor, sensor.uom, sensor.type);
sensors_.back().ha_registered = false; // this will trigger recrate of the HA config
sensors_.back().ha_registered = false; // this will trigger recreate of the HA config
if (sensor.type == AnalogType::COUNTER || sensor.type >= AnalogType::DIGITAL_OUT) {
sensors_.back().set_value(sensor.offset);
} else {
Expand Down Expand Up @@ -616,9 +616,9 @@ void AnalogSensor::publish_values(const bool force) {
}

JsonObject dev = config.createNestedObject("dev");
dev["name"] = name;
dev["name"] = Mqtt::basename() + " Analog";
JsonArray ids = dev.createNestedArray("ids");
ids.add(Mqtt::basename());
ids.add(Mqtt::basename() + "-analog");

// add "availability" section
Mqtt::add_avty_to_doc(stat_t, config.as<JsonObject>(), val_cond);
Expand Down

0 comments on commit 62b341a

Please sign in to comment.