Hi
I am just starting out and having hard time with setting up an automation.
I have 2 variables - garage door state and family presence.
Both are working fine independently - family status changes fine and garage door status changes fine.
I just cannot work out how to do the automation so that:
door automatically closes if nobody home but garage door is left open
open door if its closed but someone is detected as returned home
trigger:
- platform: state
entity_id: group.family
from: 'home'
condition:
- condition: state
entity_id: binary_sensor.garage_door_open
state: 'on'
action:
- [whatever you need to do to close the door]
This is what I currently have (should have pasted it earlier). Action is something I have no issue with - it closes if I manually run the automation. But the condition never gets executed
Also still dont understand how strings work in the code. Like in the From/To sections - are they strings with single quote or I can just use any way I like?
id: '1621584495658'
alias: Close garage door when nobody home by door is open
description: ''
trigger:
- platform: state
entity_id: group.family
from: home
to: away
for: '00:00:03'
condition:
- condition: state
entity_id: cover.mygarage
state: open
attribute: door_state
action:
- service: cover.close_cover
target:
entity_id: cover.mygarage
mode: single
yeah, dont understand how the lowercase/uppercase, quote/unquote works in HA yet.
How do I know if I should put double quotes around the value? Not quotes in the state section.
But found that instead of Home/Away that it displays in the Lovalace, it is actually home/not_home
Ahh, yeah, it’s indeed not_home :). And most places do like the quotes, even it you don’t need them. I make most automations in the UI which will place the quotes for me
Than you don’t need them So just using the correct states should fix it
id: '1621584495658'
alias: Close garage door when nobody home by door is open
description: ''
trigger:
- platform: state
entity_id: group.family
from: home
to: not_home
for: '00:00:03'
condition: []
action:
- service: cover.close_cover
target:
entity_id: cover.mygarage
mode: single