Creating an Beckhoff ADS Connection

I am pretty new to HA. I would like to make an ads connection (Beckhoff v2) to a remote CX1000. With laptop it is approachable.

  1. I’ve modified the configuration.yaml but it keeps not giving a connection? #############################################################

BECKHOFF (V2)

#############################################################
ads:
device: “5.0.113.102.1.1” #AMS NetId Beckhoff CX1000
ip_address: 192.168.2.12 #IP Address Beckhoff CX1000
port: 801 #TwinCAT v2 used

Example configuration.yaml entry

sensor:

  • platform: ads
    adsvar: ‘Unit_00._00QT03.iwDataIN_L2’
    unit_of_measurement: “kW”
    adstype: int
    name: ‘Power’
  1. When I want to install pyads in the terminal I get:
    pip install pyads => bash: command not found

  2. I want to try to add the route in the route table but this also does not give the right results

  • add static (target) and static (remote route)
  • Route Name: HomeAssistant?
  • AmsnetID: Must i use IP address of PLC or HA (with .1.1)?
  • IP Address: Must i use IP address of PLC or HA?

I am running out of options

regards

Make sure your formatting and indenting is correct:

ads:
  device: “5.0.113.102.1.1” #AMS NetId Beckhoff CX1000
  ip_address: "192.168.2.12" #IP Address Beckhoff CX1000
  port: 801 #TwinCAT v2 used

Try this:

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.

Careful: because you copied the unformatted text from above, you’ve pulled in some of the “smart quotes”. Fixed:

ads:
  device: "5.0.113.102.1.1"
  ip_address: "192.168.2.12"
  port: 801
platform: ads
  adsvar: .Unit_00._00QT03.iwDataIN_L2
  unit_of_measurement: "kW"
  adstype: int
  name: 'Power'

@Hommelte — that’s why is it so important to correctly format you code for the forum. The quickest and easiest way to do that is to surround it with three backticks like this:

```
CODE GOES HERE
```

which becomes:

CODE GOES HERE

That preserves spacing, indentation, quote characters etc.

@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!

Look very carefully at the quotes around the kW in the unit_of_measurement lines in @zimbrich’s post and mine:

unit_of_measurement: “kW”
unit_of_measurement: "kW"

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.