Hi All, hoping for some guidance with an automation I’ve created to open my curtains in the morning when I’m not at home. As of yet, it’s never actually ran. I end up logging into HA remotely and opening them manually, anyway, here’s the automation as it stands : -
alias: Open SpareRoom Curtains when I'm Away
description: ''
trigger:
- platform: template
value_template: '{{ states(''person.xxxxxxxxxx'') != ''home'' }}'
condition:
- condition: state
entity_id: cover.spareroom_curtains
state: closed
- condition: and
conditions:
- condition: time
before: '10:00:00'
after: 08:30:00
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
action:
- service: cover.open_cover
data: {}
target:
device_id: e0e356ecedb99258511d74455ae0c45e
N.B. I’ve replaced my person ID with xxxxxxxxxx above.
Can anyone tell what I’m doing wrong please?
alias: Open SpareRoom Curtains when I'm Away
description: ''
trigger:
- platform: state
entity_id: person.xxxx
from: home
condition:
- and:
- condition: state
entity_id: cover.spareroom_curtains
state: closed
- condition: time
after: '08:30:00'
before: '10:00:00'
action:
- service: cover.open_cover
target:
entity_id: cover.spareroom_curtains
Just a few notes:
I wouldn’t use the device_id, use the entity_id instead (better readability)
always check your indentation
always use different quotation marks so you don’t get confused. Eg. outside you use double quotes (not double single quotes), so inside the template you can use single quotes:
Dont do: '{{ states(''person.xxxxxxxxxx'') != ''home'' }}'
Do: "{{ states('person.xxxxxxxxxx') != 'home' }}"
work with template triggers or conditions only, if you can’t use the “standards” like state or event. Does the job, but readability is better with “standards”.
If you don’t mind, could you please mark the last post from @SgtBatten as solution? Would be great, as others could directly see that there is a solution in this thread.
Thanks and good you got it working! Have a nice weekend!