Track your degree days using HA and benchmark your gas consumption

hi, nice and simple idea, thanks!
I want to use this for monitoring a heatpump, so I replace gas_consumption with the heatpump’s energy consumption in kWh and made the utility sensor with that.
I don’t want to use the target temperature average sensor, so replaced that by 18.
Now I’m wondering, don’t you want to use that daily consumption sensor to be divided by the daily degree days? In your code I now see the general sensor.gas_consumption. And the daily value seems to remain unused.
Maybe that’s why some people here got high wrong values?
Not that I know much about coding. I share it here anyway, since there are also a few syntax changes without which I couldn’t get it to be valid. I will be able to tell if it makes more sense after midnight :smiley:

 # Calculate the average outdoor temperature, restart on midnight. You could also use a weather integration
sensor:
  - platform: average
    name: average_daily_outdoor_temp
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'
    entities: sensor.boiler_outside_temperature
  # Calculate the Degree Days, this
  - platform: template
    sensors:
      degree_day_daily:
        friendly_name: "Degree day daily"
        unit_of_measurement: 'DD'
        value_template: >
            {{ (18 - states('sensor.average_daily_outdoor_temp')|float) | round(2) }}
           
# Track daily gas consumption into a sensor
utility_meter:
  daily_energy_consumed_heating:
    name: daily energy consumed heating
    source: sensor.boiler_energy_consumption_compressor_heating
    cycle: daily  
# Now create a template which triggers at the end of each day
template:
 - trigger:
    - platform: time_pattern
      # This will update every night
      hours: 23
      minutes: 59
      seconds: 58
   sensor:
    - name: energy heating per degree day daily
      unit_of_measurement: "kWh/DD"
      state: >
        {% if (states('sensor.degree_day_daily')|float <= 1) %}
        0
        {% else %}
        {{ (0, states('sensor.daily_energy_consumed_heating')|float / states('sensor.degree_day_daily')|float) | max | round(2) }}
        {% endif %}   
1 Like