input_text:
  wake_up_spotify_playlist:
    name: Waking up Spotify playlist
    icon: mdi:spotify

input_number:
  wake_up_volume:
    name: Waking up volume
    min: 0
    max: 1
    step: 0.05
    icon: mdi:volume-high

script:
  routine_waking_up:
    alias: Routine · Waking up
    sequence:
      - service: light.turn_on
        entity_id: light.hallway
        data:
          brightness_pct: 100

      - service: light.turn_on
        entity_id:
          - light.living_room_ambient

      - service: script.open_living_room_cover
      - service: script.shield_screensaver

      # Only when no guests are present
      - and:
        - condition: state
          entity_id: input_boolean.guest_mode
          state: "off"
        - condition: state
          entity_id: input_boolean.guest_bedroom
          state: "off"
      # - wait_template: "{{ is_state('input_boolean.sarah_talking', 'off') }}"
      #   timeout: 00:02:00
      # - delay: 00:00:00
      # - service: script.say
      #   data:
      #     message: "Here's some music to start the day!"
      # - delay: 00:00:02
      - service: script.music_prepare
        data_template:
          volume_level: "{{ states('input_number.wake_up_volume') | float }}"
          shuffle: true
      - service: media_player.play_media
        target:
          entity_id: media_player.master_bedroom
        data_template:
          media_content_type: "music"
          media_content_id: "{{ states('input_text.wake_up_spotify_playlist') }}"

  routine_bedroom_morning:
    alias: Routine · Bedroom · Morning
    sequence:
      - service: fan.turn_off
        entity_id: fan.philips_airpurifier
      - service: media_player.media_stop
        entity_id: media_player.master_bedroom
      - delay: 00:00:01
      - service: light.turn_on
        entity_id:
          - light.bedside
      - service: script.routine_morning_briefing

  routine_morning_briefing:
    alias: Routine · Morning Briefing
    sequence:
      - service: script.chat
        data_template:
          partials:
            - !include ../../templates/partials/greeting.yaml
            - !include ../../templates/partials/time.yaml
            - !include ../../templates/partials/tasks.yaml
            - >-

              {{
                [
                  "Here's your briefing for today!",
                  "Here's what's up!",
                  "Here are the updates today!"
                ] | random
              }}
            - !include ../../templates/partials/master_bedroom_climate.yaml
            - !include ../../templates/partials/outside_forecast.yaml
            - !include ../../templates/partials/window_check.yaml
            - !include ../../templates/partials/window_suggestions.yaml
            - !include ../../templates/partials/iss.yaml
            - !include ../../templates/partials/moon.yaml
