Sonos Say sensor_state


I’m using the Sonos Say script found here ( to say a welcome message when the alarm is disabled. But I want to add the name of the person who disables the alarm in the message. I’ve created a sensor for the person who disables the alarm: sensor.evohome_security_who . What’s the correct syntax for integrating a state?

delay: '00:00:05'
message: 'Welkom, {{states.sensor.evohome_security_who}}'
sonos_entity: 'media_player.batcave, media_player.badkamer'
volume: 0.5

The above doesn’t work.


Try replacing ‘message:’ with ‘message_template:’.

Thanks for the suggestion. I tried it. But it doesn’t work.

Leave ‘message:’ as is and replace ‘data:’ with ‘data_template:’.

This template syntax is required when using Jinja code.

Nope, It won’t say anything this way.

Could you post the complete script or automation you ate using?

Hello Robert,
Maybe you can Help me with this issue?
I set up the sonos say script with the followed settings:

Copy to clipboard

  - platform: google_translate
    language: 'de'
    #cache: true
    #cache_dir: /tmp/tts
    service_name: google_translate_say
    base_url: nabucasalink

And created a automation with the following settings:

Copy to clipboard

delay: '00:00:05'
message: Test
sonos_entity: media_player.buro
volume: 0.5

If i now start the automation, the file is written to \config\tts and i can open it on PC with sound.
But on sonos i cannot hear anything.
If i look on the android sonos app, there appears no failure.
Can anyone help me out?

  - service: tts.google_say
    entity_id: media_player.batcave
       message: Welkom, ({{ states ('sensor.evohome_security_who') }})