There are few examples in community pages how to calculate degree days (DD) for heating, cooling etc. However, it seems that calculation (the official way) may vary by nation.
In Finland, degree days (called lämmitystarveluku S17, unit C°vrk) is outdoor temp difference to 17°C standard indoor temp and heating is supposed to be cut completely from beginning of the summer to early autumn, when S17 is always 0. Finnish Meteorological Institute page on subject https://www.ilmatieteenlaitos.fi/lammitystarveluvut
Below is one example how to calculate S17 using HA template sensor. This one is from split configuration template.yaml. Calculation is triggered slightly before midnight at 23:55. Sensor 1vrklampotila is average temp of current day. Obviously, you need source for outdoor temp, I’m using one from Nibe heat pump and you need to count average temp over whole 24h period. I use Limych average-HACS for counting average temp. There are other ways to calculate average, but this is easy one.
Please note, triggered sensors need to be at the end of template.yaml, after non-triggered sensors, otherwise this won’t work!
The process is then:
your outdoor temp sensor => average sensor => template sensor S17
- trigger:
- platform: time_pattern
hours: "23"
minutes: "55"
sensor:
- name: lammitystarvelukuS17 #virallinen lämmitystarveluvun laskenta Ilmatieteelaitoksen mukaan
unique_id: lammitystarvelukuS17
state: >
{% set temp_ave = states('sensor.1vrklampotila') | default(0) | float %}
{% if now().month <= 6 and states('sensor.1vrklampotila') | float >= 10 %}
0
{% elif now().month <= 6 and states('sensor.1vrklampotila') | float < 10 %}
{{ 17 - temp_ave }}
{% elif now().month >= 7 and states('sensor.1vrklampotila') | float >= 12 %}
0
{% else %}
{{ 17 - temp_ave }}
{% endif %}
unit_of_measurement: '°Cvrk'