If failing to evaluate

I have an automation to detect sendspin player as playing and, if so, turn the speakers on else turn them off.

This code… which was written by the GUI… fails to evaluate true and I believe it’s because the GUI has inserted the time factor, because by the time it comes to evaluation, it would likely have already been playing for a second or two…

- if:
  - condition: media_player.is_playing
    target:
      entity_id: media_player.lounge_sendspin
    options:
      behavior: any
      for: '00:00:00'

I have to fall back to this code to make it work and I don’t understand why…

  - if:
      - condition: state
        entity_id: media_player.lounge_sendspin
        state: playing

Why do you need to ask AI to create a condition you can easily pick from the UI?

Because the condition picked from the UI doesn’t work. - And who mentioned anything about AI?

sorry my mistake.

No worries :slight_smile: … It looks like the UI is adding a time constraint by default, which doesn’t work in an If block, because it won’t be 0 by the time it’s evaluated.

Check the core and frontend repos for related bugs. If you find none, you probably need to log it. And my understanding of for: is that it would at least check for that duration, but it could be longer, so I don’t think the unnecessary addition should matter.