Allright. I hope you guys can help me out. I’m already half way there, but I can’t figure out what I’m doing wrong in my multiple devices presence detection
What I want is the following:
- Check if I’m at home
- Check if there are guests at home
If one of those two are home; someone’s inn. If nobody’s here, there’s nobody =))
In my cofiguration I’ve got the following booleans:
input_boolean:
rick_thuis:
name: Rick thuis
initial: on
icon: mdi:cellphone-iphone
gast_thuis:
name: Gasten thuis
initial: on
icon: mdi:cellphone-iphone
iemand_in_huis_aanwezig:
name: Iemand in huis aanwezig
initial: on
icon: mdi:cellphone-iphone
Next I’ve got those two automations:
- id: '8171367139013' # deze kijkt of Rick weg is / weg gaat
alias: Rick niet thuis
condition:
condition: state
entity_id: input_boolean.rick_thuis
state: 'on'
# Will only trigger if all are 'not_home'
trigger:
platform: template
value_template: "{% if (is_state('device_tracker.409c2859d29b','not_home')) and (is_state('device_tracker.f018980744b4','not_home')) %}true{% endif %}"
action:
service: homeassistant.turn_off
entity_id: input_boolean.rick_thuis
- id: '8247236230232' # deze kijkt of rick thuis is / komt
alias: Rick thuis
condition:
condition: state
entity_id: input_boolean.rick_thuis
state: 'off'
# Will trigger if any of the below are 'home'
trigger:
- entity_id: device_tracker.409c2859d29b
from: not_home
platform: state
to: home
- entity_id: device_tracker.f018980744b4
from: not_home
platform: state
to: home
action:
service: homeassistant.turn_on
entity_id: input_boolean.rick_thuis
Below some of the devices from guests I know
- id: '8771613894273' # deze kijkt of gasten weg zijn / weg gaan
alias: Gasten niet in huis
condition:
condition: state
entity_id: input_boolean.gast_thuis
state: 'on'
# Will only trigger if all are 'not_home'
trigger:
platform: template
value_template: "{% if (is_state('device_tracker.b0702d072161','not_home')) and (is_state('device_tracker.881196349ff3','not_home')) %}true{% endif %}"
action:
service: homeassistant.turn_off
entity_id: input_boolean.gast_thuis
- id: '9809802320202' # deze kijkt of gasten thuis zijn / komen
alias: Gasten in thuis
condition:
condition: state
entity_id: input_boolean.gast_thuis
state: 'off'
# Will trigger if any of the below are 'home'
trigger:
- entity_id: device_tracker.b0702d072161
from: not_home
platform: state
to: home
- entity_id: device_tracker.881196349ff3
from: not_home
platform: state
to: home
action:
service: homeassistant.turn_on
entity_id: input_boolean.gast_thuis
What I want to do is make a final check to see if one of those is inn or not:
- id: '8817155151211' # deze kijkt of Rick of gasten weg zijn / weg gaan
alias: Overall niemand thuis
condition:
condition: state
entity_id: input_boolean.iemand_in_huis_aanwezig
state: 'on'
# Will only trigger if all are 'not_home'
trigger:
platform: template
value_template: "{% if (is_state('input_boolean.rick_thuis','off')) and (is_state('input_boolean.gast_thuis','off')) %}true{% endif %}"
action:
service: homeassistant.turn_off
entity_id: input_boolean.iemand_in_huis_aanwezig
- id: '8765419182112' # deze kijkt of Rick of gasten thuis zijn / komen
alias: Overall iemand in thuis
condition:
condition: state
entity_id: input_boolean.iemand_in_huis_aanwezig
state: 'off'
# Will trigger if any of the below are 'home'
trigger:
- entity_id: input_boolean.rick_thuis
from: 'off'
platform: state
to: 'on'
- entity_id: input_boolean.gast_thuis
from: 'off'
platform: state
to: 'on'
action:
service: homeassistant.turn_on
entity_id: input_boolean.iemand_in_huis_aanwezig
However when I switch both guests or me to on or off, the final boolean doesn’t respond… Does anyone know why?