Automation does not seem to work

I used to make a separate automation for every instance, then I thought I might be able to use ‘or’ to achieve the same result, for some reason it does not seem to trigger.
Don’t focus on the time set, it was only for testing.

  • id: ‘1761924213225’
    alias: LivingRoom Speaker should turn off
    description: ‘’
    triggers:
    • trigger: state
      entity_id:
      • media_player.living_room_speaker
        to: ‘off’
        for:
        hours: 0
        minutes: 0
        seconds: 15
        conditions:
    • condition: or
      conditions:
      • condition: state
        entity_id: media_player.living_room_speaker
        state: paused
        for:
        hours: 0
        minutes: 0
        seconds: 5
    • condition: or
      conditions:
      • condition: state
        entity_id: media_player.living_room_speaker
        state: idle
        for:
        hours: 0
        minutes: 0
        seconds: 30
        actions:
    • action: switch.turn_off
      metadata: {}
      data: {}
      target:
      device_id: 5e2947ba00202f1c68e3f8c233a7534d
      mode: single

Paste your code into a code block (the </> option in the editor header)

I don’t see how that automation could possibly work.

It triggers when the speaker is off for 15 seconds. But then it tests if the speaker was paused for 5 seconds (or idle for 30 seconds). It can’t be in a paused (or idle) state because it just triggered on being in an off state.

An automation’s conditions don’t wait for something to happen, they perform an immediate test (Do the entity’s current values comply with the test parameters, yes/no).

Assuming what you want is for the conditions to succeed if the speaker was EITHER off for 15 seconds OR paused for 5 seconds, it’s obvious even from the incorrectly formatted code that you’re just using the syntax for an OR condition incorrectly.

Once you correctly paste the code using </>, it will be very easy to show you how to use the correct syntax.

Thank you all for answering, I think I figured it out. It’s been a while since I used HA, not since the time we had to (more or less) use yaml scripts, so takes a while to get used to. But seems like under ‘When’ whatever I put under that is more like ‘or’ between each ‘trigger’. Will monitor to see if it works now. :slight_smile: