diff --git a/node-red/projects/NerdFlows b/node-red/projects/NerdFlows index be18131..8c8d3ca 160000 --- a/node-red/projects/NerdFlows +++ b/node-red/projects/NerdFlows @@ -1 +1 @@ -Subproject commit be18131875be5a98f4bffc9daee21e2f948ca98d +Subproject commit 8c8d3cad274997394bbe481aa3fb85a1fda4d843 diff --git a/packages/lighting_and_scenes.yaml b/packages/lighting_and_scenes.yaml index de7c39b..b4e3ba9 100644 --- a/packages/lighting_and_scenes.yaml +++ b/packages/lighting_and_scenes.yaml @@ -23,6 +23,9 @@ input_boolean: give_me_darkness: name: Give Me Darkness icon: mdi:weather-night + tina_desk_lights: + name: Tina Desk Lights + icon: mdi:desk input_number: upstairs_bathroom_motion_off_delay: @@ -192,6 +195,7 @@ input_select: - Day Mode - Evening Mode - Night Mode + - Reset initial: Select icon: mdi:desk holiday_animation: @@ -418,6 +422,77 @@ automation: target: entity_id: light.first_floor_lights + - id: b897d714-bbf2-44ce-afaf-63cf3694351c + alias: Tina Desk Lights Handler + description: Handles turning on the desk lights with smart scene selection and also turning them off + mode: restart + trigger: + - platform: state + entity_id: input_boolean.tina_desk_lights + from: 'off' + to: 'on' + id: toggle-on + - platform: state + entity_id: input_boolean.tina_desk_lights + from: 'on' + to: 'off' + id: toggle-off + - platform: state + entity_id: input_select.tina_desk_scenes + to: 'Reset' + id: reset + action: + - if: + - condition: or + conditions: + - condition: trigger + id: toggle-on + - condition: trigger + id: reset + then: + - if: + - condition: state + entity_id: input_boolean.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: input_boolean.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 + - if: + - condition: trigger + id: toggle-off + then: + - service: light.turn_off + target: + entity_id: light.tina_desk_lights + script: emma_wakeup: alias: "Emma Wakeup" @@ -460,60 +535,6 @@ script: target: entity_id: input_boolean.white_noise_emma_bedroom - tina_desk_lights_handler: - alias: Tina Desk Lights Handler - mode: queued - max: 2 - sequence: - - if: - - condition: state - entity_id: light.tina_desk_lights - state: 'off' - then: - - if: - - condition: state - entity_id: input_boolean.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: input_boolean.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 - - if: - - condition: state - entity_id: light.tina_desk_lights - state: 'on' - then: - - service: light.turn_off - target: - entity_id: light.tina_desk_lights - scene: - name: Adaptive in Living Room icon: mdi:palette diff --git a/scripts.yaml b/scripts.yaml index cf0f713..4d9df23 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -21,6 +21,10 @@ stop_netflix: give_me_darkness: alias: Give Me Darkness sequence: + - service: input_boolean.turn_on + data: {} + target: + entity_id: input_boolean.give_me_darkness - service: light.turn_on data: {} target: @@ -31,11 +35,16 @@ give_me_darkness: entity_id: - switch.adaptive_lighting_sleep_mode_dining_room data: {} - - service: input_select.select_option - data: - option: Night Mode - target: - entity_id: input_select.tina_desk_scenes + - if: + - condition: state + entity_id: person.christina_stork + state: home + then: + - service: input_select.select_option + data: + option: Night Mode + target: + entity_id: input_select.tina_desk_scenes - service: input_select.select_option target: entity_id: