I have a automation to turn off all the lights when both my wife and myself are out of the house. In my configuration.yaml file has this code and was rebooted. Tracked device in our person entity is our respective iphones.
proximity:
home:
devices:
- person.spouse
- person.my
tolerance: 10
my automation
alias: Geofence - lights
description: ""
trigger:
- platform: numeric_state
entity_id:
- proximity.home
below: 0.1
id: arriving-home
- platform: numeric_state
entity_id:
- proximity.home
id: leaving-home
above: 0.1
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- leaving-home
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
- condition: template
value_template: >-
{% set domain = 'light' %}
{% set state = 'on' %}
{% set count = states[domain] | selectattr('state','eq', state) |
map(attribute='entity_id') | list | count > 0 %}
{{ count }}
sequence:
- service: notify.mobile_app_my_iphone
metadata: {}
data:
title: Leaving House
message: >-
{% set domain = 'light' %} {% set state = 'on' %} {{
states[domain] | selectattr('state','eq', state) |
map(attribute='entity_id') | list | join(', ') }}
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: all
- service: notify.mobile_app_my_iphone
metadata: {}
data:
title: Leaving
message: Lights turned off
- conditions:
- condition: trigger
id:
- arriving-home
- condition: sun
before: sunrise
after: sunset
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
sequence:
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.switch_familyroom
- service: notify.mobile_app_my_iphone
metadata: {}
data:
message: Family Room Light On
title: Your Arriving Home
mode: single
When I test option 1/condition triggered by leaving-home it returns false when we are both out of the house. It should return true and run the remainder of the automation. Any thoughts on what’s wrong.