Hi
I am trying to code a scene based on the examples given and it’s not working.
The intent is to run the scene every few minutes using an interval timer, set to 1 minute for testing and then probably 5 minutes when in service
This timer will compare the current temperature on a sensor with the upper trip level and, if it’s over it, turn an appliance switch off.
There will be a corresponding “opposite scene” to turn the heat back on when the temperature drops below the dead band.
The code is based on the example given here
virtually what I want, I need a timer that fires more often, no problem, I need to set it to my temperature sensor, again no problem.
The problem is that it does not work, the event fires whether or not the temperature is above or below the threshold set.
The code follows, about as simple as it can get, is there a problem with this specimen code or am I missing something??
local lul_temp = luup.variable_get(“urn:schemas-micasaverde-com:device:TemperatureSensor:1”, “CurrentTemperature”, 45)
if (tonumber(lul_temp) >7) then return false
end
I tried it with 2 different temperature sensors, the other version is
local lul_temp = luup.variable_get(“urn:schemas-micasaverde-com:device:TemperatureSensor:1”, “CurrentTemperature”, 52)
if (tonumber(lul_temp) <22.5) then return false
end
Can someone enlighten me where I am going wrong please??
Many thanks
Nick