Need help to a lua code sommer scene

Hallo

i have created a set of scene that is aktivitet i the summer that include closing of my curtains in the day time, only problem is that when you live i denmark, it can be 30 degrees one week and 18 next week. Then i would be cool if the summer scene are not aktivitet. I was thinking that i could yous my everspring thermostat to activate or deactivate, the virtual plug that controls all the sommer sceens. something like every day at 11.30,aks my thermostat what temperature it is and under 22 return aktiv and over 22 return false
sins i have no idea how to code lua i was hoping someone could help my.
Tanks

Hello,

This code gets the temperature from a thermostat and if the temperature is over 22 degrees it doesn’t allow the scene to run, otherwise it runs the scene. Of course, this code goes into the Luup code box of the scene.

Parameters:

[ul][li]THERMOSTAT_ID: this is the device number of the thermostat. Get this from the Settings or Advanced tab in the device control panel, it’s the first line.[/li]
[li]THRESHOLD: this is the temperature threshold[/li][/ul]

[code]local THERMOSTAT_ID = 10
local THRESHOLD = 22

local temperature = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, THERMOSTAT_ID)
temperature = tonumber(temperature, 10) or 0
if (temperature > THRESHOLD) then
return false
end

return true[/code]

hallo

can it be done the other way? so if temp is under 22 aktive scene. so i can use it in times when it is cooler than 22 degrees… :slight_smile:

thanks

yes, just replace the
temperature > THRESHOLD
with
temperature < THRESHOLD