I added these sensors and it works great!
# Calculates some values
template:
- sensor:
- name: "Daily COP heat energy"
state: "{{ (states('sensor.hp_dailyheatingenergyproduced')|float / states('sensor.hp_dailyheatingenergyconsumed') |float )}}"
unit_of_measurement: COP
device_class: energy
- sensor:
- name: "Daily COP hot water energy"
state: "{{ (states('sensor.hp_dhw_out')|float / states('sensor.hp_dhw_in') |float )}}"
unit_of_measurement: COP
device_class: energy
But, when the calculation is done above all decimals are shown. How can I truncate the value to only 2 decimals?