diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index 68fe8824e..3beef959b 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -151,7 +151,7 @@ void DallasSensor::loop() { scancnt_ = 0; } else if (scancnt_ == -2) { // startup firstscan_ = sensors_.size(); - LOG_DEBUG(F("First scan found %d dallassensor(s). Adding them."), firstscan_); + LOG_DEBUG(F("Adding %d dallassensor(s) from first scan"), firstscan_); } else if ((scancnt_ <= 0) && (firstscan_ != sensors_.size())) { // check 2 times for no change of sensor # scancnt_ = -3; sensors_.clear(); // restart scaning and clear to get correct numbering @@ -367,7 +367,7 @@ void DallasSensor::publish_values(const bool force) { std::string topic(100, '\0'); snprintf_P(&topic[0], 100, PSTR("homeassistant/sensor/ems-esp/dallas_%s/config"), sensor.to_string().c_str()); - Mqtt::publish_retain(topic, config.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(topic, config.as()); registered_ha_[sensor_no - 1] = true; } diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 5d5d09dc3..af9c4dd6e 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -103,7 +103,7 @@ void Boiler::register_mqtt_ha_config() { dev["mdl"] = name(); JsonArray ids = dev.createNestedArray("ids"); ids.add("ems-esp-boiler"); - Mqtt::publish_retain(F("homeassistant/sensor/ems-esp/boiler/config"), doc.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(F("homeassistant/sensor/ems-esp/boiler/config"), doc.as()); // publish the config payload with retain flag Mqtt::register_mqtt_ha_binary_sensor(F_(tapwaterActive), device_type(), "tapwater_active"); Mqtt::register_mqtt_ha_binary_sensor(F_(heatingActive), device_type(), "heating_active"); diff --git a/src/devices/heatpump.cpp b/src/devices/heatpump.cpp index 67b53e4f2..8245d1b6a 100644 --- a/src/devices/heatpump.cpp +++ b/src/devices/heatpump.cpp @@ -100,7 +100,7 @@ void Heatpump::register_mqtt_ha_config() { dev["mdl"] = this->name(); JsonArray ids = dev.createNestedArray("ids"); ids.add("ems-esp-heatpump"); - Mqtt::publish_retain(F("homeassistant/sensor/ems-esp/heatpump/config"), doc.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(F("homeassistant/sensor/ems-esp/heatpump/config"), doc.as()); // publish the config payload with retain flag Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(airHumidity), device_type(), "airHumidity", F_(percent), nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(dewTemperature), device_type(), "dewTemperature", F_(degrees), nullptr); diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index d3c2c6a07..07140c57f 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -163,7 +163,7 @@ void Mixer::register_mqtt_ha_config() { std::string topic(100, '\0'); if (type() == Type::HC) { snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/sensor/ems-esp/mixer_hc%d/config"), hc_); - Mqtt::publish_retain(topic, doc.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(topic, doc.as()); // publish the config payload with retain flag char hc_name[10]; snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_); Mqtt::register_mqtt_ha_sensor(hc_name, nullptr, F_(flowTemp), device_type(), "flowTemp", F_(degrees), F_(icontemperature)); @@ -173,7 +173,7 @@ void Mixer::register_mqtt_ha_config() { } else { // WWC snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/sensor/ems-esp/mixer_wwc%d/config"), hc_); - Mqtt::publish_retain(topic, doc.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(topic, doc.as()); // publish the config payload with retain flag char wwc_name[10]; snprintf_P(wwc_name, sizeof(wwc_name), PSTR("wwc%d"), hc_); Mqtt::register_mqtt_ha_sensor(wwc_name, nullptr, F_(wwTemp), device_type(), "wwTemp", F_(degrees), F_(icontemperature)); diff --git a/src/devices/solar.cpp b/src/devices/solar.cpp index 154d7123e..5b8dd9df4 100644 --- a/src/devices/solar.cpp +++ b/src/devices/solar.cpp @@ -133,7 +133,7 @@ void Solar::register_mqtt_ha_config() { dev["mdl"] = name(); JsonArray ids = dev.createNestedArray("ids"); ids.add("ems-esp-solar"); - Mqtt::publish_retain(F("homeassistant/sensor/ems-esp/solar/config"), doc.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(F("homeassistant/sensor/ems-esp/solar/config"), doc.as()); // publish the config payload with retain flag Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(collectorTemp), device_type(), "collectorTemp", F_(degrees), nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(tankBottomTemp), device_type(), "tankBottomTemp", F_(degrees), nullptr); diff --git a/src/devices/switch.cpp b/src/devices/switch.cpp index e0d3ac5dc..278536a75 100644 --- a/src/devices/switch.cpp +++ b/src/devices/switch.cpp @@ -126,7 +126,8 @@ void Switch::register_mqtt_ha_config() { JsonArray ids = dev.createNestedArray("ids"); ids.add("ems-esp-switch"); - Mqtt::publish_retain(F("homeassistant/sensor/ems-esp/switch/config"), doc.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(F("homeassistant/sensor/ems-esp/switch/config"), doc.as()); // publish the config payload with retain flag + Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(activated), device_type(), "activated", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(flowTemp), device_type(), "flowTemp", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(status), device_type(), "status", nullptr, nullptr); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 365367667..a8b6b00f0 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -814,7 +814,7 @@ void Thermostat::register_mqtt_ha_config() { dev["mdl"] = name(); JsonArray ids = dev.createNestedArray("ids"); ids.add("ems-esp-thermostat"); - Mqtt::publish_retain(F("homeassistant/sensor/ems-esp/thermostat/config"), doc.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(F("homeassistant/sensor/ems-esp/thermostat/config"), doc.as()); // publish the config payload with retain flag Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(time), device_type(), "time", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(error), device_type(), "errorcode", nullptr, nullptr); @@ -903,7 +903,7 @@ void Thermostat::register_mqtt_ha_config(uint8_t hc_num) { std::string topic(100, '\0'); snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/thermostat_hc%d/config"), hc_num); - Mqtt::publish_retain(topic, doc.as(), true); // publish the config payload with retain flag + Mqtt::publish_ha(topic, doc.as()); // publish the config payload with retain flag // enable the a special "thermostat_hc" topic to take both mode strings and floats for each of the heating circuits std::string topic2(100, '\0');