1. Help Center
2. Reference
3. Calculated Properties

# Calculating Degree Days

## Temperature sensors can be a quick, easy way to understand your energy bills

The energy-consumption of most buildings is dominated by heating and cooling. When the outside air temperature is uncomfortably cold or hot, energy is used by a furnace or aircon to create a temperature difference between the inside and outside. Poor insulation and open doors and windows then "leak heat", tending to restore the temperature difference to zero. Therefore we can use that temperature difference to estimate the energy use.

For two buildings of a similar surface area, the power required to maintain that difference is proprtional to the temperature difference. Therefore the energy used over time (i.e. the size of your energy bill) is proportional to the integral of that temperature difference over time, which we can calculate with this CP:

degree days:

`(internalTemp - externalTemp) /((\$time/internalTemp - \$previous/\$time/internalTemp) / (1000 * 60 * 60 * 24))`

All those numbers turn milliseconds into days, since "degree-days" is the commonly-used unit.

The above is accurate only if each temperature value is the average temperature since the previous value. Since temperature sensors generally report instantaneous temperature, we need to average the previous difference and the current difference:

degree days (improved):

`((internalTemp + \$previous/internalTemp)/2 - (externalTemp + \$previous/externalTemp)/2 ) /((\$time/temperature - \$previous/\$time/temperature) / (1000 * 60 * 60 * 24))`

Note: If your external and internal temperatures are reported by different sensors, or perhaps you have multiple internal or external temperature sensors, then Calculated Properties alone cannot calculated degree-days, because they can only operate within a single stream.  In this case you need to join streams by some other property, a DevicePilot feature which (as of October 2019) is in private alpha.