Sonos say script to speak with text-to-speech
Sonos say script to speak with text-to-speech
This script allows you to use TTS on Sonos.
script:
sonos_say:
alias: "Sonos TTS script"
sequence:
- service: media_player.sonos_snapshot
data_template:
entity_id: "{{ sonos_entity }}"
- service: media_player.sonos_unjoin
data_template:
entity_id: "{{ sonos_entity }}"
- service: media_player.volume_set
data_template:
entity_id: "{{ sonos_entity }}"
volume_level: "{{ volume }}"
- service: tts.voicerss_say
data_template:
entity_id: "{{ sonos_entity }}"
message: "{{ message }}"
- delay: "{{ delay }}"
- service: media_player.sonos_restore
data_template:
entity_id: "{{ sonos_entity }}"
We call this now with:
automation:
- alias: 'test'
trigger:
- platform: state
entity_id: input_boolean.mytest
action:
- service: script.sonos_say
data:
sonos_entity: media_player.office
volume: 0.5
message: 'Your husband coming home!'
delay: '00:00:05'