From f17a25988ef4afb79e33c2c4832e7d3e43eefffe Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Fri, 11 Aug 2023 22:00:11 -0400 Subject: [PATCH] Move wife's desk light settings to sensor for ease of use elsewhere --- packages/lighting_and_scenes.yaml | 59 +++++++++++++------------------ 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/packages/lighting_and_scenes.yaml b/packages/lighting_and_scenes.yaml index cf48282..3631eb4 100644 --- a/packages/lighting_and_scenes.yaml +++ b/packages/lighting_and_scenes.yaml @@ -412,6 +412,25 @@ sensor: value_template: "{{ states('input_number.basement_led_strip_resets') | int }}" unit_of_measurement: 'resets' icon_template: mdi:restore + tina_desk_scene: + friendly_name: Tina Desk Scene + unique_id: 0d94ba35-bc9d-40a2-aa77-776d26bc3538 + value_template: > + {% if is_state('input_boolean.give_me_darkness','on') %} + Night Mode + {% elif is_state('binary_sensor.early_night_mode','on') and is_state('input_boolean.give_me_darkness','off') %} + Evening Mode + {% else %} + Day Mode + {% endif %} + icon_template: > + {% if is_state('input_boolean.give_me_darkness','on') %} + mdi:weather-night + {% elif is_state('binary_sensor.early_night_mode','on') and is_state('input_boolean.give_me_darkness','off') %} + mdi:lightbulb-night + {% else %} + mdi:lightbulb + {% endif %} template: - binary_sensor: @@ -702,41 +721,11 @@ automation: - condition: trigger id: computer-on then: - - if: - - condition: state - entity_id: binary_sensor.early_night_mode - state: 'off' - then: - - service: input_select.select_option - target: - entity_id: input_select.tina_desk_scenes - data: - option: Day Mode - - if: - - condition: and - conditions: - - condition: state - entity_id: binary_sensor.early_night_mode - state: 'on' - - condition: state - entity_id: input_boolean.give_me_darkness - state: 'off' - then: - - service: input_select.select_option - target: - entity_id: input_select.tina_desk_scenes - data: - option: Evening Mode - - if: - - condition: state - entity_id: input_boolean.give_me_darkness - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.tina_desk_scenes - data: - option: Night Mode + - service: input_select.select_option + target: + entity_id: input_select.tina_desk_scenes + data: + option: "{{ states('sensor.tina_desk_scene') }}" - if: - condition: trigger id: toggle-off