Help with calculating heat pump COP

Hello,

I have below template sensor setup to calculate heat pump COP and it seems to work descent while unit is running but when it shuts off after run the COP amount returned is inaccurate due to btu out put no longer being valid.

{{ ((states('sensor.hvac_btu_output')|float)) / (states('sensor.heat_pump_power_usage')|round(2)* 3413)}}

The BTU is calucualted by:

{{ states('sensor.hvac_delta_t')|float(3) * (1.08) * (835) }}

Since the HVAC delta t takes a while to go back down to 0 after unit shuts off, this results in incorrect BTU and COP output. Any idea how to best set BTU output to 0 soon as heat pump is not running perhaps by using heat pump power draw data?

Why not calculate the COP only while the heat pump is running?

It helps if you share your full COP sensor configuration.

Indeed that is what I would like to do, have BTU be calculated only when ecobee is calling heat/cool and that should take care of COP as well. Right now for both I am just using the helper template sensor with the code posted.

template:
  - sensor:
      - name: COP
        state: >
          {% if is_state('climate.hvac', 'off' %}
            0
          {% else %}
            {{ ( states('sensor.hvac_btu_output')|float / (states('sensor.heat_pump_power_usage')|float * 3413) )|round(2) }}
          {% endif %}
1 Like

Thanks for the code, I got it semi working using below code:

  - sensor:
      - name: Heat Pump Coefficient Of Performance
        state: >
          {% set attributes = state_attr('climate.my_ecobee_4', 'equipment_running') %}
            {% if not 'heatPump' in attributes%}
              0
          {% else %}
            {{ ( states('sensor.hvac_btu_output')|float / (states('sensor.heat_pump_power_usage')|float * 3413) )|round(2) }}
          {% endif %}

The only issue is ecobee API is slow to update the status (5 minute delay) and in that time the reading is incorrect instead of reading 0.

What would I need to modify in the code to instead of using climate status to use power draw from sensor.heat_pump_energy_consumption to determine if COP should show as 0 (lets say if power draw is less than 0.02)? Or alternatively filter the output so it ignores any COP reading higher than 5?

template:
  - sensor:
      - name: COP
        state: >
          {% if states('sensor.heat_pump_energy_consumption')|float(0) < 0.02 %}
            0
          {% else %}
            {{ ( states('sensor.hvac_btu_output')|float / (states('sensor.heat_pump_power_usage')|float * 3413) )|round(2) }}
          {% endif %}

Thank you very much, seems to be working perfectly.