start_netflix: alias: Start Netflix (Living Room) sequence: - service: media_player.select_source target: entity_id: media_player.living_room_tv data: source: com.netflix.ninja mode: single icon: mdi:netflix stop_netflix: alias: Stop Netflix (Living Room) sequence: - service: media_player.select_source target: entity_id: media_player.living_room_tv data: source: '!com.netflix.ninja' mode: single icon: mdi:netflix give_me_darkness: alias: Give Me Darkness sequence: - service: input_boolean.turn_on data: {} target: entity_id: input_boolean.give_me_darkness alias: Turn on input boolean - delay: hours: 0 minutes: 0 seconds: 1 milliseconds: 0 - service: script.volume_reset data: {} - service: script.evening_on_first_floor data: give_me_darkness: 1 - service: script.evening_on_second_floor data: {} - service: mqtt.publish data: qos: '2' retain: true topic: house/time/give_me_darkness payload: 'on' - alias: Security decision if: - condition: and conditions: - condition: state entity_id: person.tony_stork state: home - condition: state entity_id: person.christina_stork state: home - condition: state entity_id: input_boolean.guest_mode state: 'off' - condition: state entity_id: alarm_control_panel.nerdhome_alarm_panel state: disarmed alias: Both adults are home, guest mode off, security disarmed then: - alias: Auto or manual trigger? if: - condition: template value_template: '{{ auto == 1 }}' alias: Triggered by automation then: - service: alarm_control_panel.alarm_arm_home data: {} target: entity_id: alarm_control_panel.nerdhome_alarm_panel alias: Arm security else: - service: script.activate_alexa_actionable_notification data: text: Would you like me to arm the security system? event_id: actionable_notification_night_security_arm alexa_device: media_player.living_room_echo_dot alias: Ask to arm security mode: single icon: mdi:weather-night start_youtube: alias: Start Youtube (Living Room) sequence: - service: media_player.select_source target: entity_id: media_player.living_room_tv data: source: com.google.android.youtube.tv mode: single icon: mdi:youtube stop_youtube: alias: Stop Youtube (Living Room) sequence: - service: media_player.select_source target: entity_id: media_player.living_room_tv data: source: '!com.google.android.youtube.tv' mode: single icon: mdi:youtube start_twitch: alias: Start Twitch (Living Room) sequence: - service: media_player.select_source target: entity_id: media_player.living_room_tv data: source: tv.twitch.android.app mode: single icon: mdi:twitch stop_twitch: alias: Stop Twitch (Living Room) sequence: - service: media_player.select_source data: source: '!tv.twitch.android.app' target: entity_id: media_player.living_room_tv mode: single icon: mdi:twitch start_spotify: alias: Start Spotify (Living Room) sequence: - service: media_player.select_source target: entity_id: media_player.living_room_tv data: source: com.spotify.tv.android mode: single icon: mdi:spotify stop_spotify: alias: Stop Spotify (Living Room) sequence: - service: media_player.select_source target: entity_id: media_player.living_room_tv data: source: '!com.spotify.tv.android' mode: single icon: mdi:spotify alexa_tts_test: alias: Alexa TTS Test sequence: - service: notify.alexa_media data: data: method: all type: announce target: Living Room Echo Dot message: I farted mode: single icon: mdi:test-tube kallen_timer_cancel: sequence: - service: timer.cancel target: entity_id: timer.kallen_timer mode: single alias: Kallen Timer - Cancel icon: mdi:cancel global_off: alias: Global Off sequence: - service: light.turn_off data: {} target: entity_id: all - service: fan.turn_off data: {} target: entity_id: all - service: input_boolean.turn_off data: {} target: entity_id: input_boolean.tina_desk_lights mode: single icon: mdi:earth-off global_on: alias: Global On sequence: - service: light.turn_on data: {} target: entity_id: all mode: single icon: mdi:earth max_brightness: sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.tina_desk_lights data: {} alias: Turn on Tina Desk Lights - service: switch.turn_off target: entity_id: - switch.adaptive_lighting_basement_studio - switch.adaptive_lighting_kallen_bedroom - switch.adaptive_lighting_living_room - switch.adaptive_lighting_master_bedroom - switch.adaptive_lighting_mud_room - switch.adaptive_lighting_emma_bedroom - switch.adaptive_lighting_upstairs_hallway - switch.adaptive_lighting_dining_room_lamp - switch.adaptive_lighting_upstairs_bathroom - switch.adaptive_lighting_downstairs_bathroom - switch.adaptive_lighting_tina_lamp data: {} alias: Turn off Adaptive Lighting - delay: hours: 0 minutes: 0 seconds: 1 milliseconds: 0 - service: input_boolean.turn_on data: {} target: entity_id: input_boolean.shower_mode alias: Turn on Shower Mode - service: automation.turn_off data: stop_actions: true target: entity_id: automation.living_room_night_lighting alias: Turn off Living Room night automation - service: timer.cancel data: {} target: entity_id: timer.living_room_motion_timer alias: Cancel living room motion timer - service: input_boolean.turn_off data: {} target: entity_id: input_boolean.front_porch_light_on alias: Turn off Front Porch automation - service: light.turn_on data: kelvin: 5000 brightness_pct: 100 target: entity_id: all alias: Turn on ALL LIGHTS to maximum brightness mode: single alias: Max Brightness icon: mdi:brightness-7 going_upstairs: alias: Going Upstairs sequence: - service: mqtt.publish data: qos: '2' retain: true topic: house/time/night_mode payload: 'on' alias: Tell MQTT that it is night mode now - service: input_select.select_option data: option: Adaptive target: entity_id: - input_select.basement_studio_scenes - input_select.tina_lamp_scenes - input_select.mud_room_scenes - input_select.upstairs_hallway_scenes - input_select.living_room_scenes alias: Set scenes - service: script.stairwell_led_strip data: brightness: 255 alias: Turn up the stairwell LED strip - service: input_boolean.turn_on entity_id: input_boolean.night_mode alias: Turn on Night Mode - alias: Turn off Studio Quiet and Gaming Mode service: input_boolean.turn_off data: {} target: entity_id: - input_boolean.studio_quiet - input_boolean.gaming_mode - alias: Thermostat reminder if: - alias: If triggered from basement condition: state entity_id: sensor.last_alexa_name state: Basement Echo Dot then: - alias: Remind in basement service: script.speech_engine data: who: basement message: Remember to set the thermostat for the night type: alert else: - alias: Remind in living room service: script.speech_engine data: who: living_room message: Remember to set the thermostat for the night type: alert enabled: false - if: - condition: not conditions: - condition: state entity_id: media_player.basement_tv state: playing then: - service: media_player.turn_off target: entity_id: media_player.basement_tv data: {} alias: Turn basement TV off, unless something is playing - if: - condition: state entity_id: input_boolean.kallen_computer_updates state: 'off' then: - service: script.kallen_desktop_shutdown data: {} alias: Shut down Kallen desktop alias: Shutdown Kallen Desktop, unless it is updating - service: script.asus_laptop_shutdown data: {} alias: Shut down laptop - choose: - conditions: - condition: state entity_id: sensor.last_alexa_name state: Living Room Echo Dot alias: If triggered from living room sequence: - service: script.activate_alexa_actionable_notification data: text: Would you like me to shut down your computer? event_id: actionable_notification_shutdown_computer alexa_device: media_player.living_room_echo_dot response_variable: shutdown alias: Ask in living room - conditions: - condition: state entity_id: sensor.last_alexa_name state: Master Bedroom Echo Dot alias: If triggered from master bedroom sequence: - service: script.activate_alexa_actionable_notification data: text: Would you like me to shut down your computer? event_id: actionable_notification_shutdown_computer alexa_device: media_player.master_bedroom_echo_dot response_variable: shutdown alias: Ask in master bedroom default: - service: script.activate_alexa_actionable_notification data: text: Would you like me to shut down your computer? event_id: actionable_notification_shutdown_computer alexa_device: media_player.basement_echo_dot response_variable: shutdown alias: Ask in basement alias: Ask about shutting down main computer - wait_for_trigger: - platform: state entity_id: - binary_sensor.basement_studio_door from: 'off' to: 'on' id: door - platform: state entity_id: - input_boolean.goodnight from: 'off' to: 'on' id: goodnight - platform: state entity_id: light.master_bedroom_lights to: 'on' id: lights timeout: hours: 0 minutes: 30 seconds: 0 milliseconds: 0 alias: Figure out where I am - service: light.turn_off data: {} target: entity_id: light.basement_studio_lights alias: Turn off the lights - service: input_datetime.set_datetime data: datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,2) }} ' target: entity_id: input_datetime.tony_night_meds_notify alias: Schedule the night meds notification - if: - condition: template value_template: '{{ wait.trigger.id in [''goodnight'',''lights''] }}' then: - service: script.text_notify data: type: alert who: tony title: Basement Shutdown message: Would you like me to shut down your computer? tag: going-upstairs-pc-shutdown actions: - action: GU_PC_SHUTDOWN_YES title: Shutdown - action: GU_PC_SHUTDOWN_LOCK title: Lock - action: GU_PC_SHUTDOWN_NOTHING title: Do Nothing alias: Send an actionable notification - wait_for_trigger: - platform: event event_type: ios.notification_action_fired event_data: actionName: GU_PC_SHUTDOWN_YES id: shutdown-yes alias: Shutdown Yes - platform: event event_type: ios.notification_action_fired event_data: actionName: GU_PC_SHUTDOWN_LOCK id: shutdown-lock alias: Shutdown Lock - platform: event event_type: ios.notification_action_fired event_data: actionName: GU_PC_SHUTDOWN_NOTHING alias: Shutdown Nothing id: shutdown-nothing timeout: hours: 0 minutes: 20 seconds: 0 milliseconds: 0 alias: Wait for response to notification - choose: - conditions: - condition: template value_template: '{{ wait.trigger.id == ''shutdown-yes'' }}' sequence: - service: script.tony_desktop_shutdown data: {} - conditions: - condition: template value_template: '{{ wait.trigger.id == ''shutdown-lock'' }}' sequence: - service: script.tony_desktop_lock data: {} alias: Run the desired action - service: script.text_notify data: type: alert who: tony message: clear_notification tag: going-upstairs-pc-shutdown alias: Clear the notification - stop: Automation steps skipped alias: If I was not in the basement, ask about shutdown via text and then skip the rest - wait_for_trigger: - platform: state entity_id: - binary_sensor.upstairs_bathroom_motion to: 'on' id: bathroom - platform: state entity_id: - input_boolean.goodnight to: 'on' id: goodnight - platform: state entity_id: - light.master_bedroom_lights to: 'on' id: lights continue_on_timeout: false timeout: hours: 0 minutes: 20 seconds: 0 milliseconds: 0 alias: Wait until I am in the bathroom, or in bed, or the lights are manually turned on - choose: - conditions: - condition: template value_template: '{{ wait.trigger.id == ''bathroom'' }}' sequence: - service: input_select.select_option data: option: Side Nightlight target: entity_id: input_select.master_bedroom_scenes - conditions: - condition: template value_template: '{{ wait.trigger.id in [''lights'',''goodnight''] }}' sequence: - variables: stop_reason: '{{ wait.trigger.id }}' - stop: Bedroom lighting not needed response_variable: stop_reason alias: Turn on lights, or not mode: single icon: hue:room-stairs start_youtube_basement: alias: Start Youtube (Basement) sequence: - service: media_player.select_source data: source: com.google.android.youtube.tv target: entity_id: media_player.basement_tv mode: single icon: mdi:youtube stop_youtube_basement: alias: Stop Youtube (Basement) sequence: - service: media_player.select_source data: source: '!com.google.android.youtube.tv' target: entity_id: media_player.basement_tv mode: single icon: mdi:youtube start_netflix_basement: alias: Start Netflix (Basement) sequence: - service: media_player.select_source data: source: com.netflix.ninja target: entity_id: media_player.basement_tv mode: single icon: mdi:netflix stop_netflix_basement: alias: Stop Netflix (Basement) sequence: - service: media_player.select_source data: source: '!com.netflix.ninja' target: entity_id: media_player.basement_tv mode: single icon: mdi:netflix start_twitch_basement: alias: Start Twitch (Basement) sequence: - service: media_player.select_source data: source: tv.twitch.android.app target: entity_id: media_player.basement_tv mode: single icon: mdi:twitch stop_twitch_basement: alias: Stop Twitch (Basement) sequence: - service: media_player.select_source data: source: '!tv.twitch.android.app' target: entity_id: media_player.basement_tv mode: single icon: mdi:twitch start_spotify_basement: alias: Start Spotify (Basement) sequence: - service: media_player.select_source data: source: com.spotify.tv.android target: entity_id: media_player.basement_tv mode: single icon: mdi:spotify stop_spotify_basement: alias: Stop Spotify (Basement) sequence: - service: media_player.select_source data: source: '!com.spotify.tv.android' target: entity_id: media_player.basement_tv mode: single icon: mdi:spotify max_brightness_cleanup: alias: Max Brightness Cleanup sequence: - service: input_boolean.turn_off data: {} target: entity_id: - input_boolean.shower_mode alias: Turn off Shower Mode - service: input_boolean.turn_on data: {} target: entity_id: input_boolean.front_porch_light_on alias: Turn on Front Porch automation - service: automation.turn_on data: {} target: entity_id: automation.living_room_night_lighting alias: Turn on Living Room night automation - service: script.adaptive_on_first_floor data: {} - service: script.adaptive_on_second_floor data: {} mode: single icon: mdi:broom cleanup_crash: alias: Cleanup Crash sequence: - service: switch.turn_off data: {} target: entity_id: - switch.presence_simulation - switch.basement_echo_dot_do_not_disturb_switch - switch.living_room_echo_dot_do_not_disturb_switch - switch.master_bedroom_echo_dot_do_not_disturb_switch alias: Turn off switches - if: - condition: time after: input_datetime.master_bedroom_wakeup before: input_datetime.master_bedroom_cooling then: - service: input_boolean.turn_off data: {} target: entity_id: input_boolean.master_bedroom_cooling_on - service: button.press data: {} target: entity_id: button.master_bedroom_day_mode else: - service: input_boolean.turn_on data: {} target: entity_id: input_boolean.master_bedroom_cooling_on - service: button.press data: {} target: entity_id: button.master_bedroom_night_mode alias: Set climate state - if: - condition: state entity_id: sensor.twitch_ironnerd24 state: online then: - service: input_boolean.turn_on data: {} target: entity_id: input_boolean.studio_quiet else: - service: input_boolean.turn_off data: {} target: entity_id: input_boolean.studio_quiet alias: Set studio quiet if Twitch stream is live - if: - condition: state entity_id: calendar.family_tinawork state: 'on' - condition: time before: input_datetime.tina_workday_end after: input_datetime.tina_workday_start then: - service: input_boolean.turn_on data: {} target: entity_id: input_boolean.work_today else: - service: input_boolean.turn_off data: {} target: entity_id: input_boolean.work_today alias: Set Tina Work booleans - if: - condition: state entity_id: calendar.kallen_school_days state: 'on' - condition: time before: input_datetime.kallen_school_day_end after: input_datetime.kallen_school_day_start then: - service: input_boolean.turn_on data: {} target: entity_id: - input_boolean.kallen_school_today - input_boolean.kallen_school_today_extended - input_boolean.kallen_at_school else: - service: input_boolean.turn_off data: {} target: entity_id: - input_boolean.kallen_school_today - input_boolean.kallen_school_today_extended - input_boolean.kallen_at_school alias: Set Kallen School booleans - if: - condition: time before: input_datetime.audible_notification_on after: input_datetime.audible_notification_off then: - service: input_boolean.turn_off data: {} target: entity_id: input_boolean.audible_notifications else: - service: input_boolean.turn_on data: {} target: entity_id: input_boolean.audible_notifications alias: Set audible notifications - service: switch.turn_on data: {} target: entity_id: - switch.adaptive_lighting_basement_studio - switch.adaptive_lighting_dining_room_lamp - switch.adaptive_lighting_downstairs_bathroom - switch.adaptive_lighting_front_porch - switch.adaptive_lighting_kallen_bedroom - switch.adaptive_lighting_living_room - switch.adaptive_lighting_master_bedroom - switch.adaptive_lighting_mud_room - switch.adaptive_lighting_tina_lamp - switch.adaptive_lighting_emma_bedroom - switch.adaptive_lighting_upstairs_bathroom - switch.adaptive_lighting_upstairs_hallway alias: Turn on all adaptive lighting - service: input_text.set_value data: value: Adaptive target: entity_id: - input_text.basement_studio_selected_scene - input_text.downstairs_bathroom_selected_scene - input_text.front_porch_selected_scene - input_text.kallen_bedroom_selected_scene - input_text.living_room_selected_scene - input_text.master_bedroom_selected_scene - input_text.mud_room_selected_scene - input_text.emma_bedroom_selected_scene - input_text.tina_lamp_selected_scene - input_text.upstairs_bathroom_selected_scene - input_text.upstairs_hallway_selected_scene - input_text.dining_room_lamp_selected_scene alias: Reset input texts to adaptive - service: script.volume_reset data: {} alias: Reset all speaker volumes - service: button.press data: {} target: entity_id: button.cleanup alias: Run Node-RED cleanup flow mode: single icon: mdi:truck-snowflake basement_shutdown: alias: Basement Shutdown sequence: - alias: Turn off any active modes service: input_boolean.turn_off data: {} target: entity_id: - input_boolean.studio_quiet - input_boolean.recliner_mode - input_boolean.gaming_mode - if: - condition: not conditions: - condition: state entity_id: media_player.basement_tv state: - playing then: - service: media_player.turn_off data: {} target: entity_id: media_player.basement_tv alias: If TV is not being used, turn it off - service: script.turn_on data: {} target: entity_id: - script.asus_laptop_shutdown alias: Shut down the laptop - if: - condition: state entity_id: input_boolean.kallen_computer_updates state: 'off' then: - service: script.kallen_desktop_shutdown data: {} else: - service: script.kallen_desktop_lock data: {} - service: input_boolean.turn_off data: {} target: entity_id: input_boolean.kallen_computer_updates alias: Turn off Kallen Desktop unless updates are scheduled - service: script.text_notify data: type: alert who: tony title: Basement Shutting Down message: Would you like to shut down your computer? tag: tony-pc-shutdown actions: - action: TONY_COMPUTER_SHUTDOWN title: Shutdown - action: TONY_COMPUTER_LOCK title: Lock - action: TONY_COMPUTER_IGNORE title: Do Nothing alias: Ask about shutting down main computer response_variable: tony_computer - wait_for_trigger: - platform: state entity_id: - binary_sensor.basement_studio_door to: 'on' timeout: hours: 0 minutes: 5 seconds: 0 milliseconds: 0 alias: Wait for the door to open - service: fan.turn_off data: {} target: entity_id: fan.basement_fan - service: light.turn_off data: {} target: entity_id: light.basement_lights alias: Turn off the lights - wait_for_trigger: - platform: state entity_id: - binary_sensor.basement_studio_door to: 'off' for: hours: 0 minutes: 0 seconds: 10 timeout: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 alias: Wait for the door to close - service: timer.cancel data: {} target: entity_id: timer.basement_studio_door_timer alias: Cancel the door timer since the lights are already off mode: restart icon: mdi:power stairwell_led_strip: 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: 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 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 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 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 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 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 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 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 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 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') %}\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 goodnight_in_basement: 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: {} 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 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: {} 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 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 morning_scene: 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: {} day_mode_in_tina_desk: 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 evening_mode_in_tina_desk: 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 night_mode_in_tina_desk: 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 bright_mode_in_tina_desk: 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 tony_morning_meds: alias: Tony Morning Meds icon: mdi:medication mode: restart sequence: - service: script.text_notify data: who: tony type: alert title: Morning Meds message: You need to take your morning meds tag: tony-morning-meds actions: - action: TONY_MORNING_MEDS_TAKEN title: Taken - action: TONY_MORNING_MEDS_SKIPPED title: Skip - action: TONY_MORNING_MEDS_ASK_LATER title: Ask Later - wait_for_trigger: - platform: event event_type: ios.notification_action_fired event_data: actionName: TONY_MORNING_MEDS_TAKEN id: taken alias: Taken - platform: event event_type: ios.notification_action_fired event_data: actionName: TONY_MORNING_MEDS_SKIPPED id: skipped alias: Skipped - platform: event event_type: ios.notification_action_fired event_data: actionName: TONY_MORNING_MEDS_ASK_LATER id: ask-later alias: Ask Later - platform: state entity_id: person.tony_stork from: home id: left alias: Left - platform: state entity_id: input_boolean.tony_morning_meds_taken to: 'on' id: manual alias: Manual timeout: 00:30:00 continue_on_timeout: true - choose: - conditions: - condition: template value_template: '{{ wait.trigger.id in [''taken'',''manual''] }}' alias: Taken, Manual sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.tony_morning_meds_taken data: {} - conditions: - condition: template value_template: '{{ wait.trigger.id == ''ask-later'' }}' alias: Ask Later sequence: - service: input_datetime.set_datetime target: entity_id: input_datetime.tony_morning_meds_notify data: datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,30) }} ' - conditions: - condition: template value_template: '{{ wait.trigger.id == ''left'' }}' alias: Left sequence: - service: script.text_notify data: who: tony type: critical title: HEY DUMBASS message: YOU FORGOT TO TAKE YOUR MORNING MEDS!!!!! - conditions: - condition: template value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined }}' alias: None or undefined sequence: - service: input_datetime.set_datetime target: entity_id: input_datetime.tony_morning_meds_notify data: datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1) }} ' - service: script.text_notify data: type: alert who: tony message: clear_notification tag: tony-morning-meds tony_night_meds: alias: Tony Night Meds icon: mdi:medication mode: restart sequence: - service: script.text_notify data: who: tony type: alert title: Night Meds message: You need to take your night meds tag: tony-night-meds actions: - action: TONY_NIGHT_MEDS_TAKEN title: Taken - action: TONY_NIGHT_MEDS_SKIPPED title: Skip - action: TONY_NIGHT_MEDS_ASK_LATER title: Ask Later - wait_for_trigger: - platform: event event_type: ios.notification_action_fired event_data: actionName: TONY_NIGHT_MEDS_TAKEN id: taken alias: Taken - platform: event event_type: ios.notification_action_fired event_data: actionName: TONY_NIGHT_MEDS_SKIPPED id: skipped alias: Skipped - platform: event event_type: ios.notification_action_fired event_data: actionName: TONY_NIGHT_MEDS_ASK_LATER id: ask-later alias: Ask Later - platform: state entity_id: input_boolean.tony_night_meds_taken to: 'on' id: manual alias: Manual timeout: 00:30:00 continue_on_timeout: true - choose: - conditions: - condition: template value_template: '{{ wait.trigger.id in [''taken'',''manual''] }}' alias: Taken, Manual sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.tony_night_meds_taken data: {} - conditions: - condition: template value_template: '{{ wait.trigger.id == ''ask-later'' }}' alias: Ask Later sequence: - service: input_datetime.set_datetime target: entity_id: input_datetime.tony_night_meds_notify data: datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,30) }} ' - conditions: - condition: template value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined }}' alias: None or undefined sequence: - if: - condition: and conditions: - condition: state entity_id: person.tony_stork state: home - condition: state entity_id: binary_sensor.morning state: 'off' then: - service: input_datetime.set_datetime target: entity_id: input_datetime.tony_night_meds_notify data: datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1) }} ' - service: script.text_notify data: type: alert who: tony message: clear_notification tag: tony-night-meds tony_stream_today: alias: Tony Stream Today sequence: - service: input_datetime.set_datetime target: entity_id: input_datetime.tony_streaming_start_time data: time: '{% from ''time.jinja'' import time_from_calendar %} {{ time_from_calendar(''calendar.tony_s_twitch_schedule'',''start_time'',''set'') }} ' - service: input_boolean.turn_on entity_id: input_boolean.tony_streaming_today mode: single timer_modify: alias: Timer Modify description: For adding/subtracting time from a running timer mode: restart sequence: - service: timer.pause target: entity_id: '{{ timer }}' - delay: seconds: 1 - variables: modify: '{% set x = state_attr(timer, ''remaining'') ~ ''-0000'' %} {% set y = strptime(x, ''%H:%M:%S%z'') %} {{ (as_timestamp(y) + change) | timestamp_custom(''%H:%M:%S'', false) }} ' - service: timer.start target: entity_id: '{{ timer }}' data: duration: '{{ modify }}' tony_custom_meds: alias: Tony Custom Meds sequence: - variables: reason: '{{ reason }}' num: '{{ num }}' active: '{{ ''input_boolean.tony_custom_meds_tracker_'' + num }}' taken: '{{ ''input_boolean.tony_custom_meds_taken_'' + num }}' taken_at: '{{ ''input_datetime.tony_custom_meds_taken_'' + num }}' notify_at: '{{ ''input_datetime.tony_custom_meds_notify_'' + num }}' type: '{{ states(''input_select.tony_custom_meds_type_'' + num) }}' name: '{{ states(''input_text.tony_custom_med_name_'' + num) }}' interval: '{{ states(''input_number.tony_custom_meds_interval_'' + num) }}' tag: '{{ ''tony-custom-meds-'' + num }}' alias: Set Variables - choose: - conditions: - condition: template value_template: '{{ reason == ''notify'' }}' alias: Notify sequence: - service: script.text_notify data: who: tony type: alert title: '{{ name + '' Tracker'' }}' message: You need to take your {{ name }} tag: '{{ tag }}' alias: Send text notification - wait_for_trigger: - platform: state entity_id: - person.tony_stork id: left alias: Left from: home - platform: template value_template: '{{ is_state(taken,''on'') }}' alias: Manual id: manual timeout: 00:30:00 continue_on_timeout: true - choose: - conditions: - condition: template value_template: '{{ wait.trigger.id in [''manual'',''left''] }}' alias: Manual or Left sequence: - stop: Automation cancelled - conditions: - condition: template value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined }}' alias: None or undefined sequence: - service: script.text_notify data: who: tony type: alert message: clear_notification tag: '{{ tag }}' alias: Clear Notification - service: input_datetime.set_datetime target: entity_id: input_datetime.tony_custom_meds_notify_p1 data: datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1) }} ' alias: Reset notification time alias: Choose depending on the wait trigger - conditions: - condition: template value_template: '{{ reason == ''taken'' }}' alias: Taken sequence: - service: input_datetime.set_datetime target: entity_id: '{{ taken_at }}' data: datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0) }} ' alias: Set time the meds were taken - if: - condition: template value_template: '{{ type == ''Interval'' }}' alias: Is it an interval med? then: - service: input_datetime.set_datetime target: entity_id: '{{ notify_at }}' data: datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(interval) }} ' alias: Set notification for next dose alias: If an interval med, then set time for next dose - service: script.text_notify data: who: tony type: alert message: clear_notification tag: '{{ tag }}' alias: Clear Notification alias: Routing icon: mdi:medication mode: parallel