Add calculated values to hass auto discovery (#509)

Add battery P and E as well as panel I to auto discovery values of HA
This commit is contained in:
Al3x Zamponi 2023-10-23 13:18:24 +02:00 committed by GitHub
parent b833d5ab52
commit c5427dedce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,9 +68,12 @@ void MqttHandleVedirectHassClass::publishConfig()
// battery info
publishSensor("Battery voltage", NULL, "V", "voltage", "measurement", "V");
publishSensor("Battery current", NULL, "I", "current", "measurement", "A");
publishSensor("Battery power (calculated)", NULL, "P", "power", "measurement", "W");
publishSensor("Battery efficiency (calculated)", NULL, "E", "efficiency", "measurement", "%");
// panel info
publishSensor("Panel voltage", NULL, "VPV", "voltage", "measurement", "V");
publishSensor("Panel current (calculated)", NULL, "IPV", "current", "measurement", "A");
publishSensor("Panel power", NULL, "PPV", "power", "measurement", "W");
publishSensor("Panel yield total", NULL, "H19", "energy", "total_increasing", "kWh");
publishSensor("Panel yield today", NULL, "H20", "energy", "total", "kWh");
@ -188,4 +191,4 @@ void MqttHandleVedirectHassClass::publish(const String& subtopic, const String&
String topic = Configuration.get().Mqtt_Hass_Topic;
topic += subtopic;
MqttSettings.publishGeneric(topic.c_str(), payload.c_str(), Configuration.get().Mqtt_Hass_Retain);
}
}