Hi! I have alarm clock rule that based on android alarm clock setting:
var Timer timerAlarm = null
rule "Alarm Clock"
when
Item AlarmClock changed
then
if (AlarmClock.state as Number == 0) {
if (timerAlarm !== null) {
timerAlarm.cancel
timerAlarm = null
}
logInfo("alarm", "All alarms are cancelled")
} else {
var epoch = new DateTime((AlarmClock.state as Number).longValue)
logInfo("alarm", "Scheduling alarm for " + epoch.toString)
if (timerAlarm !== null) {
logInfo("alarm", "Reschedule alarm")
timerAlarm.reschedule(epoch)
} else {
logInfo("alarm", "New Alarm")
timerAlarm = createTimer(epoch,
[ k |
// Turn on stuff, e.g. radio or light if somebody at home
if(gPresent.state == ON){
GF_MasterBedroom_Light.sendCommand(ON)
}
logInfo("alarm", "alarm is expired")
]
)
}
}
end
i need to set my string item heatingMode from “SLEEP” to “NORMAL” 30 minutes before alarm clock, how i can do that in rule?