I’m trying to get my Google speakers to tell me what door was opened in the event the alarm is triggered. Here is my automation code:
- id: '1635522521438'
alias: Alarm - Announce trigger on Google Home
description: ''
trigger:
- platform: state
entity_id: binary_sensor.basement_garage_entry_door
to: 'on'
from: 'off'
- platform: state
entity_id: binary_sensor.basement_patio_door
to: 'on'
from: 'off'
- platform: state
entity_id: binary_sensor.basement_garage_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.garage_entry_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.garage_service_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.side_garage_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.big_garage_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.patio_door
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.front_door
from: 'off'
to: 'on'
condition:
- condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_night
- condition: state
entity_id: alarm_control_panel.home_alarm
state: triggered
action:
- service: media_player.volume_set
target:
entity_id:
- media_player.great_room_google_hub
- media_player.master_bedroom_speaker
- media_player.toy_room_speaker
data:
volume_level: 0.9
- service: tts.google_translate_say
data:
entity_id: media_player.great_room_google_hub
message: The {{trigger.entity_ID}} was opened
- service: tts.google_translate_say
data:
entity_id: media_player.master_bedroom_speaker
message: The {{trigger.entity_ID}} was opened
- service: tts.google_translate_say
data:
entity_id: media_player.toy_room_speaker
message: The {{trigger.entity_ID}} was opened
- service: media_player.volume_set
target:
entity_id:
- media_player.master_bedroom_speaker
- media_player.toy_room_speaker
- media_player.great_room_google_hub
data:
volume_level: 0.4
mode: single
For example, If the garage entry door triggers the automation I want the system to say “The garage entry door was opened”. I currently says “The binary underscore sensor period garage underscore door was opened”. How can I get rid of extra parts of the entity ID?
I tried changing {{trigger.entity_ID}}
to {{trigger.name}}
and {{trigger.friendly_name}}
but that didn’t work