alias: "Tess Home" id: automation_tess_home mode: restart trigger: - platform: event event_type: automation_reloaded condition: - alias: "They were previously considered away" condition: state entity_id: input_boolean.tess_home state: "off" - alias: "At least one tracker is home" condition: numeric_state entity_id: group.person_tess above: 0 value_template: "{{ dict((states|selectattr('entity_id', 'in', state_attr('group.person_tess', 'entity_id'))|list)|groupby('state'))['home']|count }}" action: - action: input_boolean.turn_off entity_id: input_boolean.tess_travelling - action: input_boolean.turn_on entity_id: input_boolean.tess_home