Light attribute did not changed while automation did get triggered, why?

What I am trying to do is to change the color temperature (the kelvins) of a light as soon as it is switched on. I can see that the below automation gets triggered when the lamp switches on. The template does also work however the color temperature does not change. Any idea why?

  trigger:
  - platform: state
    entity_id: light.eetkamer
    from: 'off'
    to: 'on'
  action:
  - service: light.turn_on
    data:
      entity_id: light.eetkamer
      data_template:
        kelvin: >
          {% if now().hour >= 0 and now().hour < 6 %}
          2200
          {% elif now().hour >= 6 and now().hour < 9 %}
          4000
          {% elif now().hour >= 9 and now().hour < 12  %}
          3200
          {% elif now().hour >= 12 and now().hour < 16  %}
          3000
          {% elif now().hour >= 16 and now().hour < 17  %}
          2500
          {% elif now().hour >= 17 and now().hour < 18  %}
          2400
          {% elif now().hour >= 18 and now().hour < 19  %}
          2300
          {% else %}
          2200
          {% endif %}

Yes I know flux does exists, however that does not work for me, as when flux is running, I cannot reliable switch off the lights any more, which is another issue.

I don’t think you can have data: and data_template: on the same service
try this:

  trigger:
    - platform: state
      entity_id: light.eetkamer
      from: 'off'
      to: 'on'
  action:
    - service: light.turn_on
      data_template :
        entity_id: light.eetkamer
        kelvin: >
            {% if now().hour >= 0 and now().hour < 6 %}
            2200
            {% elif now().hour >= 6 and now().hour < 9 %}
            4000
            {% elif now().hour >= 9 and now().hour < 12  %}
            3200
            {% elif now().hour >= 12 and now().hour < 16  %}
            3000
            {% elif now().hour >= 16 and now().hour < 17  %}
            2500
            {% elif now().hour >= 17 and now().hour < 18  %}
            2400
            {% elif now().hour >= 18 and now().hour < 19  %}
            2300
            {% else %}
            2200
            {% endif %}

yes of course! thanks! It is working now