In attempting to automate knowing when someone is home or when everyone is away, groups does not work correctly for me.
In the groups.yaml I have:
residents:
name: Residents
entities:
- person.keith
- person.valerie
all: false
In the user interface I have:
type: entities
entities:
- entity: person.keith
secondary_info: last-updated
- entity: person.valerie
secondary_info: last-updated
- entity: group.residents
secondary_info: last-updated
- entity: input_boolean.at_home_keith
- entity: input_boolean.at_home_valerie
- entity: input_boolean.at_home_alarm
state_color: true
The entry door sensors are to send us an alert if they are open when Residents state is Away.
Sometimes it works as described in the documents. But, at other times it does not. For example:
In this case, if one of us go out on the front porch we get an intruder alert… i.e. a false alarm.
So, after much searching, and reading, and fiddling I have abandoned using groups. Instead, I have created three helpers (binary variables) called “At Home Keith”, “At Home Valerie”, and “At Home Alarm”. The “At Home Alarm” is to be set on if everyone is not home, but will be off if one or more are home.
So, the following automation have been created…
Automation Alarm Set
alias: Alarm Set
description: ''
trigger:
- platform: state
entity_id: input_boolean.at_home_keith
from: 'on'
to: 'off'
- platform: state
entity_id: input_boolean.at_home_valerie
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: input_boolean.at_home_keith
state: 'off'
- condition: state
entity_id: input_boolean.at_home_valerie
state: 'off'
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.at_home_alarm
mode: single
Automation Alarm Unset
alias: Alarm unset
description: ''
trigger:
- platform: state
entity_id: input_boolean.at_home_keith
to: 'on'
from: 'off'
- platform: state
entity_id: input_boolean.at_home_valerie
from: 'off'
to: 'on'
condition: []
action:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.at_home_alarm
mode: single
Automation Home Arrive Keith
alias: Home arrive keith
description: ''
trigger:
- platform: device
device_id: aec314e4253ceafdc2b702cb73540213
domain: device_tracker
entity_id: device_tracker.phone_keith
type: enters
zone: zone.home
condition: []
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.at_home_keith
mode: single
Automation Leave Keith
alias: Home leave keith
description: ''
trigger:
- platform: device
device_id: aec314e4253ceafdc2b702cb73540213
domain: device_tracker
entity_id: device_tracker.phone_keith
type: leaves
zone: zone.home
condition: []
action:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.at_home_keith
mode: single
Note: Automation Home Arrive Valerie and Automation Home Leave Valerie were also created following the same pattern.
And, now… it works…