You need a Switch item WakeUp. Set it to ON when the WakeUp light process should start. The following rule starts at lights off (0%) and it dims it up to 100%.
var Timer wakeUpTimer = null
var Number dimmer = 0
var Number dimmer_step = 1
rule "Wake-Up Light"
when Item WakeUp changed from OFF to ON
then
logInfo("WakeUp", "WakeUp started")
dimmer = 0
wakeUpTimer = createTimer(now.plusSeconds(1), [|
if(Lights_Bedroom_1_Level.state==100) {
logInfo("WakeUp", "WakeUp ended")
dimmer = 0
dimmer_step = 1
wakeUpTimer = null
sendCommand(WakeUp,OFF)
} else {
if(Lights_Bedroom_1_Level.state==10) {
dimmer_step = 10
sendCommand(Rollershutter_Bedroom, 96)
}
dimmer += dimmer_step
if(dimmer > 100) { dimmer = 100 }
sendCommand(Lights_Bedroom_1_Level, dimmer)
wakeUpTimer.reschedule(now.plusSeconds(60))
}
])
end
What does it do?
- Minute 1 - 10: increase the lights from 0% to 10% (+1% every minute)
- Minute 10: open rollershutter
- Minute 10-19: increase the lights from 10% to 100% (+10% every minute)
So, after 10 minutes, the rollershutter opens, after 19 minutes, the lights are at 100%.
I also added the following to my switch so I can abort the WakeUp light process if I want:
rule "Switch_Bed_1_PressShort"
when
Item Switch_Bed_1_PressShort changed from OFF to ON
then
if(wakeUpTimer !== null) {
logInfo("WakeUp", "WakeUp aborted")
wakeUpTimer.cancel
wakeUpTimer = null
sendCommand(WakeUp,OFF)
}
//... (here the normal things that the switch should do)