I have this sensor set up in my configuration.yml file:
# Calculates some values
template:
- sensor:
- name: "Daily COP hot water energy"
state: "{{ (states('sensor.hp_dailyhotwaterenergyproduced')|float / states('sensor.hp_dailyhotwaterenergyconsumed') |float ) |round(2) }}"
unit_of_measurement: COP
The problem is that sometimes the sensor value here can be 0 and thus as division by 0 is not possible, the sensor shown in my card in my dashboard shows unavailable.
Would it be possible to do something here so that the value becomes simply 0 instead for example?