# Programmatically Reset/Refresh a Device Connection

**URL:** <https://forum.inductiveautomation.com/t/programmatically-reset-refresh-a-device-connection/7508>\
**Category:** Ignition\
**Created:** [November 1, 2013, 6:05am UTC](https://forum.inductiveautomation.com/t/programmatically-reset-refresh-a-device-connection/7508 "2013-11-01T06:05:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [November 1, 2013, 6:05am UTC](https://forum.inductiveautomation.com/t/programmatically-reset-refresh-a-device-connection/7508/1 "2013-11-01T06:05:41Z")

</div>

I currently have an issue with one of the devices that Ignition is connected to. It is a Shark Power Meter. The communication is through the TCP Module. Every now and then the connection to this meter goes stale causing all the tags to have a Bad quality. To fix this I go into the Gateway Configuration page and disable then re-enable the connection to this device. Once I do this it works fine (usually for months). I have set up a text alert that goes out to myself when this connection goes stale, but I would like to take it one step further. I would like to be able to have a Gateway Script that will automatically reset the connection to this device. Is this possible? If not, would it be possible for a feature request? A lot of times when this connection goes stale it is during inopportune times where I can’t get to a computer immediately to reset it and this results in a loss of data. Appreciate any feedback.

Thanks,  
-Will

---

<div class="post-metadata">

**Author:** ![aidamcg](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@aidamcg](https://forum.inductiveautomation.com/u/aidamcg)\
**Post date:** [November 1, 2013, 7:31am UTC](https://forum.inductiveautomation.com/t/programmatically-reset-refresh-a-device-connection/7508/2 "2013-11-01T07:31:10Z")

</div>

Hi

I use the IA Labs scripting module to show all devices on a screen and have the ability to enable/disable them from this screen. It may be able to do what you want. The one you will need is

> [@](#):
>
> system.device.setDeviceEnabled(String dsName, Boolean enabled)

Aidan
