Problem how to set random color temp

I wonder how to set random color temp for my Tradfri lights. I have tried the following automation but since I’m new I don’t get the templates / converting to work. Obviously it’s the last line in the automation which is wrong but I don’t know how to make the converting to an int.

- alias: 'Random color temp'
  trigger:
    platform: time
    seconds: '/1'
  action:
    service: input_slider.select_value
    data_template:
      entity_id: input_slider.random_color_temp
      value: '{{ (range(40, 600)|random) }}'

- alias: 'Disco in Sofa'
  trigger:
    platform: time
    seconds: '/3'
  action:
    service: light.turn_on
    data:
      entity_id: light.sofa
      brightness_pct: 100
      color_temp: {{ states('input_slider.random_color_temp') }}

Solved it myself with a much more elegant and simple solution:

- alias: 'Disco in kitchen'
  trigger:
    platform: time
    seconds: '/1'
  action:
    service: light.turn_on
    data_template:
      entity_id: light.kitchen_table
      brightness_pct: '{{ range(20, 101) | random }}'
      color_temp: '{{ range(40, 600) | random }}'