Hi everyone
I managed to get power production from my inverter into Home Assistant. I probably used a very incorrect way, but so far the values look accurate so I am still happy. The values come into HA via MQTT. I used Helpers > Riemann sum integral sensor
with the Left
option to calculate the kWh production from my sensor.inverter1_pv_input_watts
and sensor.inverter2_pv_input_watts
values respectively. I then have a custom sensor calculation that combines the two values to give me total kWh produced.
sensor:
- platform: template
sensors:
total_power_production:
friendly_name: "Total Power Production"
unit_of_measurement: "kWh"
value_template: "{{ (states('sensor.inverter1_power_generation')|float) + (states('sensor.inverter2_power_generation')|float) }}"
From here I created a Utility Meter
that will reset counters daily, weekly, monthly and yearly.
This all works fantastic. However, I followed exactly the same logic creating consumption counters. I get the watts consumed from sensor.inverter1_load_watts
and sensor.inverter2_load_watts
. I then created a Riemann sum integral sensor with the Left
option to calculate kWh used on both these sensors, and then I again have:
sensor:
- platform: template
sensors:
total_power_consumption:
friendly_name: "Total Power Consumption"
unit_of_measurement: "kWh"
value_template: "{{ (states('sensor.my_inverter1_consumption_in_watts')|float) + (states('sensor.inverter2_consumption_in_watts') | float) }}"
Note here: I know the one sensor is named my_inverter1_consumption_in_watts
and the other just sensor.inverter2_consumption_in_watts
. That is because the initial sensor I created gave me weird values and I could net get rid of the historic values.
The problem: My production counters are running well and are updating constantly. My consumption counters just stay the same the whole time.
Measurements at 12:50:
Measurements at 12:52
I am sure that the watts reading on the MQTT is updating correctly, as I am pulling those values into Gauge card in a different dashboard, and they are changing with every reading.
So why would it not update the consumption like it is updating the production? Any ideas would make me a very grateful person.