From 46b20a42cf97afdb77955b4f68a931a77a10d4e1 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 2 Oct 2023 19:11:09 -0400 Subject: [PATCH] Migrate lighting automations and scripts #154 --- automations.yaml | 609 ++++++++++++ packages/lighting_and_scenes.yaml | 1467 ----------------------------- scripts.yaml | 950 +++++++++++++++++++ 3 files changed, 1559 insertions(+), 1467 deletions(-) diff --git a/automations.yaml b/automations.yaml index f209fc6..68e5af9 100644 --- a/automations.yaml +++ b/automations.yaml @@ -1573,3 +1573,612 @@ entity_id: alarm_control_panel.alexa_guard_9ee3b data: {} mode: restart +- id: '1696286103061' + alias: Living Room Night Lighting + description: Provide lighting in case anyone needs to go downstairs in the middle + of the night. + trigger: + - platform: state + entity_id: binary_sensor.living_room_motion + from: 'off' + to: 'on' + id: motion-on + - platform: state + entity_id: binary_sensor.living_room_motion + from: 'on' + to: 'off' + id: motion-off + - platform: event + event_type: timer.finished + event_data: + entity_id: timer.living_room_motion_timer + id: timer-finished + condition: + - condition: state + entity_id: binary_sensor.people_present + state: 'on' + - condition: state + entity_id: input_boolean.vacation_mode + state: 'off' + action: + - choose: + - conditions: + - condition: template + value_template: '{{ (trigger.id == ''motion-on'' and is_state(''input_boolean.night_mode'',''on'')) + and (is_state(''input_boolean.kallen_sleeping'',''on'') or is_state(''input_boolean.kallen_overnight'',''on'')) + }}' + alias: Motion On + sequence: + - service: timer.cancel + target: + entity_id: timer.living_room_motion_timer + data: {} + - service: light.turn_on + target: + entity_id: light.first_floor_lights + data: {} + - service: script.stairwell_led_strip + data: + color_temp_kelvin: 2000 + brightness: 255 + - service: input_select.select_option + target: + entity_id: + - input_select.living_room_scenes + - input_select.tina_lamp_scenes + - input_select.mud_room_scenes + - input_select.downstairs_bathroom_scenes + - input_select.dining_room_lamp_scenes + data: + option: Adaptive + - conditions: + - condition: template + value_template: '{{ (trigger.id == ''motion-off'' and is_state(''input_boolean.night_mode'',''on'')) + and (is_state(''input_boolean.kallen_sleeping'',''on'') or is_state(''input_boolean.kallen_overnight'',''on'')) + }}' + alias: Motion Off + sequence: + - service: timer.start + target: + entity_id: timer.living_room_motion_timer + data: + duration: '{% from ''time.jinja'' import timer_duration %} {{ timer_duration(''input_number.living_room_lights_off_delay'') + }} + + ' + - conditions: + - condition: trigger + id: timer-finished + alias: Timer Finished + sequence: + - service: light.turn_off + target: + entity_id: + - light.living_room_lights + - light.tina_desk_lights + - light.mud_room_overhead + - light.downstairs_bathroom_lights + - light.dining_room_lamp + data: {} + - service: script.stairwell_led_strip + data: + color_temp_kelvin: 2000 + brightness: '{{ 50 if is_state(''binary_sensor.early_night_mode'',''on'') + else 255 }}' + - delay: + seconds: 5 + - if: + - condition: state + entity_id: binary_sensor.early_night_mode + state: 'off' + then: + - service: light.turn_off + target: + entity_id: light.stairwell_led_strip + data: {} + mode: restart +- id: '1696286192013' + alias: Tina Desk Lights Handler + description: Handles turning on the desk lights with smart scene selection and also + turning them off + 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 + - platform: state + entity_id: light.tina_desk_lights + from: 'on' + to: 'off' + id: lights-off + - platform: state + entity_id: light.tina_desk_lights + from: 'off' + to: 'on' + id: lights-on + - platform: state + entity_id: binary_sensor.tina_desktop_on + from: 'off' + to: 'on' + id: computer-on + condition: [] + action: + - if: + - condition: or + conditions: + - condition: trigger + id: toggle-on + - condition: trigger + id: reset + - condition: trigger + id: computer-on + then: + - 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 + then: + - service: light.turn_off + target: + entity_id: light.tina_desk_lights + data: {} + - if: + - condition: trigger + id: lights-off + then: + - if: + - condition: state + entity_id: input_boolean.tina_desk_lights + state: 'on' + then: + - service: input_boolean.turn_off + target: + entity_id: input_boolean.tina_desk_lights + data: {} + - if: + - condition: trigger + id: lights-on + then: + - if: + - condition: state + entity_id: input_boolean.tina_desk_lights + state: 'off' + then: + - service: input_boolean.turn_on + target: + entity_id: input_boolean.tina_desk_lights + data: {} + - delay: + seconds: 2 + alias: Prevent script from re-triggering when boolean is turned on + mode: single +- id: '1696286403914' + alias: Basement Lights Handling + description: Handles the presence-related automation of lights in the basement + trigger: + - platform: state + entity_id: binary_sensor.basement_studio_door + from: 'off' + to: 'on' + id: door-open + - platform: state + entity_id: binary_sensor.basement_studio_door + from: 'on' + to: 'off' + 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.basement_occupied + from: 'off' + to: 'on' + id: basement-occupied + - platform: state + entity_id: binary_sensor.basement_occupied + from: 'on' + to: 'off' + id: basement-unoccupied + - platform: state + entity_id: + - input_boolean.studio_quiet + - input_boolean.recliner_mode + from: 'off' + to: 'on' + id: studio-quiet + - platform: state + entity_id: sensor.twitch_ironnerd24 + from: offline + to: streaming + id: stream-started + condition: + - condition: state + entity_id: input_boolean.studio_quiet + state: 'off' + action: + - choose: + - conditions: + - condition: trigger + id: door-open + sequence: + - if: + - condition: state + entity_id: light.basement_studio_lights + state: 'off' + then: + - service: light.turn_on + target: + entity_id: light.basement_studio_lights + data: {} + - service: timer.cancel + target: + entity_id: timer.basement_studio_door_timer + data: {} + - conditions: + - condition: trigger + id: door-closed + sequence: + - if: + - condition: state + entity_id: binary_sensor.basement_occupied + state: 'off' + then: + - service: timer.start + target: + entity_id: timer.basement_studio_door_timer + data: + duration: '{% from ''time.jinja'' import timer_duration %} {{ timer_duration(''input_number.basement_studio_lights_off_delay'') + }} + + ' + - conditions: + - condition: trigger + id: + - basement-occupied + - studio-quiet + - stream-started + sequence: + - service: timer.cancel + target: + entity_id: timer.basement_studio_door_timer + data: {} + - conditions: + - condition: trigger + id: basement-unoccupied + sequence: + - if: + - condition: state + entity_id: light.basement_studio_lights + state: 'on' + then: + - if: + - condition: state + entity_id: timer.basement_studio_door_timer + state: idle + then: + - service: timer.start + target: + entity_id: timer.basement_studio_door_timer + data: + duration: '{% from ''time.jinja'' import timer_duration %} {{ timer_duration(''input_number.basement_studio_lights_off_delay'') + }} + + ' + - conditions: + - condition: trigger + id: timer-finished + sequence: + - service: light.turn_off + target: + entity_id: light.basement_studio_lights + data: {} + mode: restart +- id: '1696286481890' + alias: Recliner Mode + description: For naptime in the basement + trigger: + - platform: state + entity_id: input_boolean.recliner_mode + from: 'off' + to: 'on' + id: recliner-on + - platform: state + entity_id: input_boolean.recliner_mode + from: 'on' + to: 'off' + id: recliner-off + condition: [] + action: + - choose: + - conditions: + - condition: trigger + id: recliner-on + sequence: + - service: input_select.select_option + target: + entity_id: input_select.basement_studio_scenes + data: + option: Stairwell + - service: input_boolean.turn_on + target: + entity_id: + - input_boolean.white_noise_basement + - input_boolean.studio_quiet + data: {} + - service: script.turn_on + target: + entity_id: script.asus_laptop_displays_off + data: {} + - if: + - condition: template + value_template: "{% if is_state('media_player.basement_tv','playing') %}\n + \ false\n{% elif is_state('media_player.basement_tv','paused') or is_state('media_player.basement_tv','idle') + %}\n {{ state_attr('media_player.basement_tv','app_name') in ['TV','Android + TV Launcher'] }}\n{% else %}\n false\n{% endif %}\n" + then: + - service: media_player.turn_off + target: + entity_id: media_player.basement_tv + data: {} + - if: + - condition: not + conditions: + - condition: state + entity_id: media_player.tony_asus + state: playing + then: + - service: script.turn_on + target: + entity_id: script.tony_desktop_displays_off + data: {} + - conditions: + - condition: trigger + id: recliner-off + sequence: + - service: input_select.select_option + target: + entity_id: input_select.basement_studio_scenes + data: + option: Adaptive + - service: input_boolean.turn_off + target: + entity_id: + - input_boolean.white_noise_basement + - input_boolean.studio_quiet + data: {} + - service: script.turn_on + target: + entity_id: + - script.tony_desktop_displays_on + - script.asus_laptop_displays_on + data: {} + - service: media_player.turn_on + target: + entity_id: media_player.basement_tv + data: {} + mode: restart +- id: '1696286540644' + alias: Basement Lights Adaptive Resync + description: Deals with situations where the basement lights should be adaptive + but end up out of sync + trigger: + - platform: state + entity_id: binary_sensor.basement_lights_sync_issue + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: input_boolean.studio_quiet + state: 'off' + - condition: template + value_template: '{{ is_state_attr(''light.basement_studio_lights'',''color_mode'',''color_temp'') + }}' + action: + - service: adaptive_lighting.apply + data: + entity_id: switch.adaptive_lighting_basement_studio + adapt_brightness: '{{ is_state(''switch.adaptive_lighting_adapt_brightness_basement_studio'',''on'') + }}' + adapt_color: '{{ is_state(''switch.adaptive_lighting_adapt_color_basement_studio'',''on'') + }}' + mode: restart +- id: '1696286644401' + alias: Basement LED Strip Reset + description: Power cycle the LED strip when it goes unavailable + trigger: + - platform: state + entity_id: light.basement_led_strip_1 + to: unavailable + for: + minutes: 5 + id: offline + - platform: state + entity_id: input_button.basement_led_strip_reset + not_to: + - unavailable + - unknown + id: button + - platform: time + at: 00:00:00 + id: midnight + condition: [] + action: + - choose: + - conditions: + - condition: and + conditions: + - condition: trigger + id: + - offline + - button + sequence: + - if: + - condition: template + value_template: '{{ is_state(''input_boolean.studio_quiet'',''off'') and + is_state(''sensor.twitch_ironnerd24'',''offline'') and states(''switch.basement_led_strip'') + not in [''unknown'',''unavailable''] }}' + then: + - repeat: + while: + - condition: state + entity_id: light.basement_led_strip_1 + state: unavailable + - condition: template + value_template: '{{ repeat.index <= 10 }}' + sequence: + - service: input_number.increment + target: + entity_id: input_number.basement_led_strip_resets + data: {} + - service: switch.turn_off + target: + entity_id: switch.basement_led_strip + data: {} + - delay: + seconds: 20 + - service: switch.turn_on + target: + entity_id: switch.basement_led_strip + data: {} + - delay: + seconds: 30 + - conditions: + - condition: trigger + id: midnight + sequence: + - service: input_number.set_value + target: + entity_id: input_number.basement_led_strip_resets + data: + value: 0 + mode: single +- id: '1696286732266' + alias: Living Room Lights Adaptive Resync + description: Deals with situations where the living room lights should be adaptive + but end up out of sync + trigger: + - platform: state + entity_id: binary_sensor.living_room_sync_issue + from: 'off' + to: 'on' + condition: + - condition: template + value_template: '{{ is_state_attr(''light.living_room_lights'',''color_mode'',''color_temp'') + }}' + action: + - service: adaptive_lighting.apply + data: + entity_id: switch.adaptive_lighting_living_room + adapt_brightness: '{{ is_state(''switch.adaptive_lighting_adapt_brightness_living_room'',''on'') + }}' + adapt_color: '{{ is_state(''switch.adaptive_lighting_adapt_color_living_room'',''on'') + }}' + mode: restart +- id: '1696286814384' + alias: Vacation Lighting + description: Turns on lights for helpers who come over (such as to take care of + the cats) while we are gone + trigger: + - platform: state + entity_id: binary_sensor.front_door + to: 'on' + id: door + - platform: event + event_type: timer.finished + event_data: + entity_id: timer.vacation_helper + id: timer-finished + condition: + - condition: state + entity_id: input_boolean.vacation_mode + state: 'on' + action: + - choose: + - conditions: + - condition: trigger + id: door + sequence: + - service: input_boolean.turn_on + target: + entity_id: input_boolean.audible_notifications + data: {} + - service: light.turn_on + target: + entity_id: + - light.basement_studio_lights + - light.first_floor_lights + - light.second_floor_lights + data: {} + - service: switch.turn_off + target: + entity_id: switch.presence_simulation + data: {} + - delay: + seconds: 3 + - service: input_select.select_option + target: + entity_id: + - input_select.basement_studio_scenes + - input_select.living_room_scenes + - input_select.downstairs_bathroom_scenes + - input_select.dining_room_lamp_scenes + - input_select.mud_room_scenes + - input_select.upstairs_hallway_scenes + - input_select.upstairs_bathroom_scenes + - input_select.master_bedroom_scenes + - input_select.kallen_bedroom_scenes + - input_select.emma_bedroom_scenes + data: + option: Adaptive + - service: input_select.select_option + target: + entity_id: input_select.tina_desk_scenes + data: + option: Evening Mode + - service: timer.start + target: + entity_id: timer.vacation_helper + data: + duration: 01:00:00 + - service: script.speech_engine + data: + who: living_room + message: Welcome, vacation helper. I have turned on every light in the house + for you. They will remain on for one hour. Thank you for your help. + type: alert + - conditions: + - condition: trigger + id: timer-finished + sequence: + - service: light.turn_off + target: + entity_id: + - light.basement_studio_lights + - light.first_floor_lights + - light.second_floor_lights + data: {} + - service: switch.turn_on + target: + entity_id: switch.presence_simulation + data: {} + - service: input_boolean.turn_off + target: + entity_id: input_boolean.audible_notifications + data: {} + mode: restart diff --git a/packages/lighting_and_scenes.yaml b/packages/lighting_and_scenes.yaml index 619adfc..3b9f08a 100644 --- a/packages/lighting_and_scenes.yaml +++ b/packages/lighting_and_scenes.yaml @@ -563,1473 +563,6 @@ switch: animate_brightness: True animate_color: True -automation: - - id: 477e6e8a-4e33-4268-8c2d-f39902c0d64f - alias: Living Room Night Lighting - description: Provide lighting in case anyone needs to go downstairs in the middle of the night. - mode: restart - trigger: - - platform: state - entity_id: binary_sensor.living_room_motion - from: 'off' - to: 'on' - id: motion-on - - platform: state - entity_id: binary_sensor.living_room_motion - from: 'on' - to: 'off' - id: motion-off - - platform: event - event_type: timer.finished - event_data: - entity_id: timer.living_room_motion_timer - id: timer-finished - condition: - - condition: state - entity_id: binary_sensor.people_present - state: 'on' - - condition: state - entity_id: input_boolean.vacation_mode - state: 'off' - action: - - choose: - - conditions: "{{ (trigger.id == 'motion-on' and is_state('input_boolean.night_mode','on')) and (is_state('input_boolean.kallen_sleeping','on') or is_state('input_boolean.kallen_overnight','on')) }}" - sequence: - - service: timer.cancel - target: - entity_id: timer.living_room_motion_timer - - service: light.turn_on - target: - entity_id: light.first_floor_lights - - service: script.stairwell_led_strip - data: - color_temp_kelvin: 2000 - brightness: 255 - - service: input_select.select_option - target: - entity_id: - - input_select.living_room_scenes - - input_select.tina_lamp_scenes - - input_select.mud_room_scenes - - input_select.downstairs_bathroom_scenes - - input_select.dining_room_lamp_scenes - data: - option: Adaptive - - conditions: "{{ (trigger.id == 'motion-off' and is_state('input_boolean.night_mode','on')) and (is_state('input_boolean.kallen_sleeping','on') or is_state('input_boolean.kallen_overnight','on')) }}" - sequence: - - service: timer.start - target: - entity_id: timer.living_room_motion_timer - data: - duration: > - {% from 'time.jinja' import timer_duration %} - {{ timer_duration('input_number.living_room_lights_off_delay') }} - - conditions: - - condition: trigger - id: timer-finished - sequence: - - service: light.turn_off - target: - entity_id: - - light.living_room_lights - - light.tina_desk_lights - - light.mud_room_overhead - - light.downstairs_bathroom_lights - - light.dining_room_lamp - - service: script.stairwell_led_strip - data: - color_temp_kelvin: 2000 - brightness: "{{ 50 if is_state('binary_sensor.early_night_mode','on') else 255 }}" - - delay: - seconds: 5 - - if: - - condition: state - entity_id: binary_sensor.early_night_mode - state: 'off' - then: - - service: light.turn_off - target: - entity_id: light.stairwell_led_strip - - - 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: single - 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 - - platform: state - entity_id: light.tina_desk_lights - from: 'on' - to: 'off' - id: lights-off - - platform: state - entity_id: light.tina_desk_lights - from: 'off' - to: 'on' - id: lights-on - - platform: state - entity_id: binary_sensor.tina_desktop_on - from: 'off' - to: 'on' - id: computer-on - action: - - if: - - condition: or - conditions: - - condition: trigger - id: toggle-on - - condition: trigger - id: reset - - condition: trigger - id: computer-on - then: - - 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 - then: - - service: light.turn_off - target: - entity_id: light.tina_desk_lights - - if: - - condition: trigger - id: lights-off - then: - - if: - - condition: state - entity_id: input_boolean.tina_desk_lights - state: 'on' - then: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.tina_desk_lights - - if: - - condition: trigger - id: lights-on - then: - - if: - - condition: state - entity_id: input_boolean.tina_desk_lights - state: 'off' - then: - - service: input_boolean.turn_on - target: - entity_id: input_boolean.tina_desk_lights - - delay: - seconds: 2 - # The delay is to prevent the boolean from re-running the automation if the lights were turned on manually - - - id: 47645bcf-a6ed-4c34-8ece-8daed4b10d9a - alias: Basement Lights Handling - description: Handles the presence-related automation of lights in the basement - mode: restart - trigger: - - platform: state - entity_id: binary_sensor.basement_studio_door - from: 'off' - to: 'on' - id: door-open - - platform: state - entity_id: binary_sensor.basement_studio_door - from: 'on' - to: 'off' - 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.basement_occupied - from: 'off' - to: 'on' - id: basement-occupied - - platform: state - entity_id: binary_sensor.basement_occupied - from: 'on' - to: 'off' - id: basement-unoccupied - - platform: state - entity_id: - - input_boolean.studio_quiet - - input_boolean.recliner_mode - from: 'off' - to: 'on' - id: studio-quiet - - platform: state - entity_id: sensor.twitch_ironnerd24 - from: 'offline' - to: 'streaming' - id: stream-started - condition: - - condition: state - entity_id: input_boolean.studio_quiet - state: 'off' - action: - choose: - - conditions: - - condition: trigger - id: door-open - sequence: - - if: - - condition: state - entity_id: light.basement_studio_lights - state: 'off' - then: - - service: light.turn_on - target: - entity_id: light.basement_studio_lights - - service: timer.cancel - target: - entity_id: timer.basement_studio_door_timer - - conditions: - - condition: trigger - id: door-closed - sequence: - - if: - - condition: state - entity_id: binary_sensor.basement_occupied - state: 'off' - then: - - service: timer.start - target: - entity_id: timer.basement_studio_door_timer - data: - duration: > - {% from 'time.jinja' import timer_duration %} - {{ timer_duration('input_number.basement_studio_lights_off_delay') }} - - conditions: - - condition: trigger - id: - - basement-occupied - - studio-quiet - - stream-started - sequence: - - service: timer.cancel - target: - entity_id: timer.basement_studio_door_timer - - conditions: - - condition: trigger - id: basement-unoccupied - sequence: - - if: - - condition: state - entity_id: light.basement_studio_lights - state: 'on' - then: - - if: - - condition: state - entity_id: timer.basement_studio_door_timer - state: idle - then: - - service: timer.start - target: - entity_id: timer.basement_studio_door_timer - data: - duration: > - {% from 'time.jinja' import timer_duration %} - {{ timer_duration('input_number.basement_studio_lights_off_delay') }} - - conditions: - - condition: trigger - id: timer-finished - sequence: - - service: light.turn_off - target: - entity_id: light.basement_studio_lights - - - id: 7c3ca098-d0bb-49bf-a323-fc471dcf81d2 - alias: Recliner Mode - description: For naptime in the basement - mode: restart - trigger: - - platform: state - entity_id: input_boolean.recliner_mode - from: 'off' - to: 'on' - id: recliner-on - - platform: state - entity_id: input_boolean.recliner_mode - from: 'on' - to: 'off' - id: recliner-off - action: - - choose: - - conditions: - - condition: trigger - id: recliner-on - sequence: - - service: input_select.select_option - target: - entity_id: input_select.basement_studio_scenes - data: - option: Stairwell - - service: input_boolean.turn_on - target: - entity_id: - - input_boolean.white_noise_basement - - input_boolean.studio_quiet - - service: script.turn_on - target: - entity_id: script.asus_laptop_displays_off - - if: - - condition: template - value_template: > - {% if is_state('media_player.basement_tv','playing') %} - false - {% elif is_state('media_player.basement_tv','paused') or is_state('media_player.basement_tv','idle') %} - {{ state_attr('media_player.basement_tv','app_name') in ['TV','Android TV Launcher'] }} - {% else %} - false - {% endif %} - then: - - service: media_player.turn_off - target: - entity_id: media_player.basement_tv - - if: - - condition: not - conditions: - - condition: state - entity_id: media_player.tony_asus - state: 'playing' - then: - - service: script.turn_on - target: - entity_id: script.tony_desktop_displays_off - - conditions: - - condition: trigger - id: recliner-off - sequence: - - service: input_select.select_option - target: - entity_id: input_select.basement_studio_scenes - data: - option: Adaptive - - service: input_boolean.turn_off - target: - entity_id: - - input_boolean.white_noise_basement - - input_boolean.studio_quiet - - service: script.turn_on - target: - entity_id: - - script.tony_desktop_displays_on - - script.asus_laptop_displays_on - - service: media_player.turn_on - target: - entity_id: media_player.basement_tv - - - id: f4195b9a-3416-44b2-bef7-9826a126f0f2 - alias: Basement Lights Adaptive Resync - description: Deals with situations where the basement lights should be adaptive but end up out of sync - mode: restart - trigger: - - platform: state - entity_id: binary_sensor.basement_lights_sync_issue - from: 'off' - to: 'on' - condition: - - condition: state - entity_id: input_boolean.studio_quiet - state: 'off' - - condition: template - value_template: "{{ is_state_attr('light.basement_studio_lights','color_mode','color_temp') }}" - action: - - service: adaptive_lighting.apply - data: - entity_id: switch.adaptive_lighting_basement_studio - adapt_brightness: "{{ is_state('switch.adaptive_lighting_adapt_brightness_basement_studio','on') }}" - adapt_color: "{{ is_state('switch.adaptive_lighting_adapt_color_basement_studio','on') }}" - - - id: 75198e15-1e4a-4b1d-824a-23c9eaa73057 - alias: Basement LED Strip Reset - description: Power cycle the LED strip when it goes unavailable - mode: single - trigger: - - platform: state - entity_id: light.basement_led_strip_1 - to: 'unavailable' - for: - minutes: 5 - id: offline - - platform: state - entity_id: input_button.basement_led_strip_reset - not_to: - - unavailable - - unknown - id: button - - platform: time - at: "00:00:00" - id: midnight - action: - - choose: - - conditions: - - condition: and - conditions: - - condition: trigger - id: - - offline - - button - sequence: - - if: - - condition: template - value_template: "{{ is_state('input_boolean.studio_quiet','off') and is_state('sensor.twitch_ironnerd24','offline') and states('switch.basement_led_strip') not in ['unknown','unavailable'] }}" - then: - - repeat: - while: - - condition: state - entity_id: light.basement_led_strip_1 - state: 'unavailable' - - condition: template - value_template: "{{ repeat.index <= 10 }}" - sequence: - - service: input_number.increment - target: - entity_id: input_number.basement_led_strip_resets - - service: switch.turn_off - target: - entity_id: switch.basement_led_strip - - delay: - seconds: 20 - - service: switch.turn_on - target: - entity_id: switch.basement_led_strip - - delay: - seconds: 30 - - conditions: - - condition: trigger - id: midnight - sequence: - - service: input_number.set_value - target: - entity_id: input_number.basement_led_strip_resets - data: - value: 0 - - - id: 3f05cd0d-bd6e-42c7-884d-3d1cbfda46e0 - alias: Living Room Lights Adaptive Resync - description: Deals with situations where the living room lights should be adaptive but end up out of sync - mode: restart - trigger: - - platform: state - entity_id: binary_sensor.living_room_sync_issue - from: 'off' - to: 'on' - condition: - - condition: template - value_template: "{{ is_state_attr('light.living_room_lights','color_mode','color_temp') }}" - action: - - service: adaptive_lighting.apply - data: - entity_id: switch.adaptive_lighting_living_room - adapt_brightness: "{{ is_state('switch.adaptive_lighting_adapt_brightness_living_room','on') }}" - adapt_color: "{{ is_state('switch.adaptive_lighting_adapt_color_living_room','on') }}" - - - id: 21771a12-1120-4d65-aabd-d499c4a30bf1 - alias: Vacation Lighting - description: Turns on lights for helpers who come over (such as to take care of the cats) while we are gone - mode: restart - trigger: - - platform: state - entity_id: binary_sensor.front_door - to: 'on' - id: door - - platform: event - event_type: timer.finished - event_data: - entity_id: timer.vacation_helper - id: timer-finished - condition: - - condition: state - entity_id: input_boolean.vacation_mode - state: 'on' - action: - - choose: - - conditions: - - condition: trigger - id: door - sequence: - - service: input_boolean.turn_on - target: - entity_id: input_boolean.audible_notifications - - service: light.turn_on - target: - entity_id: - - light.basement_studio_lights - - light.first_floor_lights - - light.second_floor_lights - - service: switch.turn_off - target: - entity_id: switch.presence_simulation - - delay: - seconds: 3 - - service: input_select.select_option - target: - entity_id: - - input_select.basement_studio_scenes - - input_select.living_room_scenes - - input_select.downstairs_bathroom_scenes - - input_select.dining_room_lamp_scenes - - input_select.mud_room_scenes - - input_select.upstairs_hallway_scenes - - input_select.upstairs_bathroom_scenes - - input_select.master_bedroom_scenes - - input_select.kallen_bedroom_scenes - - input_select.emma_bedroom_scenes - data: - option: Adaptive - - service: input_select.select_option - target: - entity_id: input_select.tina_desk_scenes - data: - option: Evening Mode - - service: timer.start - target: - entity_id: timer.vacation_helper - data: - duration: "01:00:00" - - service: script.speech_engine - data: - who: living_room - message: >- - Welcome, vacation helper. I have turned on every light in the house for you. - They will remain on for one hour. Thank you for your help. - type: alert - - conditions: - - condition: trigger - id: timer-finished - sequence: - - service: light.turn_off - target: - entity_id: - - light.basement_studio_lights - - light.first_floor_lights - - light.second_floor_lights - - service: switch.turn_on - target: - entity_id: switch.presence_simulation - - service: input_boolean.turn_off - target: - entity_id: input_boolean.audible_notifications - -script: - stairwell_led_strip: - alias: Stairwell LED Strip - description: This script handles a few settings for the stairwell LED strip, for convenience - mode: restart - sequence: - - variables: - brt1: 50 - brt2: 100 - brt3: 150 - brtmax: 255 - colortemp: > - {% if is_state('input_boolean.goodnight','off') and - is_state('input_boolean.give_me_darkness','off') and - is_state('binary_sensor.early_night_mode','off') - %} - 4000 - {% else %} - 2000 - {% endif %} - - if: - - condition: template - value_template: "{{ brightness == 'reset' }}" - then: - - service: light.turn_on - target: - entity_id: light.stairwell_led_strip - data: - brightness: > - {% if is_state('input_boolean.goodnight','on') %} - {{ brt1 }} - {% elif is_state('input_boolean.give_me_darkness','on') %} - {{ brt2 }} - {% elif is_state('binary_sensor.early_night_mode','on') %} - {{ brt3 }} - {% else %} - {{ brtmax }} - {% endif %} - color_temp_kelvin: "{{ colortemp }}" - else: - - service: light.turn_on - target: - entity_id: light.stairwell_led_strip - data: - brightness: "{{ brightness|default(brt3) }}" - color_temp_kelvin: "{{ color_temp_kelvin|default(colortemp) }}" - - adaptive_on_first_floor: - alias: Adaptive on First Floor - sequence: - - if: - - condition: state - entity_id: light.living_room_lights - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.living_room_scenes - data: - option: Adaptive - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_living_room - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_living_room - - service: input_text.set_value - target: - entity_id: input_text.living_room_selected_scene - data: - value: Adaptive - - if: - - condition: state - entity_id: light.dining_room_lamp - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.dining_room_lamp_scenes - data: - option: Adaptive - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_dining_room_lamp - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_dining_room_lamp - - service: input_text.set_value - target: - entity_id: input_text.dining_room_lamp_selected_scene - data: - value: Adaptive - - if: - - condition: or - conditions: - - condition: state - entity_id: light.tina_lamp - state: 'on' - - condition: state - entity_id: light.tina_desk_strip - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.tina_desk_scenes - data: - option: Reset - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_tina_lamp - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_tina_lamp - - if: - - condition: state - entity_id: light.downstairs_bathroom_lights - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.downstairs_bathroom_scenes - data: - option: Adaptive - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_downstairs_bathroom - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_downstairs_bathroom - - service: input_text.set_value - target: - entity_id: input_text.downstairs_bathroom_selected_scene - data: - value: Adaptive - - if: - - condition: state - entity_id: light.mud_room_overhead - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.mud_room_scenes - data: - option: Adaptive - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_mud_room - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_mud_room - - service: input_text.set_value - target: - entity_id: input_text.mud_room_selected_scene - data: - value: Adaptive - - adaptive_on_second_floor: - alias: 'Adaptive on Second Floor' - sequence: - - if: - - condition: state - entity_id: binary_sensor.early_night_mode - state: 'on' - then: - - service: script.stairwell_led_strip - data: - brightness: reset - - if: - - condition: state - entity_id: light.hallway_overhead - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_hallway_scenes - data: - option: Adaptive - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_upstairs_hallway - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_upstairs_hallway - - service: input_text.set_value - target: - entity_id: input_text.upstairs_hallway_selected_scene - data: - value: Adaptive - - if: - - condition: state - entity_id: light.master_bedroom_lights - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.master_bedroom_scenes - data: - option: Adaptive - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_master_bedroom - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_master_bedroom - - service: input_text.set_value - target: - entity_id: input_text.master_bedroom_selected_scene - data: - value: Adaptive - - if: - - condition: state - entity_id: light.kallen_bedroom_lights - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.kallen_bedroom_scenes - data: - option: Adaptive - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_kallen_bedroom - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_kallen_bedroom - - service: input_text.set_value - target: - entity_id: input_text.kallen_bedroom_selected_scene - data: - value: Adaptive - - if: - - condition: state - entity_id: light.emma_bedroom_light - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.emma_bedroom_scenes - data: - option: Adaptive - else: - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_emma_bedroom - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_emma_bedroom - - service: input_text.set_value - target: - entity_id: input_text.emma_bedroom_selected_scene - data: - value: Adaptive - - if: - - condition: state - entity_id: input_boolean.shower_mode - state: 'off' - then: - - if: - - condition: state - entity_id: binary_sensor.upstairs_bathroom_occupied - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_bathroom_scenes - data: - option: Adaptive - else: - - if: - - condition: state - entity_id: binary_sensor.early_night_mode - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_bathroom_scenes - data: - option: Nightlight - else: - - service: light.turn_off - target: - entity_id: light.upstairs_bathroom_lights - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_upstairs_bathroom - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_sleep_mode_upstairs_bathroom - - service: input_text.set_value - target: - entity_id: input_text.upstairs_bathroom_selected_scene - data: - value: Adaptive - - bright_on_first_floor: - alias: 'Bright on First Floor' - sequence: - - service: light.turn_on - target: - entity_id: - - light.living_room_lights - - light.downstairs_bathroom_lights - - light.dining_room_lamp - - light.mud_room_overhead - - service: input_boolean.turn_on - target: - entity_id: input_boolean.tina_desk_lights - - delay: - seconds: 1 - - service: input_select.select_option - target: - entity_id: - - input_select.living_room_scenes - - input_select.downstairs_bathroom_scenes - - input_select.mud_room_scenes - - input_select.dining_room_lamp_scenes - data: - option: Bright - - service: light.turn_on - target: - entity_id: - - light.tina_desk_strip - - light.tina_lamp - data: - color_temp_kelvin: 2700 - - service: light.turn_on - target: - entity_id: - - light.tina_lamp - - light.tina_desk_strip - data: - brightness: 255 - - bright_on_second_floor: - alias: 'Bright on Second Floor' - sequence: - - service: script.stairwell_led_strip - data: - brightness: 255 - - service: light.turn_on - target: - entity_id: - - light.hallway_overhead - - light.master_bedroom_lights - - if: - - condition: state - entity_id: input_boolean.shower_mode - state: 'off' - then: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_bathroom_scenes - data: - option: Bright - - if: - - condition: state - entity_id: input_boolean.kallen_sleeping - state: 'off' - then: - - service: light.turn_on - target: - entity_id: light.kallen_bedroom_lights - - if: - - condition: state - entity_id: input_boolean.emma_sleeping - state: 'off' - then: - - service: light.turn_on - target: - entity_id: light.emma_bedroom_light - - delay: - seconds: 1 - - service: input_select.select_option - target: - entity_id: - - input_select.upstairs_hallway_scenes - - input_select.master_bedroom_scenes - data: - option: Bright - - if: - - condition: state - entity_id: input_boolean.shower_mode - state: 'off' - then: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_bathroom_scenes - data: - option: Bright - - if: - - condition: template - value_template: "{{ is_state('input_boolean.kallen_sleeping','off') or (is_state('input_boolean.kallen_sleeping','on') and is_state('light.kallen_bedroom_lights','on')) }}" - then: - - service: input_select.select_option - target: - entity_id: input_select.kallen_bedroom_scenes - data: - option: Bright - - if: - - condition: template - value_template: "{{ is_state('input_boolean.emma_sleeping','off') or (is_state('input_boolean.emma_sleeping','on') and is_state('light.emma_bedroom_light','on')) }}" - then: - - service: input_select.select_option - target: - entity_id: input_select.emma_bedroom_scenes - data: - option: Bright - - evening_on_first_floor: - alias: 'Evening on First Floor' - sequence: - - choose: - - conditions: - - condition: state - entity_id: binary_sensor.early_night_mode - state: 'off' - sequence: - - stop: "This scene does nothing during daytime" - - conditions: - - condition: state - entity_id: input_boolean.give_me_darkness - state: 'on' - sequence: - - if: - - condition: state - entity_id: person.christina_stork - state: home - then: - - service: input_select.select_option - target: - entity_id: input_select.tina_desk_scenes - data: - option: Night Mode - - choose: - - conditions: - - condition: state - entity_id: input_boolean.guest_mode - state: 'off' - sequence: - - if: - - condition: template - value_template: "{{ give_me_darkness == 1 }}" - then: - - if: - - condition: state - entity_id: timer.downstairs_bathroom_lights_timer - state: idle - then: - - service: light.turn_off - target: - entity_id: - - light.downstairs_bathroom_lights - - service: input_select.select_option - target: - entity_id: - - input_select.mud_room_scenes - data: - option: Nightlight - else: - - service: light.turn_off - target: - entity_id: - - light.living_room_lights - - if: - - condition: state - entity_id: timer.downstairs_bathroom_lights_timer - state: idle - then: - - service: light.turn_off - target: - entity_id: - - light.downstairs_bathroom_lights - - service: input_select.select_option - target: - entity_id: - - input_select.mud_room_scenes - - input_select.dining_room_lamp_scenes - data: - option: Nightlight - - conditions: - - condition: state - entity_id: input_boolean.guest_mode - state: 'on' - sequence: - - if: - - condition: state - entity_id: timer.downstairs_bathroom_lights_timer - state: idle - then: - - service: light.turn_off - target: - entity_id: - - light.downstairs_bathroom_lights - - conditions: - - condition: state - entity_id: input_boolean.give_me_darkness - state: 'off' - sequence: - - if: - - condition: template - value_template: "{{ sunset_lights == 1 }}" - then: - - service: light.turn_on - target: - entity_id: - - light.living_room_lights - - light.mud_room_overhead - - service: input_select.select_option - target: - entity_id: - - input_select.living_room_scenes - - input_select.mud_room_scenes - data: - option: Adaptive - else: - - service: light.turn_off - target: - entity_id: - - light.dining_room_lamp - - if: - - condition: state - entity_id: timer.downstairs_bathroom_lights_timer - state: idle - then: - - service: light.turn_off - target: - entity_id: light.downstairs_bathroom_lights - - service: input_boolean.turn_off - target: - entity_id: input_boolean.tina_desk_lights - - service: light.turn_on - target: - entity_id: - - light.living_room_lights - - light.mud_room_overhead - - service: input_select.select_option - target: - entity_id: - - input_select.living_room_scenes - - input_select.mud_room_scenes - data: - option: Adaptive - - evening_on_second_floor: - alias: 'Evening on Second Floor' - sequence: - - condition: state - entity_id: binary_sensor.early_night_mode - state: 'on' - - choose: - - conditions: - - condition: state - entity_id: input_boolean.give_me_darkness - state: 'on' - sequence: - - service: script.stairwell_led_strip - data: - color_temp_kelvin: 2000 - brightness: 100 - - service: input_select.select_option - target: - entity_id: - - input_select.upstairs_hallway_scenes - data: - option: Nightlight - - if: - - condition: state - entity_id: input_boolean.shower_mode - state: 'off' - then: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_bathroom_scenes - data: - option: > - {% if is_state('binary_sensor.upstairs_bathroom_occupied','on') %} - Adaptive - {% else %} - Nightlight - {% endif %} - - service: light.turn_off - target: - area_id: - - kallen_bedroom - - master_bedroom - - emma_bedroom - - delay: - seconds: 1 - - service: switch.turn_on - target: - entity_id: - - switch.adaptive_lighting_kallen_bedroom - - switch.adaptive_lighting_master_bedroom - - switch.adaptive_lighting_emma_bedroom - - service: switch.turn_off - target: - entity_id: - - switch.adaptive_lighting_sleep_mode_kallen_bedroom - - switch.adaptive_lighting_sleep_mode_master_bedroom - - switch.adaptive_lighting_sleep_mode_emma_bedroom - - service: input_text.set_value - target: - entity_id: - - input_text.kallen_bedroom_selected_scene - - input_text.master_bedroom_selected_scene - - input_text.emma_bedroom_selected_scene - data: - value: Adaptive - - conditions: - - condition: state - entity_id: input_boolean.give_me_darkness - state: 'off' - sequence: - - service: script.stairwell_led_strip - data: - color_temp_kelvin: 2000 - brightness: 150 - - service: input_select.select_option - target: - entity_id: input_select.upstairs_hallway_scenes - data: - option: Nightlight - - if: - - condition: state - entity_id: input_boolean.shower_mode - state: 'off' - then: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_bathroom_scenes - data: - option: > - {% if is_state('binary_sensor.upstairs_bathroom_occupied','on') %} - Adaptive - {% else %} - Nightlight - {% endif %} - - if: - - condition: template - value_template: "{{ sunset_lights == 1 }}" - then: - - stop: "Sunset lights don't mess with bedroom light states before bedtime" - else: - - service: light.turn_off - target: - area_id: - - master_bedroom - - kallen_bedroom - - emma_bedroom - - delay: - seconds: 1 - - service: switch.turn_on - target: - entity_id: - - switch.adaptive_lighting_kallen_bedroom - - switch.adaptive_lighting_master_bedroom - - switch.adaptive_lighting_emma_bedroom - - service: switch.turn_off - target: - entity_id: - - switch.adaptive_lighting_sleep_mode_kallen_bedroom - - switch.adaptive_lighting_sleep_mode_master_bedroom - - switch.adaptive_lighting_sleep_mode_emma_bedroom - - service: input_text.set_value - target: - entity_id: - - input_text.kallen_bedroom_selected_scene - - input_text.master_bedroom_selected_scene - - input_text.emma_bedroom_selected_scene - data: - value: Adaptive - - goodnight_in_basement: - alias: 'Goodnight in Basement' - sequence: - - service: light.turn_off - target: - area_id: - - basement_studio - - furnace_room - - service: fan.turn_off - target: - entity_id: fan.basement_fan - - goodnight_on_first_floor: - alias: 'Goodnight on First Floor' - sequence: - - if: - - condition: state - entity_id: input_boolean.guest_mode - state: 'on' - then: - - service: light.turn_off - target: - area_id: - - dining_room - - downstairs_bathroom - - living_room - - tina_desk - - service: input_select.select_option - target: - entity_id: input_select.mud_room_scenes - data: - option: Nightlight - else: - - service: light.turn_off - target: - area_id: - - dining_room - - downstairs_bathroom - - living_room - - mud_room - - tina_desk - - goodnight_on_second_floor: - alias: 'Goodnight on Second Floor' - sequence: - - service: light.turn_off - target: - area_id: - - emma_bedroom - - kallen_bedroom - - master_bedroom - - master_bedroom_closet - - if: - - condition: state - entity_id: input_boolean.guest_mode - state: 'on' - then: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_hallway_scenes - data: - option: Nightlight - else: - - service: light.turn_off - target: - entity_id: light.hallway_overhead - - if: - - condition: state - entity_id: input_boolean.kallen_overnight - state: 'on' - then: - - service: light.turn_off - target: - area_id: upstairs_bathroom - else: - - service: input_select.select_option - target: - entity_id: input_select.upstairs_bathroom_scenes - data: - option: Single Nightlight - - service: script.stairwell_led_strip - data: - color_temp_kelvin: 2000 - brightness: 50 - - morning_scene: - alias: 'Morning Scene' - sequence: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.master_bedroom_sleeping - - if: - - condition: template - value_template: > - {% set weather = states('weather.iron_nerd_weather_station') %} - {{ weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] }} - then: - - if: - - condition: template - value_template: "{{ is_state('input_boolean.kallen_sleeping','off') and is_state('person.kallen_stork','home') }}" - then: - - service: light.turn_on - target: - entity_id: light.kallen_bedroom_lights - - if: - - condition: state - entity_id: input_boolean.emma_sleeping - state: 'off' - then: - - service: light.turn_on - target: - entity_id: light.emma_bedroom_light - - day_mode_in_tina_desk: - alias: Day Mode in Tina Desk - mode: restart - icon: mdi:palette - sequence: - - parallel: - - service: light.turn_on - target: - entity_id: light.tina_lamp_top - - service: light.turn_off - target: - entity_id: light.tina_lamp_side - - service: light.turn_on - target: - entity_id: light.tina_desk_strip - data: - rgb_color: - - 0 - - 255 - - 255 - brightness: 89 - - wait_template: "{{ is_state('light.tina_lamp_side','off') }}" - timeout: - seconds: 15 - continue_on_timeout: true - - service: switch.turn_on - target: - entity_id: switch.adaptive_lighting_tina_lamp - - evening_mode_in_tina_desk: - alias: Evening Mode in Tina Desk - mode: restart - icon: mdi:palette - sequence: - - parallel: - - service: light.turn_on - target: - entity_id: light.tina_lamp - - service: light.turn_on - target: - entity_id: light.tina_desk_strip - data: - rgb_color: - - 127 - - 0 - - 255 - brightness: 128 - - service: input_select.select_option - target: - entity_id: input_select.tina_lamp_scenes - data: - option: Adaptive - - night_mode_in_tina_desk: - alias: Night Mode in Tina Desk - mode: restart - icon: mdi:palette - sequence: - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_tina_lamp - - parallel: - - service: light.turn_on - target: - entity_id: light.tina_lamp - data: - rgb_color: - - 127 - - 0 - - 255 - brightness: 128 - - service: light.turn_on - target: - entity_id: light.tina_desk_strip - data: - rgb_color: - - 127 - - 0 - - 255 - brightness: 128 - - bright_mode_in_tina_desk: - alias: Bright Mode in Tina Desk - mode: restart - icon: mdi:palette - sequence: - - service: switch.turn_off - target: - entity_id: switch.adaptive_lighting_tina_lamp - - parallel: - - service: light.turn_on - target: - entity_id: light.tina_lamp - data: - rgb_color: - - 255 - - 210 - - 175 - brightness: 255 - - service: light.turn_on - target: - entity_id: light.tina_desk_strip - data: - rgb_color: - - 255 - - 210 - - 175 - brightness: 255 - #! Unless there is a good reason, do not define multi-room scenes below. #! Use scripts instead, to avoid some straight-up haunted house bullshit... diff --git a/scripts.yaml b/scripts.yaml index cfcf799..081eb0c 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -828,3 +828,953 @@ basement_shutdown: alias: Cancel the door timer since the lights are already off mode: restart icon: mdi:power +'1696286918470': + alias: Stairwell LED Strip + sequence: + - variables: + brt1: 50 + brt2: 100 + brt3: 150 + brtmax: 255 + colortemp: "{% if is_state('input_boolean.goodnight','off') and\n is_state('input_boolean.give_me_darkness','off') + and\n is_state('binary_sensor.early_night_mode','off')\n%}\n 4000\n{% + else %}\n 2000\n{% endif %}\n" + - if: + - condition: template + value_template: '{{ brightness == ''reset'' }}' + then: + - service: light.turn_on + target: + entity_id: light.stairwell_led_strip + data: + brightness: "{% if is_state('input_boolean.goodnight','on') %}\n {{ brt1 + }}\n{% elif is_state('input_boolean.give_me_darkness','on') %}\n {{ brt2 + }}\n{% elif is_state('binary_sensor.early_night_mode','on') %}\n {{ brt3 + }}\n{% else %}\n {{ brtmax }}\n{% endif %}\n" + color_temp_kelvin: '{{ colortemp }}' + else: + - service: light.turn_on + target: + entity_id: light.stairwell_led_strip + data: + brightness: '{{ brightness|default(brt3) }}' + color_temp_kelvin: '{{ color_temp_kelvin|default(colortemp) }}' + description: This script handles a few settings for the stairwell LED strip, for + convenience + mode: restart +adaptive_on_first_floor_2: + alias: Adaptive on First Floor + sequence: + - if: + - condition: state + entity_id: light.living_room_lights + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.living_room_scenes + data: + option: Adaptive + alias: Set adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_living_room + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_living_room + data: {} + - service: input_text.set_value + target: + entity_id: input_text.living_room_selected_scene + data: + value: Adaptive + alias: If living room lights are on + - if: + - condition: state + entity_id: light.dining_room_lamp + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.dining_room_lamp_scenes + data: + option: Adaptive + alias: Set adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_dining_room_lamp + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_dining_room_lamp + data: {} + - service: input_text.set_value + target: + entity_id: input_text.dining_room_lamp_selected_scene + data: + value: Adaptive + alias: If dining room lamp is on + - if: + - condition: or + conditions: + - condition: state + entity_id: light.tina_lamp + state: 'on' + - condition: state + entity_id: light.tina_desk_strip + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.tina_desk_scenes + data: + option: Reset + alias: Set Adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_tina_lamp + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_tina_lamp + data: {} + alias: If Tina's desk lights are on + - if: + - condition: state + entity_id: light.downstairs_bathroom_lights + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.downstairs_bathroom_scenes + data: + option: Adaptive + alias: Set adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_downstairs_bathroom + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_downstairs_bathroom + data: {} + - service: input_text.set_value + target: + entity_id: input_text.downstairs_bathroom_selected_scene + data: + value: Adaptive + alias: If downstairs bathroom lights are on + - if: + - condition: state + entity_id: light.mud_room_overhead + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.mud_room_scenes + data: + option: Adaptive + alias: Set adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_mud_room + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_mud_room + data: {} + - service: input_text.set_value + target: + entity_id: input_text.mud_room_selected_scene + data: + value: Adaptive + alias: If mud room light is on + mode: single +'1696287200179': + alias: Adaptive on Second Floor + sequence: + - if: + - condition: state + entity_id: binary_sensor.early_night_mode + state: 'on' + then: + - service: script.stairwell_led_strip + data: + brightness: reset + alias: If early night mode is on + - if: + - condition: state + entity_id: light.hallway_overhead + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_hallway_scenes + data: + option: Adaptive + alias: Set adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_upstairs_hallway + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_upstairs_hallway + data: {} + - service: input_text.set_value + target: + entity_id: input_text.upstairs_hallway_selected_scene + data: + value: Adaptive + alias: If hallway light is on + - if: + - condition: state + entity_id: light.master_bedroom_lights + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.master_bedroom_scenes + data: + option: Adaptive + alias: Set adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_master_bedroom + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_master_bedroom + data: {} + - service: input_text.set_value + target: + entity_id: input_text.master_bedroom_selected_scene + data: + value: Adaptive + alias: If master bedroom lights are on + - if: + - condition: state + entity_id: light.kallen_bedroom_lights + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.kallen_bedroom_scenes + data: + option: Adaptive + alias: Set adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_kallen_bedroom + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_kallen_bedroom + data: {} + - service: input_text.set_value + target: + entity_id: input_text.kallen_bedroom_selected_scene + data: + value: Adaptive + alias: If Kallen's bedroom lights are on + - if: + - condition: state + entity_id: light.emma_bedroom_light + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.emma_bedroom_scenes + data: + option: Adaptive + alias: Set adaptive + else: + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_emma_bedroom + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_emma_bedroom + data: {} + - service: input_text.set_value + target: + entity_id: input_text.emma_bedroom_selected_scene + data: + value: Adaptive + alias: If Emma's bedroom light is on + - if: + - condition: state + entity_id: input_boolean.shower_mode + state: 'off' + then: + - if: + - condition: state + entity_id: binary_sensor.upstairs_bathroom_occupied + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_bathroom_scenes + data: + option: Adaptive + else: + - if: + - condition: state + entity_id: binary_sensor.early_night_mode + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_bathroom_scenes + data: + option: Nightlight + else: + - service: light.turn_off + target: + entity_id: light.upstairs_bathroom_lights + data: {} + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_upstairs_bathroom + data: {} + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_sleep_mode_upstairs_bathroom + data: {} + - service: input_text.set_value + target: + entity_id: input_text.upstairs_bathroom_selected_scene + data: + value: Adaptive + alias: Upstairs bathroom handling +'1696287373796': + alias: Bright on First Floor + sequence: + - service: light.turn_on + target: + entity_id: + - light.living_room_lights + - light.downstairs_bathroom_lights + - light.dining_room_lamp + - light.mud_room_overhead + data: {} + - service: input_boolean.turn_on + target: + entity_id: input_boolean.tina_desk_lights + data: {} + - delay: + seconds: 1 + - service: input_select.select_option + target: + entity_id: + - input_select.living_room_scenes + - input_select.downstairs_bathroom_scenes + - input_select.mud_room_scenes + - input_select.dining_room_lamp_scenes + data: + option: Bright + - service: light.turn_on + target: + entity_id: + - light.tina_desk_strip + - light.tina_lamp + data: + color_temp_kelvin: 2700 + - service: light.turn_on + target: + entity_id: + - light.tina_lamp + - light.tina_desk_strip + data: + brightness: 255 +'1696287429248': + alias: Bright on Second Floor + sequence: + - service: script.stairwell_led_strip + data: + brightness: 255 + - service: light.turn_on + target: + entity_id: + - light.hallway_overhead + - light.master_bedroom_lights + data: {} + - if: + - condition: state + entity_id: input_boolean.shower_mode + state: 'off' + then: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_bathroom_scenes + data: + option: Bright + - if: + - condition: state + entity_id: input_boolean.kallen_sleeping + state: 'off' + then: + - service: light.turn_on + target: + entity_id: light.kallen_bedroom_lights + data: {} + - if: + - condition: state + entity_id: input_boolean.emma_sleeping + state: 'off' + then: + - service: light.turn_on + target: + entity_id: light.emma_bedroom_light + data: {} + - delay: + seconds: 1 + - service: input_select.select_option + target: + entity_id: + - input_select.upstairs_hallway_scenes + - input_select.master_bedroom_scenes + data: + option: Bright + - if: + - condition: state + entity_id: input_boolean.shower_mode + state: 'off' + then: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_bathroom_scenes + data: + option: Bright + - if: + - condition: template + value_template: '{{ is_state(''input_boolean.kallen_sleeping'',''off'') or (is_state(''input_boolean.kallen_sleeping'',''on'') + and is_state(''light.kallen_bedroom_lights'',''on'')) }}' + then: + - service: input_select.select_option + target: + entity_id: input_select.kallen_bedroom_scenes + data: + option: Bright + - if: + - condition: template + value_template: '{{ is_state(''input_boolean.emma_sleeping'',''off'') or (is_state(''input_boolean.emma_sleeping'',''on'') + and is_state(''light.emma_bedroom_light'',''on'')) }}' + then: + - service: input_select.select_option + target: + entity_id: input_select.emma_bedroom_scenes + data: + option: Bright +'1696287564414': + alias: Evening on First Floor + sequence: + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.early_night_mode + state: 'off' + sequence: + - stop: This scene does nothing during daytime + - conditions: + - condition: state + entity_id: input_boolean.give_me_darkness + state: 'on' + sequence: + - if: + - condition: state + entity_id: person.christina_stork + state: home + then: + - service: input_select.select_option + target: + entity_id: input_select.tina_desk_scenes + data: + option: Night Mode + - choose: + - conditions: + - condition: state + entity_id: input_boolean.guest_mode + state: 'off' + sequence: + - if: + - condition: template + value_template: '{{ give_me_darkness == 1 }}' + then: + - if: + - condition: state + entity_id: timer.downstairs_bathroom_lights_timer + state: idle + then: + - service: light.turn_off + target: + entity_id: + - light.downstairs_bathroom_lights + data: {} + - service: input_select.select_option + target: + entity_id: + - input_select.mud_room_scenes + data: + option: Nightlight + else: + - service: light.turn_off + target: + entity_id: + - light.living_room_lights + data: {} + - if: + - condition: state + entity_id: timer.downstairs_bathroom_lights_timer + state: idle + then: + - service: light.turn_off + target: + entity_id: + - light.downstairs_bathroom_lights + data: {} + - service: input_select.select_option + target: + entity_id: + - input_select.mud_room_scenes + - input_select.dining_room_lamp_scenes + data: + option: Nightlight + - conditions: + - condition: state + entity_id: input_boolean.guest_mode + state: 'on' + sequence: + - if: + - condition: state + entity_id: timer.downstairs_bathroom_lights_timer + state: idle + then: + - service: light.turn_off + target: + entity_id: + - light.downstairs_bathroom_lights + data: {} + - conditions: + - condition: state + entity_id: input_boolean.give_me_darkness + state: 'off' + sequence: + - if: + - condition: template + value_template: '{{ sunset_lights == 1 }}' + then: + - service: light.turn_on + target: + entity_id: + - light.living_room_lights + - light.mud_room_overhead + data: {} + - service: input_select.select_option + target: + entity_id: + - input_select.living_room_scenes + - input_select.mud_room_scenes + data: + option: Adaptive + else: + - service: light.turn_off + target: + entity_id: + - light.dining_room_lamp + data: {} + - if: + - condition: state + entity_id: timer.downstairs_bathroom_lights_timer + state: idle + then: + - service: light.turn_off + target: + entity_id: light.downstairs_bathroom_lights + data: {} + - service: input_boolean.turn_off + target: + entity_id: input_boolean.tina_desk_lights + data: {} + - service: light.turn_on + target: + entity_id: + - light.living_room_lights + - light.mud_room_overhead + data: {} + - service: input_select.select_option + target: + entity_id: + - input_select.living_room_scenes + - input_select.mud_room_scenes + data: + option: Adaptive +'1696287633054': + alias: Evening on Second Floor + sequence: + - condition: state + entity_id: binary_sensor.early_night_mode + state: 'on' + - choose: + - conditions: + - condition: state + entity_id: input_boolean.give_me_darkness + state: 'on' + sequence: + - service: script.stairwell_led_strip + data: + color_temp_kelvin: 2000 + brightness: 100 + - service: input_select.select_option + target: + entity_id: + - input_select.upstairs_hallway_scenes + data: + option: Nightlight + - if: + - condition: state + entity_id: input_boolean.shower_mode + state: 'off' + then: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_bathroom_scenes + data: + option: "{% if is_state('binary_sensor.upstairs_bathroom_occupied','on') + %}\n Adaptive\n{% else %}\n Nightlight\n{% endif %}\n" + - service: light.turn_off + target: + area_id: + - kallen_bedroom + - master_bedroom + - emma_bedroom + data: {} + - delay: + seconds: 1 + - service: switch.turn_on + target: + entity_id: + - switch.adaptive_lighting_kallen_bedroom + - switch.adaptive_lighting_master_bedroom + - switch.adaptive_lighting_emma_bedroom + data: {} + - service: switch.turn_off + target: + entity_id: + - switch.adaptive_lighting_sleep_mode_kallen_bedroom + - switch.adaptive_lighting_sleep_mode_master_bedroom + - switch.adaptive_lighting_sleep_mode_emma_bedroom + data: {} + - service: input_text.set_value + target: + entity_id: + - input_text.kallen_bedroom_selected_scene + - input_text.master_bedroom_selected_scene + - input_text.emma_bedroom_selected_scene + data: + value: Adaptive + - conditions: + - condition: state + entity_id: input_boolean.give_me_darkness + state: 'off' + sequence: + - service: script.stairwell_led_strip + data: + color_temp_kelvin: 2000 + brightness: 150 + - service: input_select.select_option + target: + entity_id: input_select.upstairs_hallway_scenes + data: + option: Nightlight + - if: + - condition: state + entity_id: input_boolean.shower_mode + state: 'off' + then: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_bathroom_scenes + data: + option: "{% if is_state('binary_sensor.upstairs_bathroom_occupied','on') + %}\n Adaptive\n{% else %}\n Nightlight\n{% endif %}\n" + - if: + - condition: template + value_template: '{{ sunset_lights == 1 }}' + then: + - stop: Sunset lights don't mess with bedroom light states before bedtime + else: + - service: light.turn_off + target: + area_id: + - master_bedroom + - kallen_bedroom + - emma_bedroom + data: {} + - delay: + seconds: 1 + - service: switch.turn_on + target: + entity_id: + - switch.adaptive_lighting_kallen_bedroom + - switch.adaptive_lighting_master_bedroom + - switch.adaptive_lighting_emma_bedroom + data: {} + - service: switch.turn_off + target: + entity_id: + - switch.adaptive_lighting_sleep_mode_kallen_bedroom + - switch.adaptive_lighting_sleep_mode_master_bedroom + - switch.adaptive_lighting_sleep_mode_emma_bedroom + data: {} + - service: input_text.set_value + target: + entity_id: + - input_text.kallen_bedroom_selected_scene + - input_text.master_bedroom_selected_scene + - input_text.emma_bedroom_selected_scene + data: + value: Adaptive +'1696287683022': + alias: Goodnight in Basement + sequence: + - service: light.turn_off + target: + area_id: + - basement_studio + - furnace_room + data: {} + - service: fan.turn_off + target: + entity_id: fan.basement_fan + data: {} +'1696287713844': + alias: Goodnight on First Floor + sequence: + - if: + - condition: state + entity_id: input_boolean.guest_mode + state: 'on' + then: + - service: light.turn_off + target: + area_id: + - dining_room + - downstairs_bathroom + - living_room + - tina_desk + data: {} + - service: input_select.select_option + target: + entity_id: input_select.mud_room_scenes + data: + option: Nightlight + else: + - service: light.turn_off + target: + area_id: + - dining_room + - downstairs_bathroom + - living_room + - mud_room + - tina_desk + data: {} +'1696287748896': + alias: Goodnight on Second Floor + sequence: + - service: light.turn_off + target: + area_id: + - emma_bedroom + - kallen_bedroom + - master_bedroom + - master_bedroom_closet + data: {} + - if: + - condition: state + entity_id: input_boolean.guest_mode + state: 'on' + then: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_hallway_scenes + data: + option: Nightlight + else: + - service: light.turn_off + target: + entity_id: light.hallway_overhead + data: {} + - if: + - condition: state + entity_id: input_boolean.kallen_overnight + state: 'on' + then: + - service: light.turn_off + target: + area_id: upstairs_bathroom + data: {} + else: + - service: input_select.select_option + target: + entity_id: input_select.upstairs_bathroom_scenes + data: + option: Single Nightlight + - service: script.stairwell_led_strip + data: + color_temp_kelvin: 2000 + brightness: 50 +'1696287826909': + alias: Morning Scene + sequence: + - service: input_boolean.turn_off + target: + entity_id: input_boolean.master_bedroom_sleeping + data: {} + - if: + - condition: template + value_template: '{% set weather = states(''weather.iron_nerd_weather_station'') + %} {{ weather in [''cloudy'',''partlycloudy'',''rainy'',''snowy'',''hail'',''lightning'',''lightning-rainy'',''pouring'',''snowy-rainy''] + }} + + ' + then: + - if: + - condition: template + value_template: '{{ is_state(''input_boolean.kallen_sleeping'',''off'') and + is_state(''person.kallen_stork'',''home'') }}' + then: + - service: light.turn_on + target: + entity_id: light.kallen_bedroom_lights + data: {} + - if: + - condition: state + entity_id: input_boolean.emma_sleeping + state: 'off' + then: + - service: light.turn_on + target: + entity_id: light.emma_bedroom_light + data: {} +'1696287949240': + alias: Day Mode in Tina Desk + sequence: + - parallel: + - service: light.turn_on + target: + entity_id: light.tina_lamp_top + data: {} + - service: light.turn_off + target: + entity_id: light.tina_lamp_side + data: {} + - service: light.turn_on + target: + entity_id: light.tina_desk_strip + data: + rgb_color: + - 0 + - 255 + - 255 + brightness: 89 + - wait_template: '{{ is_state(''light.tina_lamp_side'',''off'') }}' + timeout: + seconds: 15 + continue_on_timeout: true + - service: switch.turn_on + target: + entity_id: switch.adaptive_lighting_tina_lamp + data: {} + mode: restart + icon: mdi:palette +'1696288097687': + alias: Evening Mode in Tina Desk + sequence: + - parallel: + - service: light.turn_on + target: + entity_id: light.tina_lamp + data: {} + - service: light.turn_on + target: + entity_id: light.tina_desk_strip + data: + rgb_color: + - 127 + - 0 + - 255 + brightness: 128 + - service: input_select.select_option + target: + entity_id: input_select.tina_lamp_scenes + data: + option: Adaptive + mode: restart + icon: mdi:palette +'1696288151029': + alias: Night Mode in Tina Desk + sequence: + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_tina_lamp + data: {} + - parallel: + - service: light.turn_on + target: + entity_id: light.tina_lamp + data: + rgb_color: + - 127 + - 0 + - 255 + brightness: 128 + - service: light.turn_on + target: + entity_id: light.tina_desk_strip + data: + rgb_color: + - 127 + - 0 + - 255 + brightness: 128 + mode: restart + icon: mdi:palette +'1696288192634': + alias: Bright Mode in Tina Desk + sequence: + - service: switch.turn_off + target: + entity_id: switch.adaptive_lighting_tina_lamp + data: {} + - parallel: + - service: light.turn_on + target: + entity_id: light.tina_lamp + data: + rgb_color: + - 255 + - 210 + - 175 + brightness: 255 + - service: light.turn_on + target: + entity_id: light.tina_desk_strip + data: + rgb_color: + - 255 + - 210 + - 175 + brightness: 255 + mode: restart + icon: mdi:palette