# Alert When Device Loses connection

**URL:** <https://forum.inductiveautomation.com/t/alert-when-device-loses-connection/3266>\
**Category:** Ignition\
**Created:** [September 8, 2011, 5:23pm UTC](https://forum.inductiveautomation.com/t/alert-when-device-loses-connection/3266 "2011-09-08T17:23:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [September 8, 2011, 5:23pm UTC](https://forum.inductiveautomation.com/t/alert-when-device-loses-connection/3266/1 "2011-09-08T17:23:18Z")

</div>

What is the best way to setup an alert to be emailed out when a device loses connection?

Also what is the best way for an alert to emailed out when the gateway goes down? I have redundancy setup and would want to know when the master goes down and/or the backup goes down.

Thank you,

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [September 8, 2011, 6:55pm UTC](https://forum.inductiveautomation.com/t/alert-when-device-loses-connection/3266/2 "2011-09-08T18:55:03Z")

</div>

We’re working on new gateway side status tags (that can be alerted and historized) for 7.3. Unfortunately, until then your options are a bit limited.

For detecting that the device is down, your best bet is to alert on the quality of a tag from each processor. Create an Expression tag, whose expression is simply a reference to the “.Quality” property of another tag. Create an alert on it, and alert when != 192 (the “good quality” value).

For redundancy, unfortunately I’m not sure there’s much you can do right now. There is a scripting function for getting the current host ip, perhaps you could use this (though an expression and runScript()) to log to the database with a transaction group… and then work up something that watches that and alerts when the last entry wasn’t from the normal master. A bit crazy, I know, but like I said, we’re working on it.

Regards,

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [September 16, 2011, 3:51pm UTC](https://forum.inductiveautomation.com/t/alert-when-device-loses-connection/3266/3 "2011-09-16T15:51:40Z")

</div>

So I am trying to setup an alert on the quality code of a tag as mentioned. I setup the expression “if({[.]Status.Quality}=192,0,1)” on a run always tag with a tag name of “801QualityAlert”. I placed a dead band of 10 minutes on the digital alert. I then set a group to be alerted on {[ITEM\_PATH]} LIKE “%QualityAlert%”. To test I disabled the device on the gateway and then waited 10 minutes. I received an email for the alert. I then enabled the device on the gateway. I waiting all night and have not received a cleared message. The run always expression is still set to true when it should be false. What am I missing?

Thank you,

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/243cfa0198a1bfc40a7ad7d030fbb9eb300b660c.JPG)

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [September 16, 2011, 4:03pm UTC](https://forum.inductiveautomation.com/t/alert-when-device-loses-connection/3266/4 "2011-09-16T16:03:03Z")

</div>

I usually just setup a dbtag that has the expression in it, then do the alerting off of that dbtag. not sure if that is the best way but it works well for me.
