From 18888f119b108919674f5f6a257b5ea2d219174a Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 30 Jan 2023 16:15:53 -0500 Subject: [PATCH] Presence sensors for groups now only true if family is home #69 --- packages/presence.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/presence.yaml b/packages/presence.yaml index 2f9b729..dee019a 100644 --- a/packages/presence.yaml +++ b/packages/presence.yaml @@ -169,11 +169,25 @@ template: device_class: presence - binary_sensor: - name: "Nerds Home" - state: "{{ is_state('binary_sensor.tony_home','on') and is_state('device_tracker.kallen_iphone','home') }}" + state: >- + {% if is_state('group.family','home') %} + {% if is_state('binary_sensor.tony_home','on') and is_state('device_tracker.kallen_iphone','home') %} + true + {% else %} + false + {% endif %} + {% endif %} device_class: presence - binary_sensor: - name: "Parents Home" - state: "{{ is_state('binary_sensor.tony_home','on') and is_state('binary_sensor.tina_home','on') }}" + state: >- + {% if is_state('group.family','home') %} + {% if is_state('binary_sensor.tony_home','on') and is_state('binary_sensor.tina_home','on') %} + true + {% else %} + false + {% endif %} + {% endif %} device_class: presence mqtt: