From f622cf0eccd2960f91e9748c5838653f5e621fce Mon Sep 17 00:00:00 2001 From: dexn Date: Mon, 12 Aug 2024 17:45:18 +1000 Subject: [PATCH] Added a switch for the presence indicator light --- athom-presence-sensor.yaml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/athom-presence-sensor.yaml b/athom-presence-sensor.yaml index 2b5bee6f..8ad0a073 100644 --- a/athom-presence-sensor.yaml +++ b/athom-presence-sensor.yaml @@ -99,8 +99,11 @@ binary_sensor: - delayed_off: 10s device_class: motion on_press: - then: - - light.turn_on: led + if: + condition: + switch.is_on: presence_light + then: + - light.turn_on: led - platform: gpio pin: @@ -158,6 +161,21 @@ switch: turn_off_action: - uart.write: "sensorStop\r\n" + - platform: template + name: Presence Light + id: presence_light + entity_category: config + optimistic: true + restore_mode: RESTORE_DEFAULT_ON + on_turn_on: + if: + condition: + binary_sensor.is_on: occupancy + then: + - light.turn_on: led + on_turn_off: + - light.turn_off: led + number: - platform: template name: Farthest Detection #Value range: 1.9 ~ 12m Default: 6