Using Capture, set then restore with multiple trigger events

I use a HUE bulb as a back light on my TV, also to notify me if a garage door is open.
Select Actions for Garage Door Open Notice
IF (Dimmer level of Den TV Backlight(25) is <= 35(T) [TRUE]) THEN
Capture: Den TV Backlight
Set color: Den TV Backlight ->Purple ->Level: 90
Wait for events: Garage Doors closed
Restore: Den TV Backlight
ELSE-IF (Dimmer level of Den TV Backlight(25) is > 36(F) [FALSE]) THEN
Wait for events: Garage Doors closed
Restore: Den TV Backlight
END-IF
The problem i am having if a second garage door opens, while I haven't closed the first, the restore command doesn't work. It stays at the high level, if it is just one door the first part of the rule works. What am I missing or is this not possible. Sorry for the sketchy explanation, it's really hard to put into words

Hello, and welcome to Hubitat!

The way you have the rule structured is the reason that is going to happen. There are several ways that the logic of your rule could be modified to make it work more consistently. Why don't you describe in words what you are trying to accomplish and we'll see if we can't get it sorted out.

I will give it a try. I set the TV back light at a low level for ambiance while watching TV. When a garage door opens, I use the rule to notify me of the door opening by changing color and raising the light level, and it stays that way until the door shuts, then it returns the light to the previous level. If a second door opens while the first door is still open it capture the high level, so when it restores, it restores the high level. What I was trying to do is only capture the setting if if was below a certain level, then return it to the low level. Make sense?

BTW, thanks for the welcome. Coming from Wink, prior to that Phast, if you remember that. It was a division of AMX designed for home. Didn't do very well. Went to school for a week in the early 90's to learn how to program that, what fun.

What you're really trying to do is capture once.

One solution: set the rule's Private Boolean to True when you do a capture, set it to False when you do a restore, and skip the capture if the PB is already True.

Something like this for the capture:

IF (Private Boolean is false) THEN 
    Set Private Boolean True
    Capture: Den TV Backlight
ENDIF

and then this for the restore:

Restore: Den TV Backlight
Set Private Boolean False

It does, but it's not going to work that way, unfortunately. This is what I would do.

Trigger:  Either door Contact Changes

Action: 

IF Either Contact is Open And PB is True And the Light is On THEN
     Set PB to False
     Capture the Lights State
     Set the light to the color you have selected.
ELSE IF (both contacts are closed and PB is False) THEN
     Restore Lights
     Set PB to True
END-IF

I think that is going to get you where you need to be.

Thanks Ryan780, that did work and I never would have got there without your help. JWJR thanks as well, I couldn't get that to work but I appreciate the input.
Really need to understand the END-IF function.

Thanks again.

Jeff

1 Like