Convert a platform trigger to a condition

Hi All,

I have some platform triggers that i want convert to a condition. For example:

    - platform: state
      entity_id: media_player.woonkamer
      to: 
        - "standby"
        - "idle"
        - "paused"
      for: "00:00:05"
      id: appletv_standby

I know the condition without the ‘for’ but how do i manage this with the ‘for’?
The ‘id’ part will be useless then.

Based on the examples shown in the documentation for State Condition, this should work:

condition:
  - condition: state
    entity_id: media_player.woonkamer
    state:
      - "standby"
      - "idle"
      - "paused"
    for: "00:00:05"

offcource… i was so blind on this. Thanks… haha

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

Did that. Do it always but somethings not directly :slight_smile:

1 Like

There is still an error. I want use them in a “choose” and then this must be the lines:

 - conditions:
     - condition: state
       entity_id: media_player.woonkamer
       state:
         - "playing"
       for: "00:00:05"

Without the “for” everything is ok. I need the 5 seconds delay…

I now solved it with this:

sequence:
  - wait_template: "{{ not is_state('media_player.woonkamer', 'playing')}}"
    timeout: "00:00:05"
    continue_on_timeout: true