Get device comms state

Good morning, guys! First post here.

I'm using Siemens OPC-UA driver with a S7-1200 PLC. I need to get the device state and comms state with that device.

I was able to get the device state using OPC-UA properties.

Regarding comms state, I was able to ping the device using a script, but I want to have a tag with that state, but tags do not allow scripts, only expressions.

Any ideas how to get that?

Best regards,
Francisco Rebelo

If you already have a script written out you can setup an expression tag then use the runScript function:

Make sure to read the note relating to the poll rate because it does not work the same as an expression binding.