Odd error with data_template value in list

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.

minutes: '*/28' is invalid.

minutes: '/28' is what you’re looking for if you want it to trigger each time the minute is divisible by 28 (as in at minute 28 and 56 of each hour).

1 Like

Thanks! That was it exactly. I was getting my crontab and time_patterns mixed up.

Ha, that’s exactly what I thought when I saw it.

‘*28’ will go every 28 minutes regardless of the position in the hour

So /28 will trigger at 0, 28 and 56 minutes past the hour (i.e. modulus of minute leaves 0 as remainder)

and …

*28 will go ‘every 28 minutes’ from some arbitrary starting point (no one has ever been able to define that for me !)