script:
  bedroom_good_night:
    alias: Routine · Bedroom · Going to sleep
    sequence:
      - service: media_player.unjoin
        entity_id: media_player.master_bedroom
      - service: media_player.media_stop
        entity_id: media_player.master_bedroom
        # Use say_discretely instead of talk, because night mode is already on.
        # - service: script.say_discretely
        #   data:
        #     message: "Entering night mode. Good night!"

      - service: fan.turn_on
        entity_id: fan.philips_airpurifier
      - service: input_select.select_option
        entity_id: input_select.purifier_preset_mode
        data:
          option: "sleep"

      - service: light.turn_off
        entity_id: light.master_bedroom


  routine_good_night:
    alias: Routine · Going to sleep
    sequence:
      - service: media_player.media_stop
        entity_id:
          - media_player.master_bedroom
          - media_player.bathroom
          - media_player.kitchen
          - media_player.living_room

      # Turn off everything else
      - service: homeassistant.turn_off
        entity_id:
          - light.living_room
          - light.master_bedroom
          - light.kitchen
          - light.hallway
          - light.tradfri_large
          - media_player.nvidia_shield
          - media_player.living_room_tv
          - switch.cadmium
          - group.all_radiators

      - service: script.browsers_low

      - service: cover.close_cover
        entity_id: cover.living_room
      - service: script.living_room_candle_off
