Home Assistant ADS problem

I have a problem reading data from global variables on a Beckhoff PLC controller twincat3. I am trying to read data using HomeAssistant using the ADS protocol. I have spent over 20 hours with my colleague to find the problem, but we still do not know what the cause may be. The problem is that after a correct connection to HomeAssistant, some of the variables are not available (message Error subscribing to GVL.z6: ADSError: timeout elapsed (1861).). Interestingly, on the 6 variables that I try to read, after each restart others are not available. For example, during the first start, the variables Z1 and Z4 are visible, while the other Z2, Z3, Z5, Z6 are no longer available. Then after restarting (without changing anything at all!) It turns out that only variables Z1, Z3, Z4 are available. The program works completely randomly each time, each run causes other variables to have a “timeout” message. Most strange thing is that, after force call service unavaible variable from developer tools i can see in the PLC state is changed, but variable on the list is still unavaible (looks like write only, imposible to read). We tried the following things: work on different drivers, work on twincat2 and 3, different versions of homeassistant, different versions of ip and ams configuration, turn off the firewall, read different variables (Q, I, M), set the “route” in two directions. Do you have any suggest how to solve this problem?

To whom it may concern:

The ADS integration relies on the pyADS package.
When HA is installed as a Docker container, or as a Standalone linux, the pyADS pyads package needs to be installed manually. Only the HASSIO OS contains this package by default.

Installation instructions can be found here: