Change a lighting effect based on when contact is closed and open

I have a Govee lamp and I am trying to use it to show when certain doors are open and closed.

I have a contact on each door that I use.
I have set up an If Then to set the effect to a certain style based on contact closing. Works great.

Issues

If light is on and set with effect 1 then contact closes and effect 2 activates. Good

When contact closes after x minutes I would like to go back to previous effect. ?????
I have the Wait command down but all I can manage is to turn light off.

This is what I have so far.

so setEffect(2710) is actually turning the light off? You should enable logging on the rule and also on the device (debug). Maybe that will tell us something.

Also, why is rule triggered at 5:08 PM? You said you want to trigger it on the contact opening? Or only at that specific time?

The wait for Expression, will trigger as soon as that expression is true, and will wait up to 30 seconds max. If the door is opened and quickly closed it would trigger as soon as it is closed. I dont think that is doing what you want either. You might want to use a wait for EVENT and use the "and stays" option to indicate it should wait for the door to close and stay that way for 30 seconds.

Thanks for. Your response.

Guess I should have looked at the rule closer, forgot the last state of testing I was doing.

Thanks, I did forget to mention that is just a test rule. The lamp will come on automatically a certain time.

No the set effect to 2710 is not turn it off, that is what I would like it to return too and contact is closed.

The timing I had in mind was
lamp is always on set to whatever effect that is set,
contact closes could be different doors with different effects,
and I want the effect to change to a certain one for like 2min or so.
That would make sure if someone was out of the room they would have a better chance of seeing it.

This is more or less a silent security thing if someone is home alone.

I hope that is more clear.

If you just want a delay, you can change the wait for expression to a delay

Light On <-- this may not even be needed, setEffect below should turn it on
setEffect(number)
Delay XX:XX
setEffect(number)

If you trigger than on the contact opening, the light would change effects for however long the delay is and then change back, and should stay on.

There is more advanced stuff you can do also, like capturing the current state of the light and then setting it back to that state afterwards, instead of hard coding a setting for it.

Thanks a lot. I will play some more tonight. This sounds good.

The change from Wait to delay did the trick. I now have 4 nested contact sensors with 4 different effects. No I need to learn how to do the state capture.

I think it should work like that, but just BTW there is an "ELSE-IF" option you can insert from within the menu.

The capture and restore is pretty easy, its in one of the action menus. Here is a little example I found basically doing the same thing you are trying to do:

And here is an example from one of my rules where I am setting the lights for my robot vac, then restoring them when its done.

I looked for the else-if but did not see it.

You might have to be inserting an action inside of an If block for it to show, but this is where it is.