Temperature Average (TEMPAVG) Plugin v1.0

Plugin Name: Temperature Averaging (TEMPAVG) Plugin v1.0

* Now available in the Apps Store

This plugin has one purpose: to take the CurrentTemperature values from existing temperature sensors/devices using [tt]urn:upnp-org:serviceId:TemperatureSensor1[/tt], average it and display it in its own device.

Here are the variables that the plugin will expose after it initializes:

Devices = a list of Sensors that will be checked.

  • Format: Needs to be entered in the format of [sensor id#]=“name”
    Example:
71=NewYork,82=LosAngeles,96=Seattle,102=Boston

Refresh = number of seconds to wait between checking the temperature sensors. Default is set to 60 seconds (1 minute). Min = 60, Max = 86400. Anything set/passed outside the min/max range will be ignored, and the default of 60 will be used. Setting this to 0 will disable the automatic polling.

VerboseDebug = turn on/off additional log messages for debugging

0 = Off (default)
1 = On

Additionally, two untested functions are exposed:

ForcePoll = Allows for you to call the polling/checking option in your own scripts/scenes

RestartPolling = Allows you to change to interval for polling. Same rules apply as for setting Refresh variable. You can use this to start or stop polling in your own code/scenes.

Example:

luup.call_action("urn:tempavg-sensor-org:device:TEMPAVG_Sensor1", "RestartPolling",{ delay= 0 }, 66)

This code would turn off polling for your TEMPAVG device (assuming your plugin is device #66)

See attached files for the code.

Please let me know if you find any bugs.

Note: This plugin doesn’t care what format the temperature is in, it just averages out the values it fetches from the temperature sensors/devices defined in Devices. This means that, if any of your sensors/devices are using a mix of different temperature scales (i.e., Fahrenheit and Celsius), the average will be wrong.

Nice! Exactly what I was thinking about to build myself. Thanks for your effort!!

Thanks. I’m glad people are finding this useful.

Note:
I’ve submitted this to the apps store. If it gets approved, you will see it there.

Update: This is now available in the Apps Store.

Hi SOlivas,

Did you post your plugin under GPL?

I got an idea when I saw your plugin and used some of your code to build a (my first ever) plugin that averages a temp sensor to a daily average, including the calculation of heating/cooling degree days that can be used in energy consumption optimization projects.
Don’t really know how code things and reuse work, but just asking. If you don’t mind I might post it to the forum (and maybe the app store)

Kind Regards,
Arjen

Nope, BSD. GPL is too restrictive of a license.

This plugin looked interesting, I have sever multisensors and wanted to get the average outdoor temp, however after installing the plugin I get a lua startup error on the device. Also in the message area I get “Temperature Average Plugin : No Devices configured!”

Any ideas?

@dbmccallum,
You will need to go into the settings for the plugin and define the Devices variable using the information in the first post as a guide.

Once the plugin has the Devices variable defined, it will stop giving the error and work properly.

I would add my devices if I could, there are no fields on my setting tab

I am still getting “lua startup failed”, is there a way to manually put the info on the advanced tab?

It’s in the advanced tab at the very bottom. I just installed this plugin and was able to add the devices. Still waiting to see a # show up, but it did make the error go away.

Is the device created meant to display the average? I have the following in my device line:

21=UpStairs,32=Bathroom1

It seems to initialize, but don’t get an average. Any thoughts?

Great work!
Can you do the same for Humidity sensor?
Or make the URN configurable to make it average almost anything?

Hi SOLivas,
I have installed it on VeraPlus, but the ‘Settings’ button does not appear.
The green bar is completly empty.
Thanks for looking at that.

…hmmm not showing the “Setting” button…not working under UI7

Maybe set the variables under “Advanced”?

Hi,

I have did small modification and now it is working correctly under IU7. Tabs are visible and there a possibility to configure real temp sensor DeviceID.

Just install the original plugin and replace the files from attachment and reload engine

I installed two of these devices on my old (now dead) Vera Lite on UI5 and both worked well.
Now that I have a Vera Plus on UI7 I have managed to install one device and get it working, but there is no option to create another device. Anyone know how to create a second device?

Thanks

I do not have that plug-in but generally in IU 7, this is where you add another device:

Thanks for the reply Don.

Yes, that?s where I was expecting to find I?d it too, but unfortunately it?s not showing the create another device button.

I?m now thinking of doing it differently and have PLEG calculate the average temperature and then display it on the dashboard somehow. I know I can use the export option in PLEG, but have you any thoughts on how I get it from PLEG to a dedicated display on the dashboard. I was hoping to create a temperature device on the dashboard and then display PLEG?s calculated value in it. Hopefully this is possible, but I?m not sure how to achieve it.

Thanks for any suggestions