mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 10:30:14 -04:00
27 lines
1.2 KiB
YAML
27 lines
1.2 KiB
YAML
alias: "Adults away something open"
|
|
id: automation_adults_away_something_open
|
|
mode: restart
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_boolean.adults_away
|
|
from: "off"
|
|
to: "on"
|
|
condition:
|
|
- condition: state
|
|
entity_id: binary_sensor.something_open
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: input_boolean.home_occupied
|
|
state: "off"
|
|
action:
|
|
# Notify the last person to leave
|
|
- action: notify.mobile_app_pixel_7
|
|
data:
|
|
message: >-
|
|
{% if as_timestamp(states.input_boolean.kristy_home.last_updated) > as_timestamp(states.input_boolean.clint_home.last_updated) %}
|
|
The following are open: {{ dict((states|selectattr('entity_id', 'in', state_attr('group.my_exterior_windows', 'entity_id') + state_attr('binary_sensor.exterior_doors', 'entity_id'))|list)|groupby('state'))['on']|map(attribute='name')|list|join(', ') }}
|
|
{% else %}
|
|
The following are open: {{ dict((states|selectattr('entity_id', 'in', state_attr('group.my_exterior_windows', 'entity_id') + state_attr('binary_sensor.exterior_doors', 'entity_id'))|list)|groupby('state'))['on']|map(attribute='name')|list|join(', ') }}
|
|
{% endif %}
|