Does anybody have an Idea, how i can create the following case?
Every morning from monday to friday lights in the corridor (Flur_1 and Flur_2) should turn on automatically, as soon as it’s 6:00 am or an employee is there before (Mitarbeiter_WIFI changed to ON).
rule "Flur ON"
when
Time cron "0 0 6 ? * MON,TUE,WED,THU,FRI *" or
Item Mitarbeiter_WIFI changed to ON
then
Flur_1.postUpdate(ON)
Flur_2.postUpdate(ON)
end
But then everytime Mitarbeiter_WIFI changed to ON lights in the corridor turn on.
The goal is that lights in the corridor only turn on when it’s 6:30 am, or the FIRST employee is registered as ON BEFORE 6:30
var Flur = OFF
rule "Flur ON"
when
Time cron "0 30 6 ? * MON,TUE,WED,THU,FRI *" or
Item Mitarbeiter_WIFI changed to ON
then
Flur_1.sendCommand(ON)
Flur_2.SendCommand(ON)
Flur = ON
end
rule "Flur OFF"
when
Time cron "0 0 0 ? * MON,TUE,WED,THU,FRI *" or
then
Flur = OFF
end
rule "after 6 am weekday"
when
Time cron "0 0 6 ? * MON,TUE,WED,THU,FRI *"
then
After6am.postUpdate(ON)
Flur_1.sendCommand(ON)
Flur_2.sendCommand(ON)
end
rule "reset time flag"
Time cron ""0 59 23 ? * MON,TUE,WED,THU,FRI *"
then
After6am.postUpdate(OFF)
end
rule "Employee arrive"
when
Item Mitarbeiter_WIFI changed to ON
then
if (After6am.state == OFF) {
Flur_1.sendCommand(ON)
Flur_2.sendCommand(ON)
}
end