Here is my entry but I’m getting errors and cannot figure out to fix this… what am I missing?
Thank you!
- alias: 02 - Unlock Door Upon Arrival Home
id: Unlock Door Upon Arrival Home
trigger:
- platform: state
entity_id: sensor.ariela_john_wifi # <- this right here only works 40% of the time, is there a better way??
to: 'NETGEAR32'
condition:
condition: state
entity_id: device_tracker.john_s_galaxy_note20_ultra_5g
state: home
action:
- service: lock.unlock
entity_id: lock.front_door_lock
# THIS ISN'T working it only gives me errors. I spent an hour trying to figure this out
# the errors are:
#- service: mqtt.publish
# data:
# topic: "ariela/tts/android_john's_galaxy_note20_ultra_5g_tts/tts"
# payload: "Hi John, I've noticed you are arriving at home. I'm now unlocking your door."
trigger:
- platform: sun
event: sunset
offset: '+00:30:00'
action:
- service: light.turn_on
entity_id:
- switch.liv1
This is a screen shot of the issues… trust me I have tried everything…
You need to share your entire automation with us so we can see where the problem is.
In this screenshot:
The indentation is wrong again, the - service: mqtt.publish should be in the same column as the service: lock.unlock, that’s what the colors and lines in your core editor are for.
As @Burningstone pointed out, an automation can only have one trigger: section. There seems to be something missing before the lower trigger (alias / id of a new automation)
I’d suggest deleting the automation and setting it up via the UI, that takes care of the formatting and doesn’t require you to reload. Once the automation works, you can take a look at the YAML the UI made.
- alias: 02 - Unlock Door Upon Arrival Home
id: Unlock Door Upon Arrival Home
trigger:
- platform: state
entity_id: sensor.ariela_john_wifi # <- this right here only works 40% of the time, is there a better way??
to: 'NETGEAR32'
condition:
condition: state
entity_id: device_tracker.john_s_galaxy_note20_ultra_5g
state: home
action:
- service: lock.unlock
entity_id: lock.front_door_lock
- service: mqtt.publish
data:
topic: "ariela/tts/android_john's_galaxy_note20_ultra_5g_tts/tts"
payload: "Hi John, I've noticed you are arriving at home. I'm now unlocking your door."
Thank you guys for ALL your help!!! Here’s is what I have and no errors now
- alias: 02 - Unlock Door Upon Arrival Home
id: Unlock Door Upon Arrival Home
trigger:
- platform: state
entity_id: sensor.ariela_john_wifi # <- this right here only works 40% of the time, is there a better way??
to: 'NETGEAR32'
condition:
condition: state
entity_id: device_tracker.john_s_galaxy_note20_ultra_5g
state: home
action:
- service: lock.unlock
entity_id: lock.front_door_lock
- service: mqtt.publish
data:
topic: "ariela/tts/android_john's_galaxy_note20_ultra_5g_tts/tts"
payload: "Hi John, I've noticed you are arriving at home. I'm now unlocking your door."
trigger:
- platform: sun
event: sunset
offset: '+00:30:00'
action:
- service: light.turn_on
entity_id:
- switch.liv1
That’s not possible that you don’t have any errors, again, you can’t have 2 triggers and 2 actions in one automation. This whole part belongs in a separate automaiton:
I’ve gone ahead and checked it with my setup, seems like the Configuration validation doesn’t care if there are duplicated triggers and actions, however reloading that will cause errors…
I have marked the issues and now you’re right there are NO errors. I will just run with this until I can find out how to do this the right way! No sense messing things up!! LOL