Overall goal: I want a lamp that shows a different color throughout the week, based on the position of the current time within the span of that week. I have a integer range of 0-360 to represent that color, and so I’m trying to place an integer value (derived from adding minutes together and mapping to a value from within that range) into an hs_color
list.
My automation looks like this:
- id: '1589554169867'
alias: Update Multicolor Lamp
description: Update color of multicolor lamp based on position in week
trigger:
- minutes: '*/28'
platform: time_pattern
condition: []
action:
- data_template:
brightness_pct: 50
hs_color:
- '{{ (((now().weekday() * 1440) + (now().hour * 60) + (now().minute)) / 28) | int }}'
- 100
entity_id: light.multicolor_lamp
service: lifx.set_state
This validates as valid YAML and passes the overall configuration check. But when I load it as an automation, I get this error:
File "/usr/src/homeassistant/homeassistant/util/dt.py", line 235, in parse_time_expression
res = list(sorted(int(x) for x in parameter))
File "/usr/src/homeassistant/homeassistant/util/dt.py", line 235, in
res = list(sorted(int(x) for x in parameter))
ValueError: invalid literal for int() with base 10: '*'
I’ve tried every variant of quotes, not quotes, etc. If I remove the quotes around the template portion, I get this error from the overall configuration check:
Error loading /config/configuration.yaml: invalid key: "OrderedDict([('(((now().weekday() * 1440) + (now().hour * 60) + (now().minute)) / 28) | int', None)])"
in "/config/automations.yaml", line 1182, column 0
I must be doing something stupid. Does anyone know what it is? Thanks.