From 3b0cf05788110d7ee639ccafdcc150d9454ab65d Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Tue, 28 Feb 2023 16:15:45 -0500 Subject: [PATCH] Basement Door Handling is now smarter Node-RED --- node-red/projects/NerdFlows | 2 +- packages/lighting_and_scenes.yaml | 51 ++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/node-red/projects/NerdFlows b/node-red/projects/NerdFlows index 14836c9..ad06e2b 160000 --- a/node-red/projects/NerdFlows +++ b/node-red/projects/NerdFlows @@ -1 +1 @@ -Subproject commit 14836c96a065e920c11fd2af54f3f8b468e1dabd +Subproject commit ad06e2bdd10b31de231a7a40216133baf6f0b62e diff --git a/packages/lighting_and_scenes.yaml b/packages/lighting_and_scenes.yaml index 40cde38..733eb53 100644 --- a/packages/lighting_and_scenes.yaml +++ b/packages/lighting_and_scenes.yaml @@ -55,6 +55,13 @@ input_number: step: 1 unit_of_measurement: minutes icon: mdi:timer + basement_studio_lights_off_delay: + name: Basement Studio Lights Off Delay + min: 0 + max: 30 + step: 1 + unit_of_measurement: minutes + icon: mdi:timer input_select: living_room_scenes: @@ -549,9 +556,19 @@ automation: entity_id: binary_sensor.basement_studio_door from: 'on' to: 'off' - for: - minutes: 10 id: door-closed + - platform: event + event_type: timer.finished + event_data: + entity_id: timer.basement_studio_door_timer + id: timer-finished + - platform: state + entity_id: + - binary_sensor.tony_desktop_on + - binary_sensor.kallen_desktop_on + from: 'off' + to: 'on' + id: computers-on condition: - condition: state entity_id: input_boolean.studio_quiet @@ -570,6 +587,16 @@ automation: - service: light.turn_on target: entity_id: light.basement_studio_lights + - service: timer.cancel + target: + entity_id: timer.basement_studio_door_timer + - delay: + seconds: 1 + - service: input_select.select_option + target: + entity_id: input_select.basement_studio_scenes + data: + option: Adaptive - conditions: - condition: trigger id: door-closed @@ -584,9 +611,25 @@ automation: entity_id: binary_sensor.kallen_desktop_on state: 'off' then: - - service: light.turn_off + - service: timer.start target: - entity_id: light.basement_studio_lights + entity_id: timer.basement_studio_door_timer + data: + duration: "{{ (states('input_number.basement_studio_lights_off_delay') | int ) * 60 }}" + - conditions: + - condition: trigger + id: computers-on + sequence: + - service: timer.cancel + target: + entity_id: timer.basement_studio_door_timer + - conditions: + - condition: trigger + id: timer-finished + sequence: + - service: light.turn_off + target: + entity_id: light.basement_studio_lights script: