COP per run for Nefit / Bosch heatpump

Calculating the COP for a heat pump is easy; output power divided by the input power. But over which period do you calculate the COP? Over a day, week, month? All give a COP and all are different depending on outside temperatures etc.

While tuning the heat pump configuration I wanted to understand the impact on the COP between two runs, so below is the automation I use to calculate the COP per run.

How to install

  1. Create in \esphome\packages the file cop_per_run.yaml and copy this code into that yaml
  2. Ensure that in the configuration.yaml you have the following lines of code
  3. Restart home assistant
homeassistant:
  packages: !include_dir_named packages

Pre-requisites

  1. EMS-ESP gateway to read values from the heat pump, see LINK
  2. Device to measure the power consumption from the heat pump. I use LINK

Sensors being used

  • sensor.boiler_compressor_activity (or sensor.boiler_hpactivity)
    This EMS-ESP gateway sensor gives the state of the compressor. Values are none, heating, hot water and defrost

  • sensor.boiler_compressor_power_output
    This EMS-ESP gateway sensor gives the current power output of the compressor.

  • sensor.kwh_meter_3_phase_nnnn_total_power_import
    This kWh device sensor give the measured power consumption of the compressor.

How it works

  • um_heatpump_compressor_power_output
    The sensor.total_compressor_power_output is calculated by integrating the sensor.boiler_compressor_power_output. This sensor.total_compressor_power_output is then used in utility meter um_heatpump_compressor_power_output which gets reset to 0 each time the sensor.boiler_compressor_activity is changing state.

So at the end the um_heatpump_compressor_power_output contains the power output per compressor state; heating, hot water…

  • um_heatpump_power_input
    The um_heatpump_power_input is using the sensor.kwh_meter_3_phase_nnnn_total_power_import which gets reset to 0 each time the sensor.boiler_compressor_activity is changing state.

So at the end the um_heatpump_power_input contains the power input per compressor state; heating, hot water…

  • sensor.cop_run_heating, _hot_water and _defrost
    The COP is calculated by dividing the um_heatpump_compressor_power_output by the um_heatpump_power_input. The value is put to zero depending on the compressor activity
# Calculate the COP per run on a NEFIT / BOSCH heatpump 
#
#
# Calculating the COP for a heat pump is easy; output power divided by the input power. But over which period
# do you calculate the COP? Over a day, week, month? All give a COP and all are different depending on outside
# temperatures etc. While tuning the heat pump configuration I wanted to understand the impact on the COP between
# two runs, so below is the automation I use to calculate the COP per run.
#
# How to install
#
# 1. Create in \esphome\packages the file cop_per_run.yaml and copy this code into that yaml
# 2. Ensure that in the configuration.yaml you have the following lines of code
# 3. Restart home assistant
#
# homeassistant:
#   packages: !include_dir_named packages
#
#
# Pre-requisites
#
# 1. EMS-ESP gateway to read values from the heat pump, see [LINK](https://github.com/emsesp) 
# 2. Device to measure the power consumption from the heat pump. I use [LINK](https://www.homewizard.com/nl/shop/wi-fi-kwh-meter-3-fase/)
#
# Sensors being used
#
# * sensor.boiler_compressor_activity (or sensor.boiler_hpactivity)
#   This EMS-ESP gateway sensor gives the state of the compressor. Values are none, heating, hot water and defrost
#
# * sensor.boiler_compressor_power_output
#   This EMS-ESP gateway sensor gives the current power output of the compressor.
#
# * sensor.kwh_meter_3_phase_nnnn_total_power_import
#.  This kWh device sensor give the measured power consumption of the compressor.
#
# How it works
#
# * um_heatpump_compressor_power_output 
#   The sensor.total_compressor_power_output is calculated by integrating the sensor.boiler_compressor_power_output.
#   This sensor.total_compressor_power_output is then used in utility meter um_heatpump_compressor_power_output,
#   which gets reset to 0 each time the sensor.boiler_compressor_activity is changing state.
#   So at the end the um_heatpump_compressor_power_output contains the power output per compressor state; heating, hot water.
#
# * um_heatpump_power_input
#   The um_heatpump_power_input is using the sensor.kwh_meter_3_phase_nnnn_total_power_import which gets reset to 0 
#   each time the sensor.boiler_compressor_activity is changing state.
#   So at the end the um_heatpump_power_input contains the power input per compressor state; heating, hot water...
# 
# * sensor.cop_run_heating, _hot_water and _defrost
#   The COP is calculated by dividing the um_heatpump_compressor_power_output by the um_heatpump_power_input. 
#   The value is put to zero depending on the compressor activity


template:
  - sensor:
      - name: "COP run heating"
        unique_id: sensor.cop_run_heating
        unit_of_measurement: ""
        state: >
          {% set power_output = states('sensor.um_heatpump_compressor_power_output') | float %}
          {% set power_input = states('sensor.um_heatpump_power_input') | float %}
          
          {% if is_state('sensor.boiler_compressor_activity', 'heating') %}
            {{ (power_output / power_input) | round(2, default=0) }}
          {% else %}
            0
          {% endif %}
        availability: "{{ states('sensor.um_heatpump_compressor_power_output')|is_number and states('sensor.um_heatpump_power_input')|is_number }}"

      - name: "COP run hot water"
        unique_id: sensor.cop_run_hot_water
        unit_of_measurement: ""
        state: >
          {% set power_output = states('sensor.um_heatpump_compressor_power_output') | float %}
          {% set power_input = states('sensor.um_heatpump_power_input') | float %}
          
          {% if is_state('sensor.boiler_compressor_activity', 'hot water') %}
            {{ (power_output / power_input) | round(2, default=0) }}
          {% else %}
            0
          {% endif %}
        availability: "{{ states('sensor.um_heatpump_compressor_power_output')|is_number and states('sensor.um_heatpump_power_input')|is_number }}"

      - name: "COP run defrost"
        unique_id: sensor.cop_run_defrost
        unit_of_measurement: ""
        state: >
          {% set power_output = states('sensor.um_heatpump_compressor_power_output') | float %}
          {% set power_input = states('sensor.um_heatpump_power_input') | float %}
          
          {% if is_state('sensor.boiler_compressor_activity', 'defrost') %}
            {{ (power_output / power_input) | round(2, default=0) }}
          {% else %}
            0
          {% endif %}
        availability: "{{ states('sensor.um_heatpump_compressor_power_output')|is_number and states('sensor.um_heatpump_power_input')|is_number }}"


sensor:
  - platform: integration
    method: left  
    source: sensor.boiler_compressor_power_output
    name: "Total compressor power output"
    unit_time: h
    max_sub_interval:
      seconds: 10


utility_meter:
  um_heatpump_power_input:
    source: sensor.kwh_meter_3_phase_3c39e72c1bb8_total_power_import # change this to your sensor name
    cycle: yearly

  um_heatpump_compressor_power_output:
    source: sensor.total_compressor_power_output
    cycle: yearly


automation:
  - alias: Reset um_heatpump on changing state
    id: '1737400553341'
    description: 'Reset the um_heatpump_power_input and um_heatpump_compressor_power_output on changing compressor activity'
    triggers:
    - platform: state
      entity_id:
      - sensor.boiler_compressor_activity
    conditions: []
    action:
    - service: utility_meter.calibrate
      data:
        value: '0'
      target:
        entity_id:
        - sensor.um_heatpump_power_input
        - sensor.um_heatpump_compressor_power_output
    mode: single
1 Like