Blueprint/script for light brightness depending on day night and time

Hi there

want to simplfile my automation currently i have a 2-3 automations for every light i have

this is what happens

if light is turned on and its day time set light to 30%
if light is turned on and its night time set light to 80% or if after 10pm set to 30%

anyway to do this to a blueprint/script that is just done once and done globally to all lights?

regards
Jerent

The first step is to do this all as one automation. then change it to add the !inputs to make it a blueprint.

Hard to have comunity shared blueprint for this, because HA doesn’t have “preinstalled” mode selector, so everyone does this on their own.
I have input_select.mode with values Day, Evening, Night, Away and Holiday. Then, when you want to turn on light by motion for example, instead of calling light.turn_on, I call following script. Most zigbee lights I found can’t be pre-configured to certaing brightness without turing them on, and also you’ll find different dimmers have different lower value. For example the lowest value for one of my lights is 15%, while another has 10%. And that means you end up with different setting for each light anyway.

alias: Set Light Per Mode
fields:
  light:
    name: Light
    selector:
      entity:
        domain: light
    required: true
  day:
    selector:
      number:
        min: 0
        max: 100
        step: 1
        unit_of_measurement: "%"
        mode: slider
    default: 0
  evening:
    selector:
      number:
        min: 0
        max: 100
        step: 1
        unit_of_measurement: "%"
        mode: slider
    default: 100
  night:
    selector:
      number:
        min: 0
        max: 100
        step: 1
        unit_of_measurement: "%"
        mode: slider
    default: 20
sequence:
  - condition: template
    value_template: >-
      {{ (is_state('input_select.mode', 'Night') and night > 0) or
      (is_state('input_select.mode', 'Evening') and evening > 0) or
      (is_state('input_select.mode', 'Day') and day > 0) }}
  - service: light.turn_on
    data_template:
      entity_id: "{{ light }}"
      brightness_pct: >-
        {% if is_state('input_select.mode', 'Night') %} {{ night }} {% elif
        is_state('input_select.mode', 'Evening') %} {{ evening }} {% else %} {{
        day }} {% endif %}
mode: single
icon: mdi:brightness-6