Beckhoff Twincat 3 ADS

Hi,

I’m new to home assistant and am trying to link it up with my beckhoff controller through the ADS integration.
I added the code to my configuration.yaml and can use the ads.write_data_by_name service.
I’ve added a route in my controller to HA.
So now I’m trying to write a value into a global var but I think I’m using adsvar wrong?

I have several GVL’s, global variable lists , I made one to test called HA with an integer variable test.
I’ve been trying with these settings and some variations but can’t seem to write data:

adsvar: GBL.HA.test
adstype: int
value: 123

I get this error:
Error writing GBL.HA.test: ADSError: Unknown Error (-1).

Any help would be greatly appreciated.

Is it in twincat 2 or 3?