Blueprint Sonos Announce

I wanted to use the sonos anounce feature:


  - service: media_player.play_media
    data:
      media_content_id: media-source://tts/cloud?message="Playing the latest episode of !input tts"
      media_content_type: music
      announce: true
      extra:
        volume: 20
    target:
      entity_id: media_player.sonos_stue

But setting a text in blueprint still just have tts saying «!input tittel» How do i get it to say the inputed title?

We need to see the whole blueprint.

The blueprint:

blueprint:
  name: Søk opp serie i Plex
  description: Søk opp serie i Plex
  domain: script
  author: Vintage89
  input:
    tts:
      name: Tittel for TTS
      selector:
        text:
mode: single

sequence:
  - service: media_player.play_media
    data:
      media_content_id: media-source://tts/cloud?message="Playing the latest episode of !input tts"
      media_content_type: music
      announce: true
      extra:
        volume: 20
    target:
      entity_id: media_player.sonos_stue

I found a work around by storing the tts text in a input_text:

blueprint:
  name: Søk opp serie i Plex
  description: Søk opp serie i Plex
  domain: script
  author: Vintage89
  input:
    tts:
      name: Tittel for TTS
      selector:
        text:
mode: single

sequence:
  - service: input_text.set_value
    data:
      value: !input tts
    target:
      entity_id: input_text.tts_seroe
  - service: media_player.play_media
    target:
      entity_id: media_player.sonos_stue
    data:
      announce: true
      media_content_id: >
        media-source://tts/cloud?message=Playing+the+latest+episode+of+{{states.input_text.tts_seroe.state }}.&language=en-GB&voice=SoniaNeural
      media_content_type: "music"
      extra:
        volume: 30

OK,I see what you ran into.
If you want to do this without adding a helper, you can use a varuable. !inputs do not exist inside templates so you have to pull the value into avariable to use the !inputs there.

...
variables:
    # Pull in the tts input value to a variable
  _tts: !input tts

sequence:
  - service: media_player.play_media
    target:
      entity_id: media_player.sonos_stue
    data:
      announce: true
      media_content_id: >
        media-source://tts/cloud?message=Playing+the+latest+episode+of+{{ _tts }}.&language=en-GB&voice=SoniaNeural
      media_content_type: "music"
      extra:
        volume: 30

Script Syntax - Home Assistant.

Nice, Thank you!

Allways nice to not need an extra helper :slight_smile:

Just added this to our cookbook.
Thanks for the prompt…
Blueprints: Get your !input value into a template.

The Home Assistant Cookbook - Index.