Files
fresh-home/automations/people/Marshall/marshall_home.yaml
T
2024-04-14 14:08:56 -04:00

34 lines
908 B
YAML

alias: 'Marshall Home'
id: automation_marshall_home
mode: restart
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id:
- group.person_marshall
- device_tracker.nmap_tracker_fe_cf_82_b2_22_e0
to: 'home'
- platform: event
event_type: automation_reloaded
condition:
- alias: 'They were previously considered away'
condition: state
entity_id: input_boolean.marshall_home
state: 'off'
- alias: 'At least one tracker is home'
condition: numeric_state
entity_id: group.person_marshall
above: 0
value_template: "{{ dict((states|selectattr('entity_id', 'in', state_attr('group.person_marshall', 'entity_id'))|list)|groupby('state'))['home']|count }}"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.marshall_travelling
- service: input_boolean.turn_on
entity_id: input_boolean.marshall_home