hi guys i have a problem with an automation
this is the automation
- alias: ritorno a casa
trigger:
# - platform: state
# entity_id: binary_sensor.porta_ingresso
# to: 'on'
- platform: zone
entity_id:
- person.federico
- person.serena
event: enter
zone: zone.home
condition: []
action:
- wait_template: "{{ is_state('binary_sensor.porta_ingresso', 'on') }}"
timeout: '00:30:00'
continue_on_timeout: 'false'
- delay:
seconds: 5
- service: scene.turn_on
entity_id: scene.rientro_a_casa
- service: script.turn_on
data:
entity_id: script.rientro_a_casa
and this the script
rientro_a_casa:
alias: "Rientro a casa"
sequence:
- service: notify.alexa_media
data_template:
target:
- media_player.alexa_echo_dot
data:
type: announce
method: spoken
message: "Bentornato a casa. La temperatura esterna è di {{states('sensor.dark_sky_temperature')}} gradi.
Le previsioni meteo sono {{states ('sensor.dark_sky_hourly_summary') }}."
if I as a trigger put the entry in the zone the announcement of alex does not start…
if instead I use the door sensor as a trigger everything works correctly
Ok, and what is the problem? Please post everything in a single post instead of splitting it into multiple posts.
ok sorry me
Are you sure that “person.federico” and “person.serena” enter the zone? Do you have multiple device trackers assigned to the persons?
You could change this to trigger on the specific device tracker that “comes” home like this:
- alias: ritorno a casa
trigger:
# - platform: state
# entity_id: binary_sensor.porta_ingresso
# to: 'on'
- platform: state
entity_id:
- device_tracker.federico_phone #entity id of device tracker, which says that federico is home
- device_tracker.serena_phone #entity id of device tracker, which says that serenais home
to: home
condition: []
action:
- wait_template: "{{ is_state('binary_sensor.porta_ingresso', 'on') }}"
timeout: '00:30:00'
continue_on_timeout: 'false'
- delay:
seconds: 5
- service: scene.turn_on
entity_id: scene.rientro_a_casa
- service: script.turn_on
data:
entity_id: script.rientro_a_casa
yes I’m sure … i use the IOS app and has always worked well… I have other automations controlled on the person who guarantees correctly
So you have other automations with the “enter zone” trigger, which work fine but this one doesn’t?
exactly, i have other automatio based on the person entity and the zone
Could you please post the code of this working automation?
yes
- alias: arrivo notturno
trigger:
platform: zone
entity_id:
- person.federico
- person.serena
event: enter
zone: zone.home
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: state
entity_id: script.arrivo_notturno
state: 'off'
action:
service: script.arrivo_notturno
maybe I understood the problem … there are two more spaces in front of the entities people in the non-functioning one
Yes this could be, indentation is very important in YAML.
I will do some tests later and if that was the problem I will close the post. thank you very much for the moment
your issue is going to be with your wait template. The spacing won’t do anything if you have extra spaces in front of the listed entities. That’s a personal preference. Your issue most likely revolves around the wait template not being true. Start there.
ok, ok thank you but could you help me?
Not sure what I can do. Your wait template is syntactically correct. You gotta verify that your state for binary_sensor.porta_ingresso is changing to on, or is already on.
yes, it changes to on, in fact the notification of the opening has arrived and the light turns on, but the announcement of alexa does not start.
that should be
method: speak