Start Halted Scripts

My automation below will run a “sunset” script unless either of two other scripts are running.

What I want to be able to do is automatically have that script run once the other has finished. So, for example, if “sunset” doesn’t run because “match time” is already running, when “match time” ends I want “sunset” to run.

I’m not sure how to accomplish this so would welcome some advice please.

- alias: Sunset Living Room
  trigger:
    platform: sun
    event: sunset
    offset: '-00:30:00'
  condition:
    condition: not
    conditions:
      - condition: state
        entity_id: script.match_time
        state: 'on'
      - condition: state
        entity_id: scene.dining
        state: 'on'
  action:
    - service: script.sunset_living_room

There are a couple of ways to do this.

  1. put another trigger in your automation for match time finishing, and add a sunset with offset condition.

Or

  1. put a sunset condition at the end of your match time script sequence and call the sunset script after that.
1 Like

Okay, thanks Tom. I’ll give those a try and see how I get on.

Thanks again.