Hi,
thanks for this code! I have tried to implement it on my side.
The only downfall is that the data I get from the sensor sensor.heat_pump_electric_energy_cop_helper
is only generated once a day, at the end of that day.
So I am basically able to check the COP from the previous day.
This is what I’ve done now:
#COP Helper sensors
- platform: statistics
name: "Heating Energy COP Helper"
entity_id: sensor.shelly_pro3em_total_active_energy
state_characteristic: change
max_age:
hours: 24
sampling_size: 100
precision: 2
- platform: statistics
name: "Heat Pump Electric Energy COP Helper"
entity_id: sensor.heat_pump_dailyheatingenergyproduced
state_characteristic: change
max_age:
hours: 24
sampling_size: 100
precision: 2
#Current COP
- platform: template
sensors:
heating_cop_current:
friendly_name: 'Current Heating COP'
value_template: >
{% set q = states('sensor.heat_pump_electric_energy_cop_helper') | float %}
{% set w = states('sensor.heating_energy_cop_helper') | float %}
{% if q >= 0 and w > 0 %}
{{ (q / w) | round(2) }}
{% else %}
0
{% endif %}
I do get a COP of 1,89 because the sensors look back 24 hours, so I get the value from the day before last day as well. So can I change max_age to ‘the previous day’ ?