From 9fa618ed3bc7704cbdc9144aef12439e488d3229 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 20 Feb 2023 15:38:03 -0500 Subject: [PATCH] New night/goodnight handling --- input_boolean.yaml | 5 +++- node-red/projects/NerdFlows | 2 +- packages/kallen.yaml | 5 +++- scripts.yaml | 54 +++++++++++++++++++++---------------- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/input_boolean.yaml b/input_boolean.yaml index 32aab4d..3781587 100644 --- a/input_boolean.yaml +++ b/input_boolean.yaml @@ -24,4 +24,7 @@ night_mode: icon: mdi:lightbulb-night toggle_testing: name: Toggle Testing - icon: mdi:test-tube \ No newline at end of file + icon: mdi:test-tube +goodnight: + name: Goodnight + icon: mdi:sleep \ No newline at end of file diff --git a/node-red/projects/NerdFlows b/node-red/projects/NerdFlows index d15552b..ac67e15 160000 --- a/node-red/projects/NerdFlows +++ b/node-red/projects/NerdFlows @@ -1 +1 @@ -Subproject commit d15552b6be12ade03aa60aa36c51e482c0120592 +Subproject commit ac67e152d592ed2152303ed26669fe4ef00877ff diff --git a/packages/kallen.yaml b/packages/kallen.yaml index eddd638..0d54a1a 100644 --- a/packages/kallen.yaml +++ b/packages/kallen.yaml @@ -3,4 +3,7 @@ input_boolean: kallen_sleeping: name: Kallen Sleeping - icon: mdi:sleep \ No newline at end of file + icon: mdi:sleep + kallen_computer_updates: + name: Kallen Computer Updates + icon: mdi:update \ No newline at end of file diff --git a/scripts.yaml b/scripts.yaml index a93fe4d..1308ec1 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -217,6 +217,13 @@ max_brightness: going_upstairs: alias: Going Upstairs sequence: + - service: mqtt.publish + data: + qos: '2' + retain: true + topic: homeassistant/time/nightmode + payload: 'on' + alias: Tell MQTT that it is night mode now - service: input_select.select_option data: option: Adaptive @@ -248,9 +255,15 @@ going_upstairs: entity_id: media_player.basement_tv data: {} alias: Turn basement TV off, unless something is playing - - service: script.kallen_desktop_shutdown - data: {} - alias: Shut down Kallen desktop + - if: + - condition: state + entity_id: input_boolean.kallen_computer_updates + state: 'off' + then: + - service: script.kallen_desktop_shutdown + data: {} + alias: Shut down Kallen desktop + alias: Shutdown Kallen Desktop, unless it is updating - service: script.asus_laptop_shutdown data: {} alias: Shut down laptop @@ -278,26 +291,21 @@ going_upstairs: target: entity_id: light.basement_studio_lights alias: Turn off the lights - - wait_for_trigger: - - platform: state - entity_id: - - binary_sensor.upstairs_bathroom_motion - to: 'on' - timeout: 00:05:00 - alias: Wait until I'm in the bathroom - - service: input_select.select_option - data: - option: Side Nightlight - target: - entity_id: input_select.master_bedroom_scenes - alias: Turn on dim lighting in master bedroom - - service: mqtt.publish - data: - qos: '2' - retain: true - topic: homeassistant/time/nightmode - payload: 'on' - alias: Tell MQTT that it is night mode now + - wait_template: '{{ is_state(''binary_sensor.upstairs_bathroom_motion'',''on'') + or is_state(''input_boolean.goodnight'',''on'') }}' + timeout: 00:10:00 + alias: Wait until I'm in the bathroom or in bed + - if: + - condition: state + entity_id: input_boolean.goodnight + state: 'off' + then: + - service: input_select.select_option + data: + option: Side Nightlight + target: + entity_id: input_select.master_bedroom_scenes + alias: Turn on dim lighting in master bedroom, unless I am in bed mode: single icon: hue:room-stairs start_youtube_basement: