Wait template - reaching state attributes

I want to install a wait_template, but I dont understand how to correctly reach the attributes of my entity:

- wait_template: "{{ (states.media_player.bjoerns_sound.attributes.media_position | int) = 0 }}"

Basically I want to achieve that next steps are taken once the media_position of bjoerns_sound is 0 again, as then the announcement is over.
This part of the following script:

bjoern_say:
  alias: TTS announcements for Bjoern
  sequence:
  - variables:
      currently_playing_bjoern: >-
        {{ is_state('media_player.bjoerns_sound', 'playing')  }}
      media_content_bjoern: >-
        {{ state_attr('media_player.bjoerns_sound', 'media_content_id') }}
      media_type_bjoern: >-
        {{ state_attr('media_player.bjoerns_sound', 'media_content_type') }}
  - service: tts.google_translate_say
    entity_id: media_player.bjoerns_sound
    data:
      message: "{{ bjoern_say }}"
      cache: false
  - wait_template: "{{ (states.media_player.bjoerns_sound.attributes.media_position | int) = 0 }}"
  - condition: template
    value_template: "{{ currently_playing_bjoern }}"
  - service: media_player.play_media
    entity_id: media_player.bjoerns_sound
    data:
      media_content_id: "{{ media_content_bjoern }}"
      media_content_type: "{{ media_type_bjoern }}"

I am really thankful for any advice!

Arg, I guess I have to use == when comparing stuff…

Correct. Use = for assignment and == for comparison.

Don’t feel bad, it’s a common mistake.

Thanks, and it looks like the idea I had works out :wink: