platform: ads
adsvar: .Unit_00._00QT03.iwDataIN_L2
unit_of_measurement: “kW”
adstype: int
name: ‘Power’
Make sure you intent correctly, add a [period] before the adsvar name [assuming it is a global variable, if not put the POU name first e.g. MAIN.Unit_00.QT03.iwDataIN_L2] and remove the [single quotes] from adsvar name.
ADS was broken last summer but it might be fixed now. Let me know if this helps.
@Troon thanks for the feedback. When you say “smart quotes”, are you referring to the comments (e.g.#AMS NetId Beckhoff CX1000)?
I have never tried commenting in the same line after the actual code but I assumed that it worked. Are you saying that commenting in that way will not work? That is really good to know for future reference. Thanks!
See the difference? The forum has changed the straight quotes into 66-99 style quotes because you didn’t format your original post as code. @zimbrich then copy-pasted those and then formatted as code, but the damage had been done by then.
The smart 66-99 quotes won’t work in templates or YAML config.
Hello,
I would like to join you here.
I have exactly the same problem and am stuck in the same place. I have defined the route in the Beckhoff controller. But how does Home Assistant know which NetID it has itself and which NetID the remote station (TwinCat) has?
Hopefully someone here can explain the configuration (where and how) of Home Assistant/pyADS and post it???
Thank you very much
Best regards
Maybe this will help you: (I use twincat 3 and didn’t get it working either)
Twincat 2 uses the 801 port and twincat 3 uses the 851
on the plc side you should add the route as well.
IP address of home-assistant for example 192.168.1.44. AmsNetId is then 192.168.1.44.1.1 (so you add .1.1 after the ip address of home-assistant)
Sorry for replying to an old topic, but I have the same question, I have a Beckhoff PLC with TwinCat 2 software, which is configured using the “TwinCat PLC control” software running on the PLC itself.
I previously used MQTT as an interface between Beckhoff and HA, but the implementation of MQTT in TwinCat2 is poorly written and buggy, which is why I would like to use ADS…
[EDIT]:
I have now configured the ADS protocol by adding an ADS Route in the TwinCat System Manger (NetID of HA was 192.168.0.177.1.1, based on the IP of my HA), this brought the network interface of the PLC down but after restarting, I only had read access to the PLC variables and could not write any of them.
How can I configure the PLC to allow write access?