From 2868126e059ef7ad353f8f7314e4ec67bb1580d2 Mon Sep 17 00:00:00 2001 From: golles Date: Wed, 30 Oct 2024 18:06:31 +0000 Subject: [PATCH] Leave kitchen lights on while using the oven --- automations/keuken/verlichting.yaml | 2 +- packages/kamers.yaml | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/automations/keuken/verlichting.yaml b/automations/keuken/verlichting.yaml index 4e0a83d..d30405c 100644 --- a/automations/keuken/verlichting.yaml +++ b/automations/keuken/verlichting.yaml @@ -4,7 +4,7 @@ path: golles/motion-activated_scenes.yaml input: day_end_time: 00:00:00 - motion_entity: binary_sensor.epl_keuken_zone_1_occupancy + motion_entity: binary_sensor.keuken_bezetting cool_down: 30 light_entity: light.keuken illuminance_entity: sensor.epl_keuken_illuminance diff --git a/packages/kamers.yaml b/packages/kamers.yaml index 0c1c38e..0e64f87 100644 --- a/packages/kamers.yaml +++ b/packages/kamers.yaml @@ -111,6 +111,33 @@ template: off {% endif %} + - name: Keuken bezetting + device_class: occupancy + icon: mdi:motion-sensor + state: > + {% set motion_entities = [ + "binary_sensor.epl_keuken_zone_1_occupancy", + ] %} + + {% set is_oven_on = is_state("sensor.384090532720002735_001_bsh_common_setting_powerstate", "Aan") %} + + {% + set is_motion = states.binary_sensor + | selectattr("entity_id", "in", motion_entities) + | rejectattr("state", "in", ["off", "unavailable", "unknown"]) + | list + | count + > 0 + %} + + {% if (this.state == "on") %} + {{ iif(is_motion or is_oven_on, "on", "off") }} + {% elif (this.state == "off") %} + {{ iif(is_motion, "on", "off") }} + {% else %} + off + {% endif %} + - name: Logeerkamer bezetting device_class: occupancy icon: mdi:motion-sensor