Way to if trigger becomes untrue then actions stop

Hi. Is there a way to have an automation’s actions stop if any if the automation’s triggers becomes untrue?

There maybe a different way to achieve this but im still learning.

Thank you!

once the trigger is true it’s not reevaluated. so either you need to check it within the run of the automation or create another automation that triggers on the negative of the trigger and disable this one with the flag of aborting the run.

service: automation.turn_off
target:
  entity_id: automation.wait_test
data:
  stop_actions: true

then turn back on

service: automation.turn_on
target:
  entity_id:
    - automation.wait_test
data: {}

1 Like

This sounds like a classic x-y problem. https://xyproblem.info/

Why do you want to do this?

It is not something you should normally need to do.

Please explain the problem you are trying to solve, not the way you are trying to solve it.

1 Like

Hi @tom_l .

What I am trying to do is…

Beginning at sunset play an audio file (it is just a 10 second audio), then that audio repeat again every 20 minutes, but for that to stop if a specific devices RGB color becomes 255,230,209.

Does that help?

Thank you.

That is

  • either a second trigger in your automation
    or
  • a second automation

You could also create a binary sensor that is true if a specific devices RGB color becomes 255,230,209,
and use that in your automation

Many ways to solve this problem :slight_smile: