Sets daytime mode depending on time and day off

This blueprint sets an input_select containing different daytime modes depending on set times. The state of the input_select could be used as a trigger for a variety of events. As an example, I use the state of the input_select to call different light profiles over the day (Turn on a light with different light profile).
The time for “wake up” and “morning” mode could be defined individually if today is a day off or not.
A time for “bedtime” mode could be defined, if tomorrow is not a day off.

Requirements for this blueprints are:
A input_select, containing the following(“Nightmode” is not obligatory):

input_select.yaml
daytimemode:
name: daytimemode
options:
- Wakeup
- Morning
- Lunchtime
- Afternoon
- Evening
- Bedtime
- Nightmode
initial: Wakeup

and two binary sensors. One for day off today and one fore day off tomorrow.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Change daytime mode
  description: "This Blueprint changes the state of a Input_select depending on the time of the day and of today ore tomorrow ist a day off. "
  domain: automation
  input:
    dayzykle:
      name: Dayzykle
      description: "This must be an input_select with the variaty of dayzykle. The input_select must contains minimum following selectors: Wakeup, Morning, Lunchtime, Afternoon, Evening, Bedtime."
      selector:
        entity:
          domain: input_select

    day_off_today:
      name: "day off today"
      description: "Boolan sensor if today is a day off."
      selector:
        entity:
          domain: binary_sensor
    day_off_tomorrow:
      name: "day off tomorrow"
      description: "Boolan sensor if tomorrow is a day off."
      selector:
        entity:
          domain: binary_sensor

    wakeup:
      name: "Wakeup time"
      description: "Time when changing the input_select to Wakeup mode!"
      selector:
        time:
    wakeup_day_off:
      name: "Wakeup time day off"
      description: "Time when changing the input_select to Wakeup mode on day off!"
      selector:
        time:
    morning:
      name: "Morning time"
      description: "Time when changing the input_select to Morning mode!"
      selector:
        time:
    morning_day_off:
      name: "Morning time day off"
      description: "Time when changing the input_select to Morning mode on day off!"
      selector:
        time:
    lunchtime:
      name: Lunchtime
      description: "Time when changing the input_select to lunchtime mode!"
      selector:
        time:
    afternoon:
      name: Afternoon
      description: "Time when changing the input_select to afternoon mode!"
      selector:
        time:
    evening:
      name: Evening
      description: "Time when changing the input_select to evening mode!"
      selector:
        time:
    bedtime_no_day_off_tomorrow:
      name: "bedtime_no_day_off_tomorrow"
      description: "Time when changing the input_select to bedtime mode when tomorre is no day off!"
      selector:
        time:

mode: restart

trigger:
  - platform: time
    at: !input wakeup # trigger 0
  - platform: time
    at: !input wakeup_day_off # trigger 1
  - platform: time
    at: !input morning # trigger 2
  - platform: time
    at: !input morning_day_off # trigger 3
  - platform: time
    at: !input lunchtime # trigger 4
  - platform: time
    at: !input afternoon # trigger 5
  - platform: time
    at: !input evening # trigger 6
  - platform: time
    at: !input bedtime_no_day_off_tomorrow # trigger 7
  - platform: homeassistant # trigger 8
    event: start

action:
  - variables:
      trigger_id: "{{ trigger.id }}"

  - choose:
      #wakeup no day off
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 0 }}
              - condition: state
                entity_id: !input day_off_today
                state: "off"
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Wakeup
      #wakeup day off
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 1 }}
              - condition: state
                entity_id: !input day_off_today
                state: "on"
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Wakeup
      #Morning no day off
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 2 }}
              - condition: state
                entity_id: !input day_off_today
                state: "off"
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Morning
      #Morning day off
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 3 }}
              - condition: state
                entity_id: !input day_off_today
                state: "on"
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Morning
      #Lunchtime
      - conditions:
          condition: template
          value_template: >
            {{ trigger_id == 4 }}
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Lunchtime
      #Afternoon
      - conditions:
          condition: template
          value_template: >
            {{ trigger_id == 5 }}
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: "Afternoon"
      #Evening
      - conditions:
          condition: template
          value_template: >
            {{ trigger_id == 6 }}
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: "Evening"
      #bedtime no day off tomorrow
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 7 }}
              - condition: state
                entity_id: !input day_off_tomorrow
                state: "off"
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Bedtime
      #on reboot server#wakeup no day off
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: state
                entity_id: !input day_off_today
                state: "off"
              - condition: time
                after: !input wakeup
                before: !input morning
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Wakeup
      #on reboot server#wakeup day off
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: state
                entity_id: !input day_off_today
                state: "on"
              - condition: time
                after: !input wakeup_day_off
                before: !input morning_day_off
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Wakeup
      #on server start#Morning no day off
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: state
                entity_id: !input day_off_today
                state: "off"
              - condition: time
                after: !input morning
                before: !input lunchtime
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Morning
      #on server start#Morning day off
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: state
                entity_id: !input day_off_today
                state: "on"
              - condition: time
                after: !input morning_day_off
                before: !input lunchtime
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Morning
      #on server start#Lunchtime
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: time
                after: !input lunchtime
                before: !input afternoon
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Lunchtime
      #on server start#Afternoon
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: time
                after: !input afternoon
                before: !input evening
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: "Afternoon"
      #on server start#Evening no day off tomorrow
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: state
                entity_id: !input day_off_tomorrow
                state: "off"
              - condition: time
                after: !input evening
                before: !input bedtime_no_day_off_tomorrow
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: "Evening"
      #on server start#Evening day off tomorrow
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: state
                entity_id: !input day_off_tomorrow
                state: "on"
              - condition: time
                after: !input evening
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: "Evening"
      #on server start#bedtime no day off tomorrow
      - conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >
                  {{ trigger_id == 8 }}
              - condition: state
                entity_id: !input day_off_tomorrow
                state: "off"
              - condition: time
                after: !input bedtime_no_day_off_tomorrow
        sequence:
          - service: input_select.select_option
            target:
              entity_id: !input "dayzykle"
            data:
              option: Bedtime

Hi!

Would love to use your blueprint, but I am still figuring things out in Home Assistant. Got the input_select working, but can't figure out how to set up the binary sensors. Would you be willing to elaborate how to do this?

and two binary sensors. One for day off today and one fore day off tomorrow.

Hi elvee,
basically I use the work day integration to generate those binary sensors.
To spice everthing up I use the caldav integration and combine those Binary sensors using a template sensor. But every other calender integration should work as well.

my template sensor looks like this

 binary_sensor:
  - name: "day off today"
    unique_id: "day off today"
    state: >
      {{ is_state('calendar.workcalender_vacation_today', 'on')
        or is_state('binary_sensor.weekend', 'on')
        or is_state('binary_sensor.holidays', 'on') }}
  - name: "day off tomorrow"
    unique_id: "day off tomorrow"
    state: >
      {{ is_state('binary_sensor.workcalender_vacation_tomorrow', 'on')
        or is_state('binary_sensor.weekend_tomorrow', 'on')
        or is_state('binary_sensor.holidays_tomorrow', 'on') }}

Thanks a lot for your reply. Should be able to get this working now.

I used different time of day states in my former home automation setup.
Your blueprint is a very big advantage to use time of day based automations.
Thanks!!!

thanks for this blueprint but, if i would use the last selector nightmode how i can implement it into your blueprint?

Hi. I trigger the nightmode by an extra automatisation. You have to ad a Trigger and a related condition and an Input to the blueprint.
Sorry for the late and short answer. I currently dont have much time.
BR