How to use LUUP code to enable or disable a scene?

Sorry for the newb question, but…
UI7 scenes can be either enabled or disabled in the GUI. Is there a way to do that programically?

For example, I have a scene that runs my thermostat in heat mode in the winter. When it is not winter, I would like the scene to be disabled.

How do I do this with code???

Please do read this thread on conditional scene execution http://forum.micasaverde.com/index.php/topic,18679.msg141954.html#msg141954

Searching the forum will also turn up lots of similar needs and solution.

Indeed, see previous link and code below.
Just copy paste this in your scene in the LUUP code part, at the beginning of the code. You only need to adjust your beginning and end period day / month.

local mdStart = "12/01" -- Start of period (Winter) (MM/DD) local mdEnd = "02/28" -- End of period (end of Winter) (MM/DD) local allow = true -- true runs scene during period, false blocks it local smS, sdS = string.match(mdStart,"(%d+)%/(%d+)") local smE, sdE = string.match(mdEnd,"(%d+)%/(%d+)") local mS = tonumber(smS) local dS = tonumber(sdS) local mE = tonumber(smE) local dE = tonumber(sdE) local tNow = os.date("*t") local mN = tNow.month local dN = tNow.day if (mE > mS) or ((mE == mS) and (dE >= dS)) then return (((mN > mS) or ((mN == mS) and (dN >= dS))) and ((mN < mE) or ((mN == mE) and (dN <= dE))) == allow) else return (((mN > mS) or ((mN == mS) and (dN >= dS))) or ((mN < mE) or ((mN == mE) and (dN <= dE))) == allow) end

you can add it in a scene

[code]local t = os.date(‘*t’)
local current_month = t.month * 1

if (current_month > 11) or (current_month < 3) then
return true
else
return false
end[/code]

or even…

local current_month = os.date('*t').month 
return current_month > 11 or current_month < 3