#Templating `kelvin` value based on a loop variable within a repeat block

1 messages Β· Page 1 of 1 (latest)

remote anchor
#

Hi πŸ™‚ I have a wake-up automation which is supposed to take the brightness of lights through its range (0% - 100%), as well as the colour temperature through its range (6535 - 2000). I am trying to do that in ten steps using this repeat block:

action: light.turn_on
metadata: {}
data:
  transition: 180
  brightness_step_pct: 10
  kelvin: >
    state_attr('light.master_bedroom', 'max_color_temp_kelvin') -
    ((((state_attr('light.master_bedroom', 'max_color_temp_kelvin') -
    state_attr('light.master_bedroom', 'min_color_temp_kelvin'))/10) *
    {{repeat.index}}))
target:
  entity_id: light.master_bedroom
  • 180 seconds ten times, or half an hour in total
  • Brightness should step 10% each time, so 100% in ten iterations
  • Kelvin value should go from max color temp to min color temp in ten blocks.

This doesn't seem to work. The error is: expected int for dictionary value @ data['kelvin']. Got None

fierce pawn
#

#1284966664357810196 can help with templates, but your template is missing the opening and closing {{ πŸ˜‰

remote anchor
#

I thought so, but if I had those, the automation won't even save. I'll move to templates, thank you!