Skip to content

Instantly share code, notes, and snippets.

rule "Initialize light states"
when
System started
then
Lights?.members.forEach(light|
light.postUpdate(if(Math::random > 0.7) ON else OFF)
)
end
rule "Turn light on"
when
Item Door changed to OPEN
then
postUpdate(Light, ON)
end