Trigger automation only if current state was set by another automation

Hello!
Is there a way to realize this? ā†’
I have set up a automation which closes a cover, when a specific luminance is reached by a sensor.
So far so good. Now, how can i open this cover automatically again, when the luminance goes down to a specific value but only, if the cover has been closed by the first automation (and not manually)?

Best Regards!

this is asked a lot so you should be able to find a solution in the forums.

but generally you will need to create an input_boolean that gets turned on when using the first automation to close the cover. then use that input_boolean being on as a condition in the second automation to open the cover.

then in the second automation you will also turn off the boolean so it can get set the next time.

Thank you for the hint! Works as expected.
I searched the forums before asking, but it seems my english is not good enough to understand what i read :slight_smile:
Your answer hits the point, thanks!

1 Like

Just FYI
If the cover is smart, Iā€™d say you can see the state of the cover and use that as a condition for the automation or in the choose.

If the cover is not smart and if you use use two automations (one for open and one for close), you could add a condition that requires the opposite automation to be triggered before the current.

In other words, a template condition that says something like:

{{ state_attr("automation.cover_close", "last_triggered") > state_attr("automation.cover_open", "last_triggered") }}

This one should be added to the automation.cover_open automation