pw44
(Paulo Ven)
1
Hya,
i have the following automatiom.
# ZONE - enter or leave
- alias: Zone Notifications
trigger:
- platform: zone
entity_id:
- device_tracker.pwmi6
zone: zone.home
event: enter
- platform: zone
entity_id:
- device_tracker.pwmi6
zone: zone.home
event: leave
- platform: zone
entity_id:
- device_tracker.pwmi6
zone: zone.luciana
event: enter
- platform: zone
entity_id:
- device_tracker.pwmi6
zone: zone.luciana
event: leave
action:
- service: notify.mobile_app_pwmi6
data:
message: >
{% if trigger.event == "leave" %}
{{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
{% else %}
{{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
{% endif %}
i would like to add an audible notification to sond on the mobile app and also other devices.
Is it possible?
Thx in advance!
tom_l
4
That would have been useful information to include in your post. I have moved it to the appropriate topic.
You have to use notification channels: https://companion.home-assistant.io/docs/notifications/notifications-basic#notification-channels
pw44
(Paulo Ven)
5
great!
thank you.
for testing, i did the following:
- alias: Enter Home
trigger:
- platform: zone
entity_id:
- device_tracker.pwmi6
zone: zone.home
event: enter
action:
- service: switch.turn_on
data:
entity_id:
- switch.rl1ch0087dc
- service: notify.mobile_app_pwmi6
data:
message: "TTS"
title: "welcome, master
- delay: 00:05:00
- service: switch.turn_off
data:
entity_id:
- switch.rl1ch0087dc
by configuration → automation - run action, Enter Home make the text be spoken on my mobile.
The question is how to add also the TTS to the
- service: notify.mobile_app_pwmi6
data:
message: >
{% if trigger.event == "leave" %}
{{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
{% else %}
{{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
{% endif %}
can another message block be added or included by the if then else block?
Thx in advance!
TTS should be a separate action from the notification
pw44
(Paulo Ven)
7
Ok, example, if possible with the same if?
Just copy it over using the required fields. The if statement should be for the topic as message needs to stay as TTS
pw44
(Paulo Ven)
9
sorry, i didn’t get it quite right
- service: notify.mobile_app_pwmi6
data:
message: TTS
title: >
{% if trigger.event == "leave" %}
{{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
{% else %}
{{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
{% endif %}