Doorbell Light Change Notifications

I'm trying to set up a rule that, when the doorbell sensor triggers manipulate some lights. I want to capture their current status, change the color to green, and then restore their previous status.

The problem I'm having is the restore part. It changes the color to green then nothing else seems to run. The light stays on and is green.

The rule I've created is:

IF (Livingroom Lamp RGB(off) is on(F) [FALSE]) THEN
Set wasOn to true
ELSE
Set wasOn to false
On: Livingroom Lamp RGB --> delayed: 0:00:00.5
Color Temperature: Livingroom Lamp RGB: 6500: 100
Delay 0:00:02
Capture: Livingroom Lamp RGB --> delayed: 0:00:05
END-IF
Set color: Livingroom Lamp RGB ->Green ->Level: 100
Delay 0:00:03
Restore: Livingroom Lamp RGB --> delayed: 0:00:05
Delay 0:00:05
IF (( Variable wasOn(false) = false(T)
) [TRUE]) THEN
Off: Livingroom Lamp RGB
END-IF

The logs after running the above code (while the light is on) is:

app:1092021-03-31 06:13:02.977 pm infoAction: END-IF

app:1092021-03-31 06:13:02.964 pm infoAction: Off: Livingroom Lamp RGB

app:1092021-03-31 06:13:02.959 pm infoAction: IF (( Variable wasOn(false) = false(T) ) [TRUE]) THEN

app:1092021-03-31 06:13:02.892 pm infoDelay Over: Delay 0:00:05

app:1092021-03-31 06:13:02.881 pm infoDelay Over: Restore: Livingroom Lamp RGB --> delayed: 0:00:05

app:1092021-03-31 06:12:59.642 pm infoDelay Over: Capture: Livingroom Lamp RGB --> delayed: 0:00:05

app:1092021-03-31 06:12:57.779 pm infoAction: Delay 0:00:05

app:1092021-03-31 06:12:57.761 pm infoAction: Restore: Livingroom Lamp RGB --> delayed: 0:00:05

app:1092021-03-31 06:12:57.736 pm infoDelay Over: Delay 0:00:03

app:1092021-03-31 06:12:54.577 pm infoAction: Delay 0:00:03

app:1092021-03-31 06:12:54.557 pm infoAction: Set color: Livingroom Lamp RGB ->Green ->Level: 100

app:1092021-03-31 06:12:54.538 pm infoAction: Capture: Livingroom Lamp RGB --> delayed: 0:00:05

app:1092021-03-31 06:12:54.533 pm infoAction: END-IF

app:1092021-03-31 06:12:54.507 pm infoDelay Over: Delay 0:00:02

app:1092021-03-31 06:12:53.038 pm infoDelay Over: On: Livingroom Lamp RGB --> delayed: 0:00:00.5

app:1092021-03-31 06:12:52.425 pm infoAction: Delay 0:00:02

app:1092021-03-31 06:12:52.389 pm infoAction: Color Temperature: Livingroom Lamp RGB: 6500: 100

app:1092021-03-31 06:12:52.370 pm infoAction: On: Livingroom Lamp RGB --> delayed: 0:00:00.5

app:1092021-03-31 06:12:52.346 pm infoAction: Set wasOn to false

app:1092021-03-31 06:12:52.342 pm infoAction: ELSE (do actions)

app:1092021-03-31 06:12:52.337 pm infoAction: Set wasOn to true (skipped)

app:1092021-03-31 06:12:52.331 pm infoAction: IF (Livingroom Lamp RGB(off) is on(F) [FALSE]) THEN (skipping)

Any insight would be appreciated

What are the triggers for the rule? People are often tripped up when they don’t consider that a new instance of the rule starts running each time a trigger occurs, and that can cause multiple process threads concurrently running the rule.

why are you delaying the capture and restore? if you look at your logs, it turns the light green (06:12:54.557), then captures the state (06:12:59.642).

i would remove the 5 sec delay from the capture and restore and try it again

Thanks for catching that, it was indeed the issue. I had it in my head that the delay was like a pause after the event ran, not a delay before running the event. I wasn't paying enough attention to the timestamps and just saw the event running successfully.