The Vera Community forums have moved!

Advanced => Programming => Scene Scripting => Topic started by: jchin on December 30, 2017, 01:19:30 pm

Title: reading temperature from Virtual Outdoor Temperature Plugin
Post by: jchin on December 30, 2017, 01:19:30 pm
I got 2 scenes working for my basement thermostat.
One to turn up the heat when someone turned on the light (after a delay).
One to turn down the heat when the lights are turned off (after a delay).
In both cases, I delay the LUUP code for 90 seconds before checking if the lights are still on or off.

What I'd like to do is change the temperature based on the outside temperature.
On colder days (sub-freezing), I'd like to set the temperature higher and on warmer days.
I have the Virtual Outdoor Temperature plugin installed but cannot seem to read the CurrentTemperature from it.
Can anyone help?
Title: Re: reading temperature from Virtual Outdoor Temperature Plugin
Post by: jchin on January 19, 2018, 11:11:10 pm
Anyone?  Am I the only one using the "Virtual Outdoor Temperature" plugin from the Vera plugin library?
Title: Re: reading temperature from Virtual Outdoor Temperature Plugin
Post by: jbonzey on January 20, 2018, 09:34:34 am
I don?t know about the virtual outdoor temp plugin but I recommend you look at the weather underground plugin.   I use it to trigger scenes utilizing weather conditions and it?s very stable
Title: Re: reading temperature from Virtual Outdoor Temperature Plugin
Post by: Don Phillips on January 20, 2018, 07:56:21 pm
 I second Weatherunderground. I use a weather station about 1 mile from my house to get better weather information, including cloud cover and precipitation. I use this to offset the sunrise/sunset time by 15 minutes for cloudy and 30 minutes for rain when turning on or off the exterior lights.
Title: Re: reading temperature from Virtual Outdoor Temperature Plugin
Post by: jchin on April 20, 2018, 12:31:04 pm
Got it working ... here is the code I used:

Code: [Select]
local THERMOSTAT = 16 -- deviceID for Thermostat
local TEMP = 72 -- temperature to set
local HEATOFF = 65 -- temperature to set when outside is warm
local VOTD = 23 -- deviceID of Virtual Outdoor Temp
local TEMPwarm = 55 -- temperature outside considered warm

local OutdoorTemp = tonumber((luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", VOTD)))
-- note the number of parentheses

if (OutdoorTemp < TEMPwarm) then
luup.call_action("urn:upnp-org:serviceId:TemperatureSetpoint1_Heat", "SetCurrentSetpoint", {NewCurrentSetpoint = TEMP}, THERMOSTAT)
else
luup.call_action("urn:upnp-org:serviceId:TemperatureSetpoint1_Heat", "SetCurrentSetpoint", {NewCurrentSetpoint = HEATOFF}, THERMOSTAT)
end