Is there a way to trigger an automation at a specific time after an event happens?

So I have an automation that dims my backyard lights at 11 PM daily. I also have another automation that turns of my pergola lights (subset of the backyard lights) when something is playing on my outdoor TV and then turns it back on when playing stops at a higher brightness.

For the 11 PM automation, it only executes if the TV is not playing.

I was wondering if there is a way I can configure that automation to execute once the TV stops playing but only if the TV is playing, otherwise execute immediately.

Yes, just add an Automation , select Entity> State so that it ensures the state of the media player meets your power state and time criteria

Understand there are multiple methods to accomplish this. Everything can be consolidated into one Automation, but I prefer isolating Actions to keep Automation simple.

This example below references triggering an Automation, but I’d suggest using a scripts for the actions.

triggers:
  - trigger: state
    entity_id:
      - media_player.tv
    from: playing
    to: "off"
conditions:
  - condition: time
    after: "23:00:00"
actions:
  - action: automation.turn_on
    metadata: {}
    data: {}

You’ll have to look at the Media Player state in Developer Tools and edit that in the Automation

Some players show Off, some show Idle

1 Like