Rule to have F1 set siren on and then off if I press F1 again

vbdino

Member
I added a keypad in my room and I want to program F1 to turn all lights On and F2 to turn on the siren. When I press F1 again, I want to turn off all the lights. When I press F2 again I want to turn off the siren.
 
I created a task to associate it to F1. Then I created those two rules for testing:
 
WHENEVER ToggleSiren (Task 12) IS ACTIVATED
   AND SirenOnOff (Counter 7) IS NOT EQUAL TO 12
         THEN SET SirenOnOff (Counter 7) to 12
         THEN TURN Diner room[2 (A2)] ON
 
WHENEVER ToggleSiren (Task 12) IS ACTIVATED
    AND SirenOnOff (Counter 7) IS EQUAL TO 12
          THEN SET SirenOnOff (Counter 7) to 0
          THEN TURN Diner room[2 (A2)] OFF
 
I realize that both events are executed sequentially as the Light goes on and then off. I will surely figure it out but maybe someone is actually online and has a quick answer.
 
I figured it out by creating only one event for the task to toggle a counter. Then an event when the counter equals 1 and an event when the counter equals 0. I like it :)
 
Back
Top