Files
fresh-home/automations/people/Marshall/marshall_home.yaml
T
2025-10-10 20:24:52 -04:00

35 lines
907 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:
- action: input_boolean.turn_off
entity_id: input_boolean.marshall_travelling
- action: input_boolean.turn_on
entity_id: input_boolean.marshall_home