- For Google Home Resume Script, which is included in Google Home Resume package
- More information here
- Basic example
- No target provided in the service call
- Send TTS and apply volume
- Send TTS with picture and text
- Usage of the extra key
- Usage of the script_exta variable
- Multiple actions to the same target
This example will play an mp3 on 2 targets, without additional data
alias: "Play sound when there is someone at the door"
action: script.google_home_resume
data:
action:
- action: media_player.play_media
target:
area_id: 'living_room'
entity_id:
- media_player.bedroom
- media_player.guestroom
data:
media_content_type: music
media_content_id: "media-source://media_source/local/dingdong.mp3"
In this example a script is started instead of a service call directly to the entities. Therefor is is required to provide the target
so the script will know which entities should be resumed/restored.
alias: "Play sound when there is someone at the door via script"
action: script.google_home_resume
data:
target:
area_id: 'living_room'
entity_id:
- media_player.bedroom
- media_player.guestroom
action:
- action: script.play_sound
data:
file: "media-source://media_source/local/dingdong.mp3"
Enter the data for the TTS service call, and provide the volume under extra
- alias: "Send TTS using Google Home Resume script"
action: script.turn_on
target:
entity_id: script.google_home_resume
data:
variables:
action:
- alias: "Send TTS message"
action: tts.google_cloud_say
target:
entity_id: media_player.living_mini
data:
message: "Ding Dong! There is someone at the door!"
extra:
volume: 0.5
Enter the data for the TTS service call, and provide the details inscreen_tts
under extra
. Can be combined with volume
.
Based on the targets provided, and the variable players_screen
for the script settings, the script will determine if it should be sent as normal TTS, or one with extra data.
For this the script uses the helper script script.google_home_resume_tts_screen
The picture_url
should be a full url (starting with http://
or https://
, not a HA internal url) it can be an url within your network.
- alias: "Send TTS with picture and "
action: script.turn_on
target:
entity_id: script.google_home_resume
data:
variables:
action:
- alias: "Send TTS message"
action: tts.google_cloud_say
target:
entity_id:
- media_player.living_mini
- media_player.office_hub
data:
message: "Ding Dong! There is someone at the door!"
extra:
screen_tts:
large_text: DING DONG
small_text: There is someone at the door
picture_url: http://10.0.0.5:8123/media/camera_front_door/snapshot.jpg
volume: 0.5
- alias: "Send TTS with picture and "
action: script.turn_on
target:
entity_id: script.google_home_resume
data:
variables:
action:
- alias: "Send TTS message"
action: tts.google_cloud_say
target:
entity_id:
- media_player.living_mini
- media_player.office_hub
data:
message: "Ding Dong! There is someone at the door!"
script_extra:
screen_tts:
large_text: DING DONG
small_text: There is someone at the door
picture_url: http://10.0.0.5:8123/media/camera_front_door/snapshot.jpg
volume: 0.5
In case you send multiple actions to the same target, which need to wait for each other, enter wait: true
under extra
Don't put wait: true
at the end of the last service_call, this will block the Perform Resume script
- alias: "Send multiple TTS to the same target"
action: script.turn_on
target:
entity_id: script.google_home_resume
data:
variables:
action:
- alias: "First TTS message"
action: tts.google_cloud_say
target:
entity_id: media_player.living_mini
data:
message: "I'm the first!"
extra:
wait: true
- alias: "Second message"
action: tts.google_cloud_say
target:
entity_id: media_player.living_mini
data:
message: "I'm second!"
extra:
wait: true
- alias: "Third and last message"
action: tts.google_cloud_say
target:
entity_id: media_player.living_mini
data:
message: "I'm third.. and last.."