Presence Automation with 2 Persons

Hello, has anyone had this problem? I think it’s due to the condition, could someone be so kind and help me, thanks :slight_smile:

Q: Why is the automation not triggered when both people leave?


According to the trace, Jenny’s state is not_home (so that condition’s result is true) and Alexander’s state is Kaserne (so that condition’s result is false because the wanted_state is not_home).

It appears to be working exactly the way you designed it. How do you want it to work?

Images of text are a horrible, horrible, thing. If nothing else, it stops people being able to easily help you address issues with your automation.

Personally I’d use the state of zone.home going below 1 - numeric state trigger.

2 Likes

or use proximity or a group of people would also work :yum:

Hi Taras,

The input_boolean.turn_off should switch to OFF when BOTH people are no longer =[home].
When I’m in the [Kaserne], I’m absent…

I use this automation to turn off forgotten lights, lock the front door, and turn down the heat. (And that should only happen when we’re both not at [home] anymore…

You created a condition that requires the person entity’s state to be not_home. Kaserne clearly isn’t the value not_home. What you need is a condition that checks if the person entity’s value is not home.

Replace the State Condition with a Template Condition:

condition:
  - "{{ states('person.jenny') != 'home') }}"
  - "{{ states('person.alexander') != 'home') }}"

Alternative:

condition:
  - "{{ not is_state('person.jenny', 'home') }}"
  - "{{ not is_state('person.alexander', 'home') }}"
1 Like

@123
I’m too stupid to insert a template condition. can u show me please?

!= express NOT right?

One question, would that be possible:

alias: Anwesenheitserkennung GPS, AUS
description: ""
trigger:
  - platform: state
    entity_id:
      - person.jenny
      - person.alexander
    to: not_home
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.anwesenheit
    data: {}
  - condition: and
    conditions:
      - condition: not
        conditions:
          - condition: zone
            entity_id: person.jenny
            zone: zone.home
      - condition: not
        conditions:
          - condition: zone
            entity_id: person.alexander
            zone: zone.home
mode: single

So use the solution I provided :wink:

I would like to understand, as @123 said, how to build it with a “Condition” template. I don’t understand where to put this exactly:

condition:
  - "{{ states('person.jenny') != 'home') }}"
  - "{{ states('person.alexander') != 'home') }}"

configuration.yaml:

proximity:
  my_proximity_devices:
    devices:
      - device_tracker.phone1
      - device_tracker.phone2
      - device_tracker.phone3
    tolerance: 50
    unit_of_measurement: m

automation

alias: Alarm Auto Arm/Disarm
description: ""
trigger:
  - platform: numeric_state
    entity_id: proximity.proximity
    above: 200
    id: Arm_above_200
  - platform: numeric_state
    entity_id: proximity.proximity
    id: Disrm_below_199
    below: 199
condition: []
action:
  do something

this arms the alarm when everyone is further then 200 mtr away from the house, and disarms it again when within 199 mtrs of the house

I do something like this but use a zone.

When zone.home == 0 (no one is home) do the action

Literally where the example shows to put it.

It won’t trigger if the value changes to Kaserne.

I try it like that:

alias: Anwesenheitserkennung GPS, AUS
trigger:
  - platform: state
    entity_id:
      - zone.home
    to: "0"
condition: []
action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.anwesenheit