@Chandler_K_Sharp wrote:
So ill try to give you a brief overview of what i would like to accomplish. We currently have 2-3 people in the house using geofencing with HA. I would like to build an automation that would
a) Know who the last person leave was, and only send this message to them
b) include in the message a list of any open doors,windows,covers
c) If the cover is left open give me an actionable button to close it
Here is some of the logic ive thought about so far. I can use trigger.entity_id to figure out who was the last person to leave and triggered the automation to start, but how can i get it to only notify that person. At first i thought about using a service_template with notify… but i couldnt figure anything out. Then I thought about just using and if else statement to say if user A was the result of trigger.entity_id notify user A else notify user B. Not sure what would be easiest and cleanest.
So far i have this to return a list of entities in a given state that i can adjust for anything… but it would be nice to be able to nest them into a single function.
> ##Test > - id: testsad > alias: testsad > trigger: > platform: state > entity_id: group.life360 > from: home > to: not_home > condition: > condition: template > value_template: > > # this counts the doors that are open and if we have any that are open, the notify will occur > {{ states | selectattr('entity_id', 'in', state_attr('group.all_covers','entity_id')) | selectattr('state','in',['on','open']) | list | length >= 1 }} > action: > - service: notify.ios_iphone > data_template: > title: "Doors Open!" > message: > > {% set open_doors = states | selectattr('entity_id', 'in', state_attr('group.all_covers','entity_id')) | selectattr('state','in',['on','open']) | list | map(attribute='name') | join(', ') %} > The following doors are open: {{ open_doors }}
If anyone has any help or suggestions it is greatly appreciated… i think drzzs has a good video for actionable notifications so i need to watch that but was gonna try and get A and B accomplished first haha
Posts: 1
Participants: 1