HA MQTT Discovert - added remaining values - HomeAssistant Discovery #288

This commit is contained in:
proddy
2020-10-06 20:53:32 +02:00
parent 2d9286aea3
commit 13297334cf
12 changed files with 356 additions and 351 deletions

View File

@@ -127,8 +127,9 @@ void Solar::publish_values() {
}
// if we're using Home Assistant and haven't created the MQTT Discovery topics, do it now
if ((Mqtt::mqtt_format() == Mqtt::Format::HA) && (!ha_created_)) {
if ((Mqtt::mqtt_format() == Mqtt::Format::HA) && (!mqtt_ha_config_)) {
register_mqtt_ha_config();
mqtt_ha_config_ = true;
}
}
@@ -164,8 +165,6 @@ void Solar::register_mqtt_ha_config() {
Mqtt::register_mqtt_ha_sensor(nullptr, F_(valveStatus), this->device_type(), "valveStatus", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(tankHeated), this->device_type(), "tankHeated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(collectorShutdown), this->device_type(), "collectorShutdown", nullptr, nullptr);
ha_created_ = true;
}
// creates JSON doc from values