Dynamically update brightness

This used to work but recently has stopped:

  testscript:
    alias: 'Test Script'
    sequence:
      - service: light.turn_on
        data_template:
          entity_id: "{{ 'light.'~lightname }}"
          brightness: '{{ states.light[lightname].attributes.brightness + 3 }}'
      - service: notify.notify
        data_template:
          message: "Test Fired - {{ 'light.'~lightname }} is currently {{ states.light[lightname].attributes.brightness }}"

The notification fires properly but the brightness adjustment does not work.

possible cast the attribute to an int before adding 3, | int

Still no luck.