- alias: Bedroom Blackout id: bedroom_blackout description: 'Close the bedroom blackout blinds when we''re sleeping in, and open when we wake up. ' mode: queued triggers: - trigger: state entity_id: sensor.weather to: night - trigger: state entity_id: sensor.weather from: night not_to: unavailable - trigger: state entity_id: binary_sensor.anyone_asleep to: - 'on' - 'off' - trigger: state entity_id: binary_sensor.bedroom_window to: 'off' for: seconds: 3 actions: - choose: - conditions: - not: - condition: state entity_id: sensor.weather state: night - condition: state entity_id: binary_sensor.anyone_asleep state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.bedroom_blackout_open - conditions: - not: - condition: state entity_id: sensor.weather state: night - condition: state entity_id: binary_sensor.anyone_asleep state: 'on' - condition: state entity_id: binary_sensor.bedroom_window state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.bedroom_blackout - conditions: - condition: sun before: sunrise after: sunrise after_offset: -03:00:00 - condition: state entity_id: binary_sensor.anyone_asleep state: 'on' - condition: state entity_id: binary_sensor.bedroom_window state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.bedroom_blackout - alias: Bedroom Play id: bedroom_play description: 'Set scenes while playing in the bedroom. ' mode: queued triggers: - trigger: state entity_id: input_boolean.bedroom_play to: - 'on' - 'off' actions: - choose: - conditions: - condition: state entity_id: input_boolean.bedroom_play state: 'on' sequence: - action: light.turn_on target: entity_id: - light.bedroom_bed_left - light.bedroom_bed_right - light.bedroom_wall_left - light.bedroom_wall_right - light.bedroom_left_bedside - light.bedroom_right_bedside - delay: seconds: 3 - action: scene.create data: scene_id: bedroom_play snapshot_entities: - light.bedroom_bed_left - light.bedroom_bed_right - light.bedroom_wall_left - light.bedroom_wall_right - light.bedroom_left_bedside - light.bedroom_right_bedside - action: script.bedroom_play - conditions: - condition: state entity_id: input_boolean.bedroom_play state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.bedroom_play - action: scene.delete target: entity_id: scene.bedroom_play - alias: Dining Room Blinds id: dining_room_blinds description: 'Open and close the dining room window blinds based on the time of day, sun position, and weather. ' mode: queued triggers: - trigger: numeric_state entity_id: sun.sun attribute: azimuth above: 220 - trigger: numeric_state entity_id: sun.sun attribute: elevation below: 55 - trigger: numeric_state entity_id: sun.sun attribute: elevation below: 45 - trigger: numeric_state entity_id: sun.sun attribute: elevation below: 24 - trigger: numeric_state entity_id: sun.sun attribute: elevation below: 5.5 - trigger: state entity_id: sensor.weather not_to: unavailable - trigger: state entity_id: binary_sensor.dining_room_top_windows to: 'off' for: seconds: 3 id: close - trigger: state entity_id: binary_sensor.dining_room_bottom_windows to: 'off' for: seconds: 3 id: close - trigger: state entity_id: media_player.loft_tv to: - 'on' - 'off' - trigger: state entity_id: input_boolean.dining_room_play to: - 'on' - 'off' - trigger: state entity_id: input_boolean.loft_play to: - 'on' - 'off' actions: - variables: target: none - choose: - conditions: - condition: numeric_state entity_id: sun.sun attribute: azimuth above: 220 - condition: numeric_state entity_id: sun.sun attribute: elevation above: 5.5 below: 24 - condition: state entity_id: sensor.weather state: - hot-day - day sequence: - variables: target: 100 - conditions: - condition: state entity_id: input_boolean.dining_room_play state: 'on' sequence: - variables: target: 100 - conditions: - condition: numeric_state entity_id: sun.sun attribute: azimuth above: 220 - condition: numeric_state entity_id: sun.sun attribute: elevation above: 24 below: 45 - condition: state entity_id: sensor.weather state: - hot-day - day sequence: - variables: target: 66 - conditions: - condition: numeric_state entity_id: sun.sun attribute: azimuth above: 220 - condition: numeric_state entity_id: sun.sun attribute: elevation above: 45 below: 55 - condition: state entity_id: sensor.weather state: - hot-day - day sequence: - variables: target: 33 - conditions: - condition: state entity_id: input_boolean.loft_play state: 'on' sequence: - variables: target: 33 - conditions: - not: - condition: state entity_id: sensor.weather state: night - condition: state entity_id: media_player.loft_tv state: 'on' sequence: - variables: target: 33 - conditions: - not: - condition: state entity_id: sensor.weather state: night sequence: - variables: target: 0 - conditions: - condition: state entity_id: sensor.weather state: night sequence: - variables: target: -1 - choose: - conditions: - '{{ target >= 100 }}' - condition: state entity_id: binary_sensor.dining_room_top_windows state: 'off' - condition: state entity_id: binary_sensor.dining_room_bottom_windows state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.dining_room_evening_sun - conditions: - '{{ target >= 66 }}' - condition: state entity_id: binary_sensor.dining_room_top_windows state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.dining_room_late_afternoon_sun - conditions: - '{{ target >= 33 }}' - condition: state entity_id: binary_sensor.dining_room_top_windows state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.dining_room_afternoon_sun - conditions: - '{{ target >= 0 }}' sequence: - action: scene.turn_on target: entity_id: scene.dining_room_daytime - conditions: - '{{ target < 0 }}' sequence: - action: scene.turn_on target: entity_id: scene.dining_room_nighttime - alias: Dining Room Play id: dining_room_play description: 'Set scenes while playing in the Dining Room. ' mode: queued triggers: - trigger: state entity_id: input_boolean.dining_room_play to: - 'on' - 'off' actions: - choose: - conditions: - condition: state entity_id: input_boolean.dining_room_play state: 'on' sequence: - action: light.turn_on target: entity_id: - light.dining_room_beam - light.dining_room_south_left - light.dining_room_south_right - light.dining_room_west_left - light.dining_room_west_center - light.dining_room_west_right - delay: seconds: 3 - action: scene.create data: scene_id: dining_room_play snapshot_entities: - light.dining_room_beam - light.dining_room_south_left - light.dining_room_south_right - light.dining_room_west_left - light.dining_room_west_center - light.dining_room_west_right - action: script.dining_room_play - conditions: - condition: state entity_id: input_boolean.dining_room_play state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.dining_room_play - action: scene.delete target: entity_id: scene.dining_room_play - alias: Dining Room Tabletop id: dining_room_tabletop description: 'Set dining room light scenes based on the tabletop TV. ' mode: queued triggers: - trigger: state entity_id: media_player.dining_room_tabletop to: null id: tabletop - trigger: state entity_id: sensor.weather to: night actions: - choose: - conditions: - condition: state entity_id: media_player.dining_room_tabletop state: 'on' - condition: state entity_id: sensor.weather state: night sequence: - action: script.dining_room_dnd - conditions: - condition: state entity_id: media_player.dining_room_tabletop state: 'on' sequence: - action: script.dining_room_game_setup - conditions: - condition: trigger id: tabletop sequence: - action: script.dining_room_game_over - alias: Door Opened Notification id: door_opened_notification description: 'Notify when a door is opened while nobody is home. ' mode: single triggers: - trigger: state entity_id: binary_sensor.doors_opened_while_not_occupied to: 'on' actions: - action: notify.mobile_app_scottys_iphone data: title: Door Opened message: '{% set door = state_attr(''binary_sensor.doors_opened_while_not_occupied'', ''door'') %} {{ state_attr(door, ''friendly_name'') | default(door) }} ' - alias: Gaming Power Limit id: gaming_power_limit description: 'Limit "Vecna" GPU power, and reduce home power consumption, while both gaming PCs are on. ' mode: queued triggers: - trigger: state entity_id: binary_sensor.gaming_power_limit to: - 'on' - 'off' - trigger: state entity_id: sensor.vecna_lastsystemstatechange to: null actions: - if: - condition: state entity_id: binary_sensor.gaming_power_limit state: 'on' then: - action: button.press target: entity_id: button.vecna_power_limit_enable - action: switch.turn_off target: entity_id: - switch.office_wall_desk_right_switch_top - switch.loft_wall_south_switch_top else: - action: button.press target: entity_id: button.vecna_power_limit_disable - action: switch.turn_on target: entity_id: - switch.office_wall_desk_right_switch_top - switch.loft_wall_south_switch_top - alias: Home Off id: home_off description: 'Turn things off when the last person goes to sleep, or the home is no longer occupied. ' mode: single triggers: - trigger: state entity_id: binary_sensor.anyone_home to: 'off' - trigger: state entity_id: binary_sensor.anyone_asleep to: 'on' actions: - action: light.turn_off continue_on_error: true target: area_id: - kitchen - downstairs_bathroom - bathroom - stairs - roof entity_id: - light.dining_room_chandelier - light.dining_room_spots - light.bedroom_left_closet - light.bedroom_right_closet - action: media_player.media_pause continue_on_error: true target: entity_id: - media_player.dining_room - media_player.kitchen - media_player.office - media_player.bedroom - media_player.loft - media_player.bathroom - media_player.downstairs_bathroom - action: media_player.turn_off continue_on_error: true target: entity_id: - media_player.loft_tv - alias: Kitchen Blinds id: kitchen_blinds description: 'Open and close the kitchen window blinds based on the time of day, sun position, and weather. ' mode: queued triggers: - trigger: numeric_state entity_id: sun.sun attribute: azimuth above: 115 - trigger: numeric_state entity_id: sun.sun attribute: azimuth above: 235 - trigger: state entity_id: sensor.weather not_to: unavailable - trigger: state entity_id: media_player.loft_tv to: - 'on' - 'off' - trigger: state entity_id: input_boolean.dining_room_play to: - 'on' - 'off' - trigger: state entity_id: input_boolean.loft_play to: - 'on' - 'off' actions: - choose: - conditions: - condition: numeric_state entity_id: sun.sun attribute: azimuth above: 115 below: 235 - condition: state entity_id: sensor.weather state: hot-day sequence: - action: scene.turn_on target: entity_id: scene.kitchen_sun - conditions: - condition: state entity_id: input_boolean.dining_room_play state: 'on' sequence: - action: scene.turn_on target: entity_id: scene.kitchen_sun - conditions: - not: - condition: state entity_id: sensor.weather state: night - condition: state entity_id: media_player.loft_tv state: 'on' sequence: - action: scene.turn_on target: entity_id: scene.kitchen_nighttime - conditions: - condition: state entity_id: input_boolean.loft_play state: 'on' sequence: - action: scene.turn_on target: entity_id: scene.kitchen_nighttime - conditions: - not: - condition: state entity_id: sensor.weather state: night sequence: - action: scene.turn_on target: entity_id: scene.kitchen_daytime - conditions: - condition: state entity_id: sensor.weather state: night sequence: - action: scene.turn_on target: entity_id: scene.kitchen_nighttime - alias: Kitchen Home at Night id: kitchen_home_at_night description: 'Turns on the entrance lights when anyone comes home late at night. ' mode: restart triggers: - trigger: state entity_id: binary_sensor.anyone_home to: 'on' not_from: unavailable - trigger: zone entity_id: - person.scotty zone: zone.home event: enter conditions: - condition: state entity_id: sensor.weather state: night actions: - action: light.turn_on target: entity_id: light.entrance - delay: minutes: 15 - action: light.turn_off target: entity_id: light.entrance - alias: Kitchen Lights id: kitchen_lights description: 'Turns on the kitchen counter lights for 15 minutes after motion is detected, or when anyone comes home at night. ' mode: restart triggers: - trigger: state entity_id: binary_sensor.dining_room_motion_occupancy to: 'on' - trigger: state entity_id: binary_sensor.anyone_home to: 'on' not_from: unavailable - trigger: zone entity_id: - person.scotty zone: zone.home event: enter conditions: - condition: state entity_id: sensor.weather state: - night - cloudy-day - or: - condition: state entity_id: light.kitchen_counter state: 'off' - condition: state entity_id: automation.kitchen_lights attribute: current state: 1 - condition: state entity_id: binary_sensor.anyone_home state: 'on' actions: - if: - condition: state entity_id: light.kitchen_counter state: 'off' then: - action: light.turn_on data: brightness_pct: 25 target: entity_id: light.kitchen_counter - delay: seconds: 3 - wait_for_trigger: - trigger: state entity_id: light.kitchen_counter timeout: minutes: 15 - if: - '{{ not wait.completed }}' then: - action: light.turn_off target: entity_id: light.kitchen_counter - alias: Loft Play id: loft_play description: 'Set scenes while playing in the Loft. ' mode: queued triggers: - trigger: state entity_id: input_boolean.loft_play to: - 'on' - 'off' actions: - choose: - conditions: - condition: state entity_id: input_boolean.loft_play state: 'on' sequence: - action: light.turn_on target: entity_id: - light.loft_balcony_left - light.loft_balcony_center - light.loft_balcony_right - light.loft_wall_left - light.loft_wall_center - light.loft_wall_right - light.loft_east_left - light.loft_east_right - light.loft_south_left - light.loft_south_right - delay: seconds: 3 - action: scene.create data: scene_id: loft_play snapshot_entities: - light.loft_balcony_left - light.loft_balcony_center - light.loft_balcony_right - light.loft_wall_left - light.loft_wall_center - light.loft_wall_right - light.loft_east_left - light.loft_east_right - light.loft_south_left - light.loft_south_right - action: script.loft_play - conditions: - condition: state entity_id: input_boolean.loft_play state: 'off' sequence: - action: scene.turn_on target: entity_id: scene.loft_play - action: scene.delete target: entity_id: scene.loft_play - alias: Loft TV id: loft_tv description: 'Turn loft ceiling lights off while the TV is on, and back on again when TV is turned off. ' mode: queued triggers: - trigger: state entity_id: media_player.loft_tv to: - 'on' - 'off' actions: - choose: - conditions: - condition: state entity_id: media_player.loft_tv state: 'on' sequence: - action: light.turn_off target: entity_id: light.loft_ceiling - conditions: - condition: state entity_id: media_player.loft_tv state: 'off' - condition: state entity_id: light.loft_wall state: 'on' sequence: - action: light.turn_on target: entity_id: light.loft_ceiling