Looking for help with Template lights configuration - colour temperature and brightness

I’ve just setup another template light to go with my existing lights and despite spending a few hours trying to figure things out I’ve failed to understand how to configure the colour temperature and brightness so that I can control them from a mushroom light card.

At the moment I’ve had to add some separate buttons to control each of these elements, 1 that iterates through the (3) available colour temperatures and 2 buttons to increase / decrease brightness. I’d prefer to replace these buttons with the built-in card sliders if feasible.

Configuration:
My templated lights are all controlled via Broadlink remotes - this is the core configuration that I have working correctly (my attempts at adding colour temp and brightness control have been removed).

      dining_room_light:
        friendly_name: "Dining Room Light"
        value_template: "{{ states('input_boolean.dining_room_light_power') }}"
        supports_transition_template: "{{ false }}"
        turn_on:
          - service: script.dining_room_light_on
        turn_off:
          - service: script.dining_room_light_off 

Despite reading and re-reading the integration docs I’m not understanding how the card controls work.

For example, the dining room light has 8 brightness levels, which I believe need to be represented via an input_number for the template (to keep the brightness level tracked).

How then can I ensure that adjusting card’s brightness slider then triggers the appropriate script to adjust the light brightness, which for my light would need to be in increments of + / - 1 depending on the last brightness level?

My issue with colour temperature is similar - what holds the last colour temp before the adjustment, and what defines the new value?

Any pointers from someone who has a similar setup (or a better understanding of the light templating than me) would be much appreciated,

Please share the “light_on” script, as it might help explain how your lights function more generally and help us answer question like:

As, shown in the documentation you linked, color temperature will need its own Input Number helper to store its value. The Template Light configuration is kind of like a stack of very compact automations. When you use the color temp slider on a card in the frontend, that value is temporarily stored in a variable color_temp which is processed through the service you define for the set_temperature: portion of the Template Light configuration. Normally, this service sequence will just set the value of your helper, but it can perform other services if necessary.

If your light’s brightness and/or color temp can’t be controlled via the turn-on script, you would add the specific script to control those attributes under set_level and set_temperature configuration keys.

dining_room_light_on:
  mode: single
  max_exceeded: silent
  sequence:
    - service: remote.send_command
      target:
        entity_id: remote.dining_room
      data:
        device: light
        command: "Turn on"
    - service: input_boolean.turn_on
      target:
        entity_id: input_boolean.dining_room_light_power

Ah so I think that’s the bit that was confusing me, thank you.
The light has a built in memory for the last used brightness & colour temp so it returns to the last set values when turned on.

I’m only looking for the ability to use the card controls to change brightness and colour temp when the light is on (rather than turning it on at a particular colour temp / brightness level).

Thanks for the pointers @Didgeridrew
I’ve managed to get 1 of 3 working as I wanted and should be able to apply the same approach to the remaining 2.
It was the temporary variables I wasn’t grasping (not helped by the UK / US spelling divide for color_temp :grinning_face_with_smiling_eyes: