Dimmable light template on/of state issue

I have a dimmable light template that has an issue with it’s on/off state.
When I press the ‘on/off’ button at the state card when the light is off, it functions normally.
It turns the light on, and the brightness slider increases. Same thing when I press again to turn off.
However, when I first set the brightness with the slider, the bulb turns on. When I press the on/off button nothing happens. It seems that the “value_template” isn’t evaluated in this case.

My code:

    bediening_licht_keukentafel:
      unique_id: licht_keukentafel
      friendly_name: "Licht keukentafel"
      level_template: >
        {{ states('sensor.brightness_licht_keukentafel') }}
      value_template: >
        {% if states('sensor.brightness_licht_keukentafel_raw')|int > 1 %}
          True
        {% else %}
          False
        {% endif %}
          
      turn_on:
        service: ads_custom.write_data_by_name
        data:
          adsvar: gvlHomeAssistant.bBedLichtKeukentafel
          adstype: byte
          value: 1
      turn_off:
        service: ads_custom.write_data_by_name
        data:
          adsvar: gvlHomeAssistant.bBedLichtKeukentafel
          adstype: byte
          value: 0
      set_level:
        service: ads_custom.write_data_by_name
        data_template:
          adsvar: gvlHomeAssistant.btDimLichtKeukentafel
          adstype: byte
          value: >
            {% set state = brightness | int / 2.55 %}
            {% if state > 1 %}
              {{ (log(state * 10, 10)*(253/3)+1) | round(0) }}
            {% else %}
              0
            {% endif %}

I tried several things for the value_template like changing True / False, to on/off, or to evaluate it without if-then statement.

"{{ states('sensor.brightness_licht_keukentafel_raw')|int > 1}}"

Am I missing something?

I found the issue:
It seems that when turned off, the brightness level isn’t adjusted. It remains at the set level.
Adding an extra service in the turn_off section, forcing the brightness to ‘0’ resolved the issue.