Just a small thing I made for own use, might be useful for somebody else.
This plugin calculates a daily average of a specified temperature sensor. It also calculates (weighted) degree days values for heating and cooling, these are often used in energy optimization projects. Furthermore it stores a daily high and low temperature.
If the day changes, yesterdays averages and other values are stored in separate variables so that they can be used or exported.
The code of version 1.1 is attached and free to use and modify, please let me know if you find this useful, have any questions or find any bugs.
Version 1.0:
- Initial release
Version 1.1 changes (submitted for approval 22-nov-2013):
- Weighting factors for calculation of degree days are now configurable.
- New variables added for tracking daily high and daily low temperatures.
[hr]
Variables Plugin:
TempSensorDevID
Device ID of the temperature sensor that you would like an daily average of (ie. 121)
Refresh
Poll timer of the temperature sensor. Standard (and minimal) value 60 seconds. Valid values between 60 and 7200. Value 0 disables refresh.
[hr]
Variables Child device:
CurrentTemperature
Last calculated average (rounded to one decimal)
new DailyHigh
Highest temperature value recorded today
new DailyLow
Lowest temperature value recorded today
degreeDaysHeatReferenceTemp
Reference temperature for calculation of heating degree days. Often 18 degrees is used (and this is the standard value) but it is also possible to use an other value or Fahrenheit.
new degreeDaysHeatWeightingFactor
Weighting factor for degree days calculation. If left untouched or if a month is not configured it defaults to 1.0
For example: [tt]1=1.1,2=1.1,4=0.8,5=0.8,6=0.8,7=0.8,8=0.8,9=0.8,11=1.1,12=1.1[/tt]
This string gives the weighting factors of plugin version 1.0 and configures the weighting factors as follows:
Nov, Dec, Jan, Feb => 1.1
Apr, Jun, Jul, Aug, Sep => 0.8
Mar, Oct are not specified so their weighting factor will default to 1.0
degreeDaysCoolReferenceTemp
Same as degreeDaysHeatReferenceTemp but then for cooling. 22 degrees is standard value.
new degreeDaysCoolWeightingFactor
Same as degreeDaysHeatWeightingFactor but then for cooling.
yesterdaysAverage
new yesterdaysHigh
new yesterdaysLow
yesterdaysDegreeDaysHeat
yesterdaysDegreeDaysCool
Five variables that store yesterdays day average