Averaging Temperature Sensor (present daily average)

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

Cool.

A few questions:

Have you thought about making the months you use to calculate warm and cool days configurable? This would make the plugin useful for people who don’ t live in the Netherlands that may stay warmer longer (if they get cold at all).

Are you considering sending this to the Apps store?

Sometimes the simple hacks are what works best for people.

Heating and cooling degree days are not a function of the date, but the temperature. Simply, they are the integral of the temperature curve over time, above or below the specified threshold. As such, they generally correlate well with energy used for heating or cooling, wherever you are in the world.

I’ve been logging heating degree days and energy used over the last couple of years, and the correlation coefficient is better than 0.9.

Heating and cooling degree days are not a function of the date, but the temperature. Simply, they are the integral of the temperature curve over time, above or below the specified threshold. As such, they generally correlate well with energy used for heating or cooling, wherever you are in the world.

I’ve been logging heating degree days and energy used over the last couple of years, and the correlation coefficient is better than 0.9.[/quote]

Hmm, thanks. I guess I was thinking more of hotter climates like where I lived for a while (Singapore). The temperature, for the most part, stays fairly constant throughout the year (hot and humid) with a monsoon (rainy) season (which is sometimes hard to tell, since there are days where it seems like it will rain every day for a set period).

Good point! Now the month determines the weighting factor I thought was widely used, but it might be specific to the netherlands indeed (sounds logical). I can make that configurable of course. Will look into that.

I sent the plugin to the apps store around the same time I opened this topic. It’s now pending approval.

It would be nice if this could be configured to allow monitoring of multiple temperatures and keep a separate average for each. I have multiple temp sensors in my house I would like to have this measurement for each. I would alos like to see a report of Min and Max temperatures.

Otherwise the app works well.

It should be possible to have multiple instances of the same plugin, this makes it possible to achieve your goal. (in vera UI5 in menu Apps ->click “My Apps” ->click “Averaging Temperature Sensor” ->click “Create another”)

I would alos like to see a report of Min and Max temperatures.

This has been implemented in version 1.1

Does anyone have examples of how you use this plugin?

I have tried to set the “parentid” to my honeywell thermostat, which is ID “108” but when I save and reload the plugin that was created just disappears. Does anyone have any ideas. I am using Vera3 with version 1.5.622 firmware.
Perhaps someone can show how they made this plugin work for there unit.
Thanks

If I understand well it displays average temperature as a current temperature.
Is it possible to have average and current temp from the watching temperature sensor on the device?

Just a part of Luup code, example (use of serviceId’s). Example with the Variable Container:

local GAShis1 = luup.variable_get(“urn:upnp-org:serviceId:VContainer1”, “Variable1”, 158)

[i]local GAShis = GAShis1

local GAS1 = luup.variable_get(“urn:brutgrink-com:serviceId:dutchSmartMeter”,“Gas”, 140) or “1”
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable5”, GAS1,158)

local Graaddag = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “degreeDaysHeat”,139)

local GraadGisterdag = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “yesterdaysDegreeDaysHeat”,139)

luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable4”, Graaddag,158)

luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable5”, GraadGisterdag,158)

luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable2”, GAS1,158)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable3”, GAS1-GAShis,158)[/i]

Great helper!

Do you have similar for humidity sensor. I tried to use this by just using humidity sensor ID, but that results wrong numbers although seems to work…

Hi.

Fist, I’m pretty new to Vera, so please, excuse if my questions are very basic.

How must I install this plugin?

I uploaded the three files with my Vera Edge’s with the “Develop apps/Luup files upload” option. Now, what should I do to create and setup the new devices? I tried with “Create device” but there isn’t any option related to this plugin. I tried but I can’t find it in any of the Vera pages.

I’m using UI7 1.7.1598

I’m completely lost :frowning:

Any help will be appreciated.

Finally I found it oin the Apps list. I installed it without issue and says it created device “# 158 Averaging Temperatur” but I can’t find it.

http://s25.postimg.org/nc5wk23lr/screenshot_65.png

If I click directly on the “# 158 Averaging Temperatur” link I can edit just the device name and the room but later there is nowhere.

Same issue, can’t find the “device” settings

For me too, device is not listed. Getting an error as I cannot configure it.
How to uninstall this? I’m getting errors constantly shown above the controlwindow

best regards

Olivier

I have did small modification and now it is working under UI7.

Install the original plugin, replace the files from attachment and reload engine.