Hello community!
I am struggling with an automation which is probably very simple.
I have two windows that I would like to close if last person leaves home and forgets them open; and HA to send a notification that they have been closed.
This is the code I wrote but it’s not working
That’s in advance for your help
- id: '14564064377775'
alias: You left Velux open
trigger:
- platform: state
entity_id: group.people
to: not_home
condition:
- condition: state
entity_id: group.velux
state: 'on'
action:
- service: cover.close_cover
entity_id: group.velux
- service: notify.iphones
data:
title: You left the Velux open
message: I will close it for you
initial_state: true
mode: single
For the notifications I have created a notifications.yaml file with this code
It’s my understanding that the cover.close_cover service call is for closing cover entities.
If you go to Developer Tools > Services and select Cover: Close, when you click ‘Pick entity’ it won’t offer to select anything other than a cover entity.
You’re saying you have tested and confirmed the cover.close_cover service call will work with a group entity?
Then it can only be the trigger or the condition. If you go to Developer Tools → States, does group.velux show on when the windows are open? Does group.people show not_home when you leave the house?
If it’s a group of cover entities then I believe the group’s state is the same as the states of its entities. That means open/closed as opposed to on/off. You can confirm that by examining the state value of group.velux in Developer Tools > States. If it’s open/closed then change the State Condition to:
condition:
- condition: state
entity_id: group.velux
state: 'open'