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