Skip to content

Commit

Permalink
Add calculated values to hass auto discovery (#509)
Browse files Browse the repository at this point in the history
Add battery P and E as well as panel I to auto discovery values of HA
  • Loading branch information
alexz707 authored Oct 23, 2023
1 parent b833d5a commit c5427de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/MqttHandlVedirectHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}
}

0 comments on commit c5427de

Please sign in to comment.