This custom integration calculates Heating Degree Days (HDD) and Cooling Degree Days (CDD) based on outdoor temperature measurements. Degree days are measurements designed to quantify the demand for energy needed to heat or cool a building.
Heating degree days are a measure of how much (in degrees) and for how long (in days) the outside air temperature was below a certain base temperature. They are commonly used in calculations relating to the energy consumption required to heat buildings.
For example, if you set a base temperature of 19°C (66.2°F):
- If the average temperature for a day is 14°C, that day has 5 heating degree days
- If the average temperature is above the base temperature, that day has 0 heating degree days
Cooling degree days are the opposite of heating degree days - they measure how much and for how long the outside air temperature was above a certain base temperature. They are used to estimate energy consumption for cooling buildings.
For example, if you set a base temperature of 21°C (69.8°F):
- If the average temperature for a day is 26°C, that day has 5 cooling degree days
- If the average temperature is below the base temperature, that day has 0 cooling degree days
This integration uses a numerical integration method for calculating degree days:
- Detailed temperature readings are collected throughout the day
- For each time interval, the duration and temperature difference from the base temperature are calculated
- The temperature difference is weighted by the duration
- All intervals are summed to get the total degree days
This method provides more accurate results than simple daily averages, especially when temperature fluctuates significantly throughout the day.
- Open HACS
- Click on "Custom Repositories"
- Add this repository URL
- Select "Integration" as the category
- Click "Install"
- Copy the
heating_cooling_degree_days
folder fromcustom_components
to your Home Assistant'scustom_components
directory - Restart Home Assistant
- Go to Settings -> Devices & Services
- Click the "+ ADD INTEGRATION" button
- Search for "Heating & Cooling Degree Days"
- Configure:
- Select your outdoor temperature sensor
- Set the base temperature
- Choose your preferred temperature unit (Celsius or Fahrenheit)
- Enable/disable Cooling Degree Days calculation
- Choose whether to include weekly and monthly sensors
- Calculates daily, weekly, and monthly heating degree days (HDD)
- Optional calculation of cooling degree days (CDD)
- Configurable base temperature
- Support for both Celsius and Fahrenheit with appropriate units (°C·d or °F·d)
- Uses full temperature history with numerical integration for accurate calculations
- Flexibility to enable only the sensors you need (daily, weekly, monthly)
- Provides additional attributes:
- Base temperature
- Date range for the calculation
- Mean temperature for the period (for daily sensors)
The integration creates the following sensors depending on your configuration:
sensor.hdd_daily
: HDD for the previous daysensor.hdd_weekly
: HDD for the current week (optional)sensor.hdd_monthly
: HDD for the current month (optional)
sensor.cdd_daily
: CDD for the previous daysensor.cdd_weekly
: CDD for the current week (optional)sensor.cdd_monthly
: CDD for the current month (optional)
- Daily: Represents the previous completed day
- Weekly: Represents the current week from Monday to Sunday
- Monthly: Represents the current month from 1st to last day
Degree days can be used to:
- Monitor heating and cooling energy requirements
- Compare energy usage between different periods
- Normalize energy consumption data
- Predict energy costs
- Calculate climate statistics
- Evaluate building energy efficiency
Feel free to submit issues and pull requests for improvements.
This project is licensed under the MIT License - see the LICENSE file for details.