# Get device comms state

**URL:** <https://forum.inductiveautomation.com/t/get-device-comms-state/97723>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [October 24, 2024, 11:42am UTC](https://forum.inductiveautomation.com/t/get-device-comms-state/97723 "2024-10-24T11:42:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francisco\_Rebelo](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@Francisco\_Rebelo](https://forum.inductiveautomation.com/u/Francisco_Rebelo)\
**Post date:** [October 24, 2024, 11:42am UTC](https://forum.inductiveautomation.com/t/get-device-comms-state/97723/1 "2024-10-24T11:42:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Noah\_Casey](https://avatars.discourse-cdn.com/v4/letter/n/e480ec/32.png) [@Noah\_Casey](https://forum.inductiveautomation.com/u/Noah_Casey)\
**Post date:** [October 24, 2024, 12:05pm UTC](https://forum.inductiveautomation.com/t/get-device-comms-state/97723/2 "2024-10-24T12:05:16Z")

</div>

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

> **[runScript | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/advanced/runScript?gad_source=1&gclid=Cj0KCQjw4Oe4BhCcARIsADQ0cskImFeS69IkOdLHqAoc3NxgxizxlxndKSTKI7dgASOmGBY26pnFrCkaAmPGEALw_wcB#calling-runscript-in-tags)**
>
> Runs a single line of Python code as an expression.

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