HI,
Only just beginning to experiment with tts and my new Google Homes, I made this script:
script:
send_intercom:
alias: 'Send Intercom'
sequence:
- service: tts.google_say
data_template:
language: >
{{states('input_select.language')|lower}}
entity_id: >
{% if is_state('input_select.googlehome', 'Woonkamer') %} media_player.googlehome_woonkamer
{% elif is_state('input_select.googlehome', 'Hobbykamer') %} media_player.googlehome_hobbykamer
{% elif is_state('input_select.googlehome', 'Broadcast (all)') %} group.broadcast
{% endif %}
message: >
{{states('input_text.intercom_message')}}
# volume: >
# {{ states('input_number.intercom_volume')|int }}
with this input_select:
input_select:
googlehome:
name: 'Select Google home:'
options:
- Woonkamer
- Hobbykamer
- Broadcast (all)
initial: Woonkamer
icon: mdi:google-home
if I select the group.broadcast, my message is sent alright, but if I select an individual media_player (which does exist, well obviously because the group is made up of these players) nothing happens.
broadcast:
name: 'Broadcast'
entities:
- media_player.googlehome_woonkamer
- media_player.googlehome_hobbykamer
The template is correct, so please help me why this wouldnt be alright?
btw, Ive commented out the volume for now, because I suspect that to be incompatible with google home? anyone with a tip about that?
I ask because I made another script which works as expected, announce all my presence movements just fine, with the same media_playersâŠ
googlehome_announce:
alias: 'Googlehome announce'
sequence:
- service: tts.google_say
data_template:
language: en
entity_id: media_player.googlehome_woonkamer, media_player.googlehome_hobbykamer
message: >
{% set name = states[entityid.split('.')[0]][entityid.split('.')[1]].name %}
{{as_timestamp(now()) | timestamp_custom('%X') }} :
{% if tostate == 'not_home' %}
{{-name }} left {{fromstate}}
{% elif fromstate == 'not_home' %}
{{-name }} arrived at {{tostate}}
{% else %}
{{-name }} left {{fromstate}} and arrived at {{tostate}}
{% endif %}
thanks