Help with storing automation color name

I have modified an automation today so that the automation uses variables for color names only once a day. I had it in the monthly options, but that fired a color change each instance. I might be getting ahead of myself, but this current version of the automation isn’t storing the color name anymore. Any chance there is a better way of doing this?

Thanks in advance!!!

alias: Garage - Backdoor Light
description: Turn light on backdoor when motion in garage
triggers:
  - entity_id:
      - binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off
    to: "on"
    id: Backdoor Open
    trigger: state
  - entity_id:
      - binary_sensor.motion_gar
    to: "on"
    id: Garage Motion
    trigger: state
  - trigger: state
    entity_id:
      - sensor.wled_garage_ip_3
    from: unavailable
    to: 192.168.1.55
    id: Unavail Trigger
  - trigger: time
    at: "01:00:00"
    weekday:
      - sun
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
    alias: ▲Color Daily
    id: ▲Color Daily
conditions:
  - condition: state
    entity_id: input_boolean.automations_kill_switch
    state: "off"
actions:
  - variables:
      month: "{{ now().month }}"
      day: "{{ now().day }}"
  - choose:
      - conditions:
          - condition: trigger
            id:
              - ▲Color Daily
        sequence:
          - variables:
              feb_color_name: >
                {{ ['Crimson', 'DeepPink', 'Fuchsia', 'Magenta',
                'MediumVioletRed', 'Orchid', 'Violet', 'Red', 'HotPink' ] |
                random }}'
              mar_color_name: >
                {{ ['Chartreuse', 'DarkGreen', 'DarkOliveGreen', 'DarkSeaGreen',
                'ForestGreen', 'Green', 'GreenYellow', 'LawnGreen',
                'LightGreen', 'Lime', 'MediumSeaGreen', 'MediumSpringGreen',
                'PaleGreen', 'SeaGreen', 'YellowGreen' ] | random }}
              jul_color_name: |
                {{ ['Crimson', 'Red', 'White', 'Blue', 'DarkBlue' ] | random }}
              sep_color_name: |
                {{ ['Red', 'White', 'Green' ] | random }}
              oct_color_name: >
                {{ ['BlueViolet', 'Coral', 'DarkMagenta', 'DarkOrchid',
                'DarkOrange', 'DarkViolet', 'Orange Red', 'Purple',
                'RebbecaPurple', 'Violet', 'Orange', 'MediumPurple', 'Indigo' ]
                | random }}
              nov_color_name: >
                {{ ['Brown', 'BurlyWood', 'Chocolate', 'DarkGoldenRod',
                'DarKhaki', 'DarkOrange', 'GoldenRod', 'Gold', 'Khaki',
                'LemonChiffon', 'LightGoldenRodYellow', 'LightYellow',
                'Moccasin', 'NavajoWhite', 'PaleGoldenRod', 'PapayaWhip',
                'Peru', 'SandyBrown', 'Sienna', 'Tan', 'Wheat', 'Yellow' ] |
                random }}
              dec_color_name: |
                {{ ['Red', 'White', 'Green' ] | random }}     
      - conditions:
          - condition: template
            value_template: "{{ (2,1) <= (month, day) <= (2,14) }}"
            alias: February
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
              color_name: "{{ feb_color_name }}"
            target:
              entity_id: light.wled_garage
          - action: input_text.set_value
            target:
              entity_id: input_text.garagehdoorcolor
            data:
              value: "{{ feb_color_name }}"
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: template
            value_template: "{{ (3,1) <= (month, day) <= (3,17) }}"
            alias: March
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
              color_name: "{{ mar_color_name }}"
            target:
              entity_id: light.wled_garage
          - action: input_text.set_value
            target:
              entity_id: input_text.garagehdoorcolor
            data:
              value: "{{ mar_color_name }}"
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: template
            value_template: "{{ (7,1) <= (now().month, now().day) <= (7,11) }}"
            alias: July
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
              color_name: "{{ jul_color_name }}"
            target:
              entity_id: light.wled_garage
          - action: input_text.set_value
            target:
              entity_id: input_text.garagehdoorcolor
            data:
              value: "{{ jul_color_name }}"
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: template
            value_template: "{{ (9,1) <= (month, day) <= (9,16) }}"
            alias: September
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
              color_name: "{{ sep_color_name }}"
            target:
              entity_id: light.wled_garage
          - action: input_text.set_value
            target:
              entity_id: input_text.garagehdoorcolor
            data:
              value: "{{ sep_color_name }}"
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: template
            value_template: "{{ (10,1) <= (month, day) <= (11,1) }}"
            alias: October
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
              color_name: "{{ oct_color_name }}"
            target:
              entity_id: light.wled_garage
          - action: input_text.set_value
            target:
              entity_id: input_text.garagehdoorcolor
            data:
              value: "{{ oct_color_name }}"
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: template
            value_template: "{{ (11,2) <= (month, day) <= (11,30) }}"
            alias: November
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
              color_name: "{{ nov_color_name }}"
            target:
              entity_id: light.wled_garage
          - action: input_text.set_value
            target:
              entity_id: input_text.garagehdoorcolor
            data:
              value: "{{ nov_color_name }}"
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: template
            value_template: "{{ (12,1) <= (month, day) <= (12,31) }}"
            alias: December
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
              color_name: "{{ dec_color_name }}"
            target:
              entity_id: light.wled_garage
          - action: input_text.set_value
            target:
              entity_id: input_text.garagehdoorcolor
            data:
              value: "{{ dec_color_name }}"
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: trigger
            id:
              - Unavail Trigger
        sequence:
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
          - condition: sun
            before: sunset
        sequence:
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
        alias: Turn Off if triggered before sunset
    default:
      - action: light.turn_on
        metadata: {}
        data:
          brightness_pct: 100
          color_name: blue
        target:
          entity_id: light.wled_garage
      - delay:
          hours: 0
          minutes: 3
          seconds: 0
          milliseconds: 0
      - action: light.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: light.wled_garage
mode: single

The only place all those color variables have a value is when the trigger is “▲Color Daily”. But all the actions that need the values from those variables to set the Input Text require different triggers… so the variables they have access to all have the value none.

Beyond that, you’ve got a lot of repetitive action configuration and there is an issue with the order of the options within the Choose action:

  • The repetition can be fixed by fixing the color storage. Once the day’s color is available from the Input Text, there’s no reason to have individual options in the Choose for each month.

  • When the automation runs, the options are checked from the top of the list to the bottom. So we need to move the Choose option “Turn Off if triggered before sunset” above the option that turns on the lights so it has a chance to check all its conditions before the “turn on” option gets chosen based on the trigger ID alone.

alias: Garage - Backdoor Light
description: Turn light on backdoor when motion in garage
triggers:
  - entity_id:
      - binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off
    to: "on"
    id: Backdoor Open
    trigger: state
  - entity_id:
      - binary_sensor.motion_gar
    to: "on"
    id: Garage Motion
    trigger: state
  - trigger: state
    entity_id:
      - sensor.wled_garage_ip_3
    from: unavailable
    to: 192.168.1.55
    id: Unavail Trigger
  - trigger: time
    at: "01:00:00"
    alias: ▲Color Daily
    id: ▲Color Daily
conditions:
  - condition: state
    entity_id: input_boolean.automations_kill_switch
    state: "off"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - ▲Color Daily
        sequence:
          - variables:
              month: "{{ now().month }}"
              day: "{{ now().day }}"
              md_tup: "{{ (month, day) }}"
              months:
                feb: "{{ (2,1) <= md_tup <= (2,14) }}"
                mar: "{{ (3,1) <= md_tup <= (3,17) }}"
                jul: "{{ (7,1) <= md_tup <= (7,11) }}"
                sep: "{{ (9,1) <= md_tup <= (9,16) }}"
                oct: "{{ (10,1) <= md_tup <= (11,1) }}"
                nov: "{{ (11,2) <= md_tup <= (11,30) }}"
                dec: "{{ (12,1) <= md_tup <= (12,31) }}"
              current_month: |
                {{ months.items()|selectattr(1, 'eq', true)|map(attribute=0)|first|default('default',true) }}
              colors:
                feb: >
                  {{ ['Crimson', 'DeepPink', 'Fuchsia', 'Magenta',
                  'MediumVioletRed', 'Orchid', 'Violet', 'Red', 'HotPink' ] |
                  random }}'
                mar: >
                  {{ ['Chartreuse', 'DarkGreen', 'DarkOliveGreen', 'DarkSeaGreen',
                  'ForestGreen', 'Green', 'GreenYellow', 'LawnGreen',
                  'LightGreen', 'Lime', 'MediumSeaGreen', 'MediumSpringGreen',
                  'PaleGreen', 'SeaGreen', 'YellowGreen' ] | random }}
                jul: |
                  {{ ['Crimson', 'Red', 'White', 'Blue', 'DarkBlue' ] | random }}
                sep: |
                  {{ ['Red', 'White', 'Green' ] | random }}
                oct: >
                  {{ ['BlueViolet', 'Coral', 'DarkMagenta', 'DarkOrchid',
                  'DarkOrange', 'DarkViolet', 'Orange Red', 'Purple',
                  'RebbecaPurple', 'Violet', 'Orange', 'MediumPurple', 'Indigo' ]
                  | random }}
                nov: >
                  {{ ['Brown', 'BurlyWood', 'Chocolate', 'DarkGoldenRod',
                  'DarKhaki', 'DarkOrange', 'GoldenRod', 'Gold', 'Khaki',
                  'LemonChiffon', 'LightGoldenRodYellow', 'LightYellow',
                  'Moccasin', 'NavajoWhite', 'PaleGoldenRod', 'PapayaWhip',
                  'Peru', 'SandyBrown', 'Sienna', 'Tan', 'Wheat', 'Yellow' ] |
                  random }}
                dec: |
                  {{ ['Red', 'White', 'Green' ] | random }}
                default:
                  - blue
            - action: input_text.set_value
              target:
                entity_id: input_text.garagehdoorcolor
              data:
                value: "{{ colors.get(current_month, 'blue') }}"
      - conditions:
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
          - condition: sun
            before: sunset
        sequence:
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
        alias: Turn Off if triggered before sunset
      - conditions:
          - condition: trigger
            id:
              - Backdoor Open
              - Garage Motion
        sequence:
          - action: light.turn_on
            metadata: {}
            data:
              brightness_pct: 100
              color_name: "{{ states('input_text.garagehdoorcolor')|default('blue',true) }}"
            target:
              entity_id: light.wled_garage
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
      - conditions:
          - condition: trigger
            id:
              - Unavail Trigger
        sequence:
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.wled_garage
mode: single

Man I learn so much from this community!!! I thought I was doing great in my automations and organizing them this way and boom! There is a better method. I will test this one out. Thanks so much!!!

One question I do have is that if I am reading this right, you are only setting a color change once a month or is this trigger once a day?

The color is set daily, since that’s what you described in the original post.

I am following the majority of the automation you built but want to understand this so I can apply it to other automations if you have the time.

The part I am getting a little lost is this section where you are defining “current month”. Couldn’t we have just used “months” to call out the color later in the automation?

              month: "{{ now().month }}"
              day: "{{ now().day }}"
              md_tup: "{{ (month, day) }}"
              months:
                feb: "{{ (2,1) <= md_tup <= (2,14) }}"
                mar: "{{ (3,1) <= md_tup <= (3,17) }}"
                jul: "{{ (7,1) <= md_tup <= (7,11) }}"
                sep: "{{ (9,1) <= md_tup <= (9,16) }}"
                oct: "{{ (10,1) <= md_tup <= (11,1) }}"
                nov: "{{ (11,2) <= md_tup <= (11,30) }}"
                dec: "{{ (12,1) <= md_tup <= (12,31) }}"
              current_month: >
                {{ months.items()|selectattr(1, 'eq',
                true)|map(attribute=0)|first|default('default',true) }}

Maybe explain what is this section doing where you are defining “current month”. Is the documentation behind this I can look at to help understand? I am a little lost on that one. Great solution!

What do you mean by “later in the automation”?


What I’m doing there is just setting it up so that at the end we know which item to pick from the colors mapping.

The current_month variable template breaks down as follows:

{{ months.items()

Here we are taking the mapping months we built previously and using the items() method to return those key-value pairs as a list of tuples (IIRC it’s not technically a list, but its close enough for this discussion). Each tuple will contain 2 items/attributes. The first is the key and the second is the rendered value of the template.

So from {"feb": false,...} to [("feb", false), ...].

Like other lists and tuples, they are indexed starting at 0. So the original key is attribute 0 and the value is attribute 1.

| selectattr(1, 'eq', true)

Here we iterate through all the tuples, selecting only those whose original value template (attribute index 1) rendered as true.

| map(attribute=0)

The map() filter here is being used to look up the attribute that represents the original key, which is the month abbreviations we want to select the correct color. Those whose month templates returned true will all be passed to…

| first

… the first() filter which will return the first item of the sequence. If none of them were true, it will return none.

| default('default',true) }}

In the case that none is returned, we set a default with the default_value parameter set to true. I used the string “default”, but it could be anything so long as you add it to the colors mapping that follows.

Jinja2 - Template Designer Documentation

Home Assistant - Building Templates

  • I didn’t actually use any HA-specific functions in the part you are asking about, but those can be found at the link above.

The other piece I used was the Python dictionary method items(). Jinja2 is built on Python, so a number of Python methods are available to use directly on their respective data types. As far I as know, which methods are available isn’t really documented anywhere… you just have to try them and see what works.

Thanks for taking the time to explain this for me. You can pick up so much in this Community website. I do appreciate the help! I will break this down and attempt to use this same logic in my other light automations. Thanks again and have a great holiday!

I ended up using your code in another automation and can’t thank you enough. It is a lot easier to read / code. Super helpful!

alias: Bathroom - RGB Socket On Off 12-2025
description: ""
triggers:
  - at: "06:00:00"
    id: "off"
    trigger: time
    alias: Turn on
  - at: "19:00:00"
    id: "on"
    trigger: time
    alias: Turn Off
conditions:
  - condition: state
    entity_id: input_boolean.automations_kill_switch
    state: "off"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "on"
        sequence:
          - variables:
              month: "{{ now().month }}"
              day: "{{ now().day }}"
              md_tup: "{{ (month, day) }}"
              months:
                feb: "{{ (2,1) <= md_tup <= (2,14) }}"
                mar: "{{ (3,1) <= md_tup <= (3,17) }}"
                jul: "{{ (7,1) <= md_tup <= (7,11) }}"
                sep: "{{ (9,1) <= md_tup <= (9,16) }}"
                oct: "{{ (10,1) <= md_tup <= (11,1) }}"
                nov: "{{ (11,2) <= md_tup <= (11,30) }}"
                dec: "{{ (12,1) <= md_tup <= (12,31) }}"
              current_month: >
                {{ months.items()|selectattr(1, 'eq',
                true)|map(attribute=0)|first|default('default',true) }}
              colors:
                feb: >
                  {{ ['Crimson', 'DeepPink', 'Fuchsia', 'Magenta',
                  'MediumVioletRed', 'Orchid', 'Violet', 'Red', 'HotPink' ] |
                  random }}'
                mar: >
                  {{ ['Chartreuse', 'DarkGreen', 'DarkOliveGreen',
                  'DarkSeaGreen', 'ForestGreen', 'Green', 'GreenYellow',
                  'LawnGreen', 'LightGreen', 'Lime', 'MediumSeaGreen',
                  'MediumSpringGreen', 'PaleGreen', 'SeaGreen', 'YellowGreen' ]
                  | random }}
                jul: >
                  {{ ['Crimson', 'Red', 'White', 'Blue', 'DarkBlue' ] | random
                  }}
                sep: |
                  {{ ['Red', 'White', 'Green' ] | random }}
                oct: >
                  {{ ['BlueViolet', 'Coral', 'DarkMagenta', 'DarkOrchid',
                  'DarkOrange', 'DarkViolet', 'Orange Red', 'Purple',
                  'RebbecaPurple', 'Violet', 'Orange', 'MediumPurple', 'Indigo'
                  ] | random }}
                nov: >
                  {{ ['Brown', 'BurlyWood', 'Chocolate', 'DarkGoldenRod',
                  'DarKhaki', 'DarkOrange', 'GoldenRod', 'Gold', 'Khaki',
                  'LemonChiffon', 'LightGoldenRodYellow', 'LightYellow',
                  'Moccasin', 'NavajoWhite', 'PaleGoldenRod', 'PapayaWhip',
                  'Peru', 'SandyBrown', 'Sienna', 'Tan', 'Wheat', 'Yellow' ] |
                  random }}
                dec: |
                  {{ ['Red', 'White', 'Green' ] | random }}
                default: blue
          - action: input_text.set_value
            target:
              entity_id: input_text.rgbccolorame
            data:
              value: "{{ colors[current_month] }}"
          - target:
              entity_id: light.rgb_smart_plug
            data:
              brightness_pct: 100
              color_name: "{{ states('input_text.rgbccolorame')|default('blue',true) }}"
            action: light.turn_on
        alias: Turn on
      - conditions:
          - condition: trigger
            id: "off"
        sequence:
          - data: {}
            target:
              entity_id: light.rgb_smart_plug
            action: light.turn_off
        alias: "Off"
mode: single

Didgeridrew:

I am attempting to use a twist on the autmation you helped me with. I have a doppler clock and I would like four random colors out of the same set.

So here is my attempt below. The only problem I have is that every trigger it is the same color for all the displays on the clock.

Where did I go wrong?

alias: Bedroom - Doppler Color Change 12-2025
description: Doppler Color Change
triggers:
  - at: "01:00:00"
    id: ▲Color
    trigger: time
  - trigger: state
    entity_id:
      - binary_sensor.bedroom_alexa
    from: null
    to:
      - unavailable
    for:
      hours: 4
      minutes: 0
      seconds: 0
    id: Unavailable 4 hours
conditions:
  - condition: state
    entity_id: input_boolean.automations_kill_switch
    state: "off"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - ▲Color
        sequence:
          - variables:
              month: "{{ now().month }}"
              day: "{{ now().day }}"
              md_tup: "{{ (month, day) }}"
              months:
                feb: "{{ (2,1) <= md_tup <= (2,14) }}"
                mar: "{{ (3,1) <= md_tup <= (3,17) }}"
                jul: "{{ (7,1) <= md_tup <= (7,11) }}"
                sep: "{{ (9,1) <= md_tup <= (9,16) }}"
                oct: "{{ (10,1) <= md_tup <= (11,1) }}"
                nov: "{{ (11,2) <= md_tup <= (11,30) }}"
                dec: "{{ (12,1) <= md_tup <= (12,31) }}"
              current_month_day: >
                {{ months.items()|selectattr(1, 'eq',
                true)|map(attribute=0)|first|default('default',true) }}
              current_month_night: >
                {{ months.items()|selectattr(1, 'eq',
                true)|map(attribute=0)|first|default('default',true) }}
              current_month_daybut: >
                {{ months.items()|selectattr(1, 'eq',
                true)|map(attribute=0)|first|default('default',true) }}
              current_month_nightbut: >
                {{ months.items()|selectattr(1, 'eq',
                true)|map(attribute=0)|first|default('default',true) }}
              colors:
                feb: >
                  {{ ['Crimson', 'DeepPink', 'Fuchsia', 'Magenta',
                  'MediumVioletRed', 'Orchid', 'Violet', 'Red', 'HotPink' ] |
                  random }}'
                mar: >
                  {{ ['Chartreuse', 'DarkGreen', 'DarkOliveGreen',
                  'DarkSeaGreen', 'ForestGreen', 'Green', 'GreenYellow',
                  'LawnGreen', 'LightGreen', 'Lime', 'MediumSeaGreen',
                  'MediumSpringGreen', 'PaleGreen', 'SeaGreen', 'YellowGreen' ]
                  | random }}
                jul: >
                  {{ ['Crimson', 'Red', 'White', 'Blue', 'DarkBlue' ] | random
                  }}
                sep: |
                  {{ ['Red', 'White', 'Green' ] | random }}
                oct: >
                  {{ ['BlueViolet', 'Coral', 'DarkMagenta', 'DarkOrchid',
                  'DarkOrange', 'DarkViolet', 'Orange Red', 'Purple',
                  'RebbecaPurple', 'Violet', 'Orange', 'MediumPurple', 'Indigo'
                  ] | random }}
                nov: >
                  {{ ['Brown', 'BurlyWood', 'Chocolate', 'DarkGoldenRod',
                  'DarKhaki', 'DarkOrange', 'GoldenRod', 'Gold', 'Khaki',
                  'LemonChiffon', 'LightGoldenRodYellow', 'LightYellow',
                  'Moccasin', 'NavajoWhite', 'PaleGoldenRod', 'PapayaWhip',
                  'Peru', 'SandyBrown', 'Sienna', 'Tan', 'Wheat', 'Yellow' ] |
                  random }}
                dec: |
                  {{ ['Red', 'White', 'Green' ] | random }}
                default: blue
          - action: input_text.set_value
            target:
              entity_id: input_text.doppler_timeday_color
            data:
              value: "{{ colors[current_month_day] }}"
          - action: input_text.set_value
            target:
              entity_id: input_text.doppler_timenight_color
            data:
              value: "{{ colors[current_month_night] }}"
          - action: input_text.set_value
            target:
              entity_id: input_text.doppler_daybutton_color
            data:
              value: "{{ colors[current_month_daybut] }}"
          - action: input_text.set_value
            target:
              entity_id: input_text.doppler_nightbutton_color
            data:
              value: "{{ colors[current_month_nightbut] }}"
          - target:
              entity_id: light.bedroom_day_display
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_timeday_color')|default('cyan',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_night_display
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_timenight_color')|default('blue',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_day_button
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_daybutton_color')|default('cyan',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_night_button
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_nightbutton_color')|default('blue',true)
                }}
            action: light.turn_on
        a
              device_id: b12e288369173287ac6da71f52ed392b
            data: {}
mode: single
  1. You need to move where the random pick happens. The way you are currently doing it, the random pick is made and set in stone before you get to the first input_text.set_value action.

  2. You seem to have left random junk throughout the automation…

    • The “Unavailable 4 hours” trigger has no actions that it can execute…
    • You’re using a Choose action with only one choice…
    • There’s random stuff at the end…
        a
              device_id: b12e288369173287ac6da71f52ed392b
            data: {}

Remove all the random filters from the different items in colors, so instead of:

feb: >
 {{ ['Crimson', 'DeepPink', 'Fuchsia', 'Magenta',
 'MediumVioletRed', 'Orchid', 'Violet', 'Red', 'HotPink' ] | random }}

use:

feb: >
 {{ ['Crimson', 'DeepPink', 'Fuchsia', 'Magenta',
 'MediumVioletRed', 'Orchid', 'Violet', 'Red', 'HotPink'] }}

Then add the random where the values are being set for the Input Texts. I would use a Repeat:

          - repeat:
              for_each:
                - input_text.doppler_timeday_color
                - input_text.doppler_timenight_color
                - input_text.doppler_daybutton_color
                - input_text.doppler_nightbutton_color
              sequence:      
                - action: input_text.set_value
                  target:
                    entity_id: "{{ repeat.item }}"
                  data:
                    value: "{{ colors[current_month_day]|random }}"

OK, I have cleaned it up a lot. Just to let you know the Unavailable trigger is an attempt to reload the Doppler integration because it has a tendency to drop off a lot. Is there a better way or am I doing that all wrong?

Here is the updated code (curious why my versions pasted here are never as color coded as yours?)

alias: Bedroom - Doppler Color Change 12-18-2025
description: Doppler Color Change
triggers:
  - at: "01:00:00"
    id: ▲Color
    trigger: time
  - trigger: state
    entity_id:
      - binary_sensor.bedroom_alexa
    from: null
    to:
      - unavailable
    for:
      hours: 4
      minutes: 0
      seconds: 0
    id: Unavailable 4 hours
conditions:
  - condition: state
    entity_id: input_boolean.automations_kill_switch
    state: "off"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - ▲Color
        sequence:
          - variables:
              month: "{{ now().month }}"
              day: "{{ now().day }}"
              md_tup: "{{ (month, day) }}"
              months:
                feb: "{{ (2,1) <= md_tup <= (2,14) }}"
                mar: "{{ (3,1) <= md_tup <= (3,17) }}"
                jul: "{{ (7,1) <= md_tup <= (7,11) }}"
                sep: "{{ (9,1) <= md_tup <= (9,16) }}"
                oct: "{{ (10,1) <= md_tup <= (11,1) }}"
                nov: "{{ (11,2) <= md_tup <= (11,30) }}"
                dec: "{{ (12,1) <= md_tup <= (12,31) }}"
              current_month: >
                {{ months.items()|selectattr(1, 'eq',
                true)|map(attribute=0)|first|default('default',true) }}
              colors:
                feb: >
                  {{ ['Crimson', 'DeepPink', 'Fuchsia', 'Magenta',
                  'MediumVioletRed', 'Orchid', 'Violet', 'Red', 'HotPink' ] }}'
                mar: >
                  {{ ['Chartreuse', 'DarkGreen', 'DarkOliveGreen',
                  'DarkSeaGreen', 'ForestGreen', 'Green', 'GreenYellow',
                  'LawnGreen', 'LightGreen', 'Lime', 'MediumSeaGreen',
                  'MediumSpringGreen', 'PaleGreen', 'SeaGreen', 'YellowGreen' ]
                  }}
                jul: |
                  {{ ['Crimson', 'Red', 'White', 'Blue', 'DarkBlue' ] }}
                sep: |
                  {{ ['Red', 'White', 'Green' ] }}
                oct: >
                  {{ ['BlueViolet', 'Coral', 'DarkMagenta', 'DarkOrchid',
                  'DarkOrange', 'DarkViolet', 'Orange Red', 'Purple',
                  'RebbecaPurple', 'Violet', 'Orange', 'MediumPurple', 'Indigo'
                  ] }}
                nov: >
                  {{ ['Brown', 'BurlyWood', 'Chocolate', 'DarkGoldenRod',
                  'DarKhaki', 'DarkOrange', 'GoldenRod', 'Gold', 'Khaki',
                  'LemonChiffon', 'LightGoldenRodYellow', 'LightYellow',
                  'Moccasin', 'NavajoWhite', 'PaleGoldenRod', 'PapayaWhip',
                  'Peru', 'SandyBrown', 'Sienna', 'Tan', 'Wheat', 'Yellow' ] }}
                dec: |
                  {{ ['Red', 'White', 'Green' ] }}
                default: blue
          - repeat:
              for_each:
                - input_text.doppler_timeday_color
                - input_text.doppler_timenight_color
                - input_text.doppler_daybutton_color
                - input_text.doppler_nightbutton_color
              sequence:
                - action: input_text.set_value
                  target:
                    entity_id: "{{ repeat.item }}"
                  data:
                    value: "{{ colors[current_month]|random }}"
          - target:
              entity_id: light.bedroom_day_display
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_timeday_color')|default('cyan',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_night_display
            data:
              brightness_pct: 50
              color_name: >-
                {{
                states('input_text.doppler_timenight_color')|default('blue',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_day_button
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_daybutton_color')|default('cyan',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_night_button
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_nightbutton_color')|default('blue',true)
                }}
            action: light.turn_on
        alias: Turn on
      - conditions:
          - condition: trigger
            id:
              - Unavailable 4 hours
        sequence:
          - action: homeassistant.reload_config_entry
            target:
              device_id: b12e288369173287ac6da71f52ed392b
            data: {}
mode: single

I am having problems on the Default setting here. It is only picking up the letters of blue in the input helpers. Any advice on how to set up the default correctly here?

Here is the code as of now:

alias: Bedroom - Doppler Color Change 12-18-2025
description: Doppler Color Change
triggers:
  - at: "01:00:00"
    id: ▲Color
    trigger: time
  - trigger: state
    entity_id:
      - binary_sensor.bedroom_alexa
    from: null
    to:
      - unavailable
    for:
      hours: 4
      minutes: 0
      seconds: 0
    id: Unavailable 4 hours
conditions:
  - condition: state
    entity_id: input_boolean.automations_kill_switch
    state: "off"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - ▲Color
        sequence:
          - variables:
              month: "{{ now().month }}"
              day: "{{ now().day }}"
              md_tup: "{{ (month, day) }}"
              months:
                feb: "{{ (2,1) <= md_tup <= (2,14) }}"
                mar: "{{ (3,1) <= md_tup <= (3,17) }}"
                jul: "{{ (7,1) <= md_tup <= (7,11) }}"
                sep: "{{ (9,1) <= md_tup <= (9,16) }}"
                oct: "{{ (10,1) <= md_tup <= (11,1) }}"
                nov: "{{ (11,2) <= md_tup <= (11,30) }}"
                dec: "{{ (12,1) <= md_tup <= (12,31) }}"
              current_month: >
                {{ months.items()|selectattr(1, 'eq',
                true)|map(attribute=0)|first|default('default',true) }}
              colors:
                feb: >
                  {{ ['Crimson', 'DeepPink', 'Fuchsia', 'Magenta',
                  'MediumVioletRed', 'Orchid', 'Violet', 'Red', 'HotPink' ] }}'
                mar: >
                  {{ ['Chartreuse', 'DarkGreen', 'DarkOliveGreen',
                  'DarkSeaGreen', 'ForestGreen', 'Green', 'GreenYellow',
                  'LawnGreen', 'LightGreen', 'Lime', 'MediumSeaGreen',
                  'MediumSpringGreen', 'PaleGreen', 'SeaGreen', 'YellowGreen' ]
                  }}
                jul: |
                  {{ ['Crimson', 'Red', 'White', 'Blue', 'DarkBlue' ] }}
                sep: |
                  {{ ['Red', 'White', 'Green' ] }}
                oct: >
                  {{ ['BlueViolet', 'Coral', 'DarkMagenta', 'DarkOrchid',
                  'DarkOrange', 'DarkViolet', 'Orange Red', 'Purple',
                  'RebbecaPurple', 'Violet', 'Orange', 'MediumPurple', 'Indigo'
                  ] }}
                nov: >
                  {{ ['Brown', 'BurlyWood', 'Chocolate', 'DarkGoldenRod',
                  'DarKhaki', 'DarkOrange', 'GoldenRod', 'Gold', 'Khaki',
                  'LemonChiffon', 'LightGoldenRodYellow', 'LightYellow',
                  'Moccasin', 'NavajoWhite', 'PaleGoldenRod', 'PapayaWhip',
                  'Peru', 'SandyBrown', 'Sienna', 'Tan', 'Wheat', 'Yellow' ] }}
                dec: |
                  {{ ['Red', 'White', 'Green' ] }}
                default: blue
          - repeat:
              for_each:
                - input_text.doppler_timeday_color
                - input_text.doppler_timenight_color
                - input_text.doppler_daybutton_color
                - input_text.doppler_nightbutton_color
              sequence:
                - action: input_text.set_value
                  target:
                    entity_id: "{{ repeat.item }}"
                  data:
                    value: "{{ colors[current_month]|random }}"
          - target:
              entity_id: light.bedroom_day_display
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_timeday_color')|default('cyan',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_night_display
            data:
              color_name: >-
                {{
                states('input_text.doppler_timenight_color')|default('blue',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_day_button
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_daybutton_color')|default('lime',true)
                }}
            action: light.turn_on
          - target:
              entity_id: light.bedroom_night_button
            data:
              brightness_pct: 100
              color_name: >-
                {{
                states('input_text.doppler_nightbutton_color')|default('purple',true)
                }}
            action: light.turn_on
          - action: light.turn_on
            metadata: {}
            target:
              entity_id: light.bedroom_night_display
            data:
              brightness_pct: 25
        alias: Turn on
      - conditions:
          - condition: trigger
            id:
              - Unavailable 4 hours
        sequence:
          - action: homeassistant.reload_config_entry
            target:
              device_id: 8fe481f2f5a7b52cb9674339f98e44da
            data: {}
mode: single

You don’t have a specific setting for January so it will always be blue…

EDIT:

Oh, are you saying it’s returning a random letter from the word “blue”, like “l” or “u”?

The color name “blue” needs to be in a list. Either of the following should work:

...
                dec: |
                  {{ ['Red', 'White', 'Green' ] }}
                default: "{{ ['blue'] }}"
...
...
                dec: |
                  {{ ['Red', 'White', 'Green' ] }}
                default: 
                  - blue
...

Another option would be to change the template in the action so it check the value of current_month:

sequence:
  - action: input_text.set_value
    target:
      entity_id: "{{ repeat.item }}"
    data:
      value: "{{ 'blue' if current_month == 'default' else colors[current_month]|random }}"

Man I tried every combination and the above worked. Appreciate the advice!