Hello,
I have an issue with my energy calculations. In my house I have a heatpump that reports is consumption and a sensor that reports the total consumption for the entire house. I also have some other devices that report consumption and with this I want to display them individually.
So I created a template that takes the total energy and subtracts all the other devices consumption, the issue is that my heatpump reports what looks like a step-curve. Not each kwh or each hour is reported its kind of random. This makes my template sensor report too high numbers and then be corrected each time the heatpump decides to deliver some measurement. I have checked the manufacture app for the heatpump and that looks the same, unfortunately. So increased polling would not have any affect. I wonder if there is a way to “smoothen” the sensor of the heatpump in a meaningful way?
Here is a screenshot of my sensor.
Orange is total power (reported with 2 decimals every change)
Brown is the heatpump (not reported every hour)
Blue is calculated template sensor (the drops are visible each time the heatpump reports)
My template:
template:
sensor:
- name: "Other consumption"
unique_id: "other_consumption"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: >
{% set A = states("sensor.daily_accumulated_consumption") | float %}
{% set B = states("sensor.daily_elbil") | float %}
{% set C = states("sensor.daily_heatpump") | float %}
{% set D = states("sensor.daily_heatpump_water") | float %}
{% set E = states("sensor.daily_computer") | float %}
{% set F = states("sensor.daily_tv") | float %}
{{ (( 0 + A - (B + C + D + E + F) )) | round(2) }}
The daily_X means I put a daily cycle on each sensor before the calculation.