I’ve just got an Vera Edge, an Everspring socket control (for a small heater) and an Everspring temp/humidity sensor.
All seems to be connected ok but I am puzzled by the logic to create scenes to do what I want. This is a holiday home which I just want to warm up once in a while to keep humidity at bay.
I basically want a scene (or combination of scenes) to turn heater on if temp is below 15C and turn it off above 20, but only between 22:30pm and 7:30am, which are off peak time.
Is there any way to make a scene conditional on the time?
I found some Luup code that looks like it is what I needed. Is this the correct way to do this: setting a Luup condition to the On trigger?
local pStart = "22:45" -- Start of time period
local pEnd = "06:15" -- End of time period
local allow = true -- true runs scene during period, false blocks it
local hS, mS = string.match(pStart,"(%d+)%:(%d+)")
local mStart = (hS * 60) + mS
local hE, mE = string.match(pEnd,"(%d+)%:(%d+)")
local mEnd = (hE * 60) + mE
local tNow = os.date("*t")
local mNow = (tNow.hour * 60) + tNow.min
if mEnd >= mStart then
return (((mNow >= mStart) and (mNow <= mEnd)) == allow)
else
return (((mNow >= mStart) or (mNow <= mEnd)) == allow)
end
Best Home Automation shopping experience. Shop at Ezlo!