Light / brightness entity

I have a template for one of my light entites.
The code below is working fine:

    bediening_licht_badkamer:
      friendly_name: "Licht badkamer"
      level_template: "{{ ((states('sensor.brightness_licht_badkamer')|int)-126)*2 }}"
      value_template: "{{ ((states('sensor.brightness_licht_badkamer')|int)-126)*2 > 1}}"
          
      turn_on:
        service: ads.write_data_by_name
        data:
          adsvar: gvlHomeAssistant.bBedLichtBadkamer
          adstype: byte
          value: 1
      turn_off:
        service: ads.write_data_by_name
        data:
          adsvar: gvlHomeAssistant.bBedLichtBadkamer
          adstype: byte
          value: 0
      set_level:
        service: python_script.adswriteint
        data_template:
          ads_variablename: gvlHomeAssistant.iDimLichtBadkamer
          ads_value: "{{ brightness }}"

Problem is that the set_level needs to send the brightness level, multiplied by 128.
When I use

ads_value: "{{ brightness|int * 128 }}"

It just sends 128 instead of the multiplied value.
What am I missing here ?

Solved it: The problem was the python script only sending byte, but the multiplication of the brightness level needed integer.