Universal Adaptive Lightning toggle script

Hello, first of all first post here since I could not find the solution anywhere this time. Mind you I am without computer for the moment so I do everything by phone so it is possible I overlooked something.

To start with, I’m using the Adaptive Lighting (AL) integration and somehow it broke upgrading to 2024.9.1 due it not intercepting the light_on command anymore hence every light automation now needs to be changed so it calls the service. To keeps things a bit more tidy I thought why won’t I try make an universal script that runs AL when called, hence it needs some templating so it fits different lights. This is my first try at this so please be nice, I’ve been fiddling for a few days now without succes (I think I am pretty close tho)

What I come up with so far:

The Universal script

toggle_adaptive_light
alias: Toggle Adaptive Lighting (Universal)
description: Toggle light state and apply adaptive lighting if turning on.
fields:
  light_entity:
    description: The entity_id of the light
    example: light.woonkamer
sequence:
  - variables:
      current_state: "{{ states(light_entity) }}"
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ current_state.state == 'on' }}"
        sequence:
          - target:
              entity_id: "{{ light_entity }}"
            action: light.turn_off
      - conditions:
          - condition: template
            value_template: "{{ current_state.state == 'off' }}"
        sequence:
          - action: adaptive_lighting.apply
            data:
              turn_on_lights: true
              adapt_color: true
              adapt_brightness: true
              lights:
                - "{{ light_entity }}"

The button for the light will have the following info

tap_action:
          action: call-service
          service: script.toggle_adaptive_light
          service_data:
            light_entity: light.xxx

Appreciate the help, it is starting to drive me crazy!