Good Welcome to Home Assistant.
Anyway, if you have 2021.7 version, you can try the following YAML code-
alias: Garage Door Opened/Closed Notification
description: ''
mode: single
trigger:
- platform: state
entity_id: binary_sensor.garage_test_in
to: 'on'
id: Opened
- platform: state
entity_id: binary_sensor.garage_test_in
to: 'off'
id: Closed
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: Opened
sequence:
- service: tts.google_translate_say
data:
entity_id: media_player.kitchen
message: Garage Door Opened
- conditions:
- condition: trigger
id: Closed
sequence:
- service: tts.google_translate_say
data:
entity_id: media_player.kitchen
message: Garage Door Closed
default: []
In 2021.7 version, you can take advantage of the new features - so called trigger condition
and trigger ID
to be specified in the choose
action - therefore allowing you to merge 2 automation into single automation.