# Gateway events - how to disable in code

**URL:** <https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511>\
**Category:** Ignition\
**Created:** [February 7, 2023, 2:17am UTC](https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511 "2023-02-07T02:17:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [February 7, 2023, 2:17am UTC](https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511/1 "2023-02-07T02:17:18Z")

</div>

hi all  
I have ignition gateway reading tags from kepware with over 20 plcs and a lot of gateway events triggered on tags. I wonder what is the most robust way of checking if the tag is available to read in case some plcs are off? Kepware system tag indicating connection takes a few seconds to time out so its very slow. Also there seem to be no way to disable gateway event in case plc is off so some code inside gateway event has to execute - is it right?  
regards

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 7, 2023, 4:24am UTC](https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511/2 "2023-02-07T04:24:08Z")

</div>

Yes, you cannot disable a tag's events unless you disable the tag itself. But any such event can read a boolean memory tag and only run the rest of the event code based on its value. Or some such setup.

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [February 7, 2023, 7:16am UTC](https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511/4 "2023-02-07T07:16:20Z")

</div>

Hi Phil did you mean tag or gateway event?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 7, 2023, 11:32am UTC](https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511/5 "2023-02-07T11:32:21Z")

</div>

Some things that come to mind:

- Use a heartbeat, check how long sincle last change.
- Check the quality of the tag you're triggering from.
- Shorten the timeout on the Kepware system.

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [February 7, 2023, 11:44am UTC](https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511/6 "2023-02-07T11:44:23Z")

</div>

just reminded myself that gateway trigger can use quality change as a trigger so if tag quality is different than 192 the data is not reliable. in the gateway tag change script i could check the code before doing anything. The problem is if there are 20 plcs and some of them stop talking it might choke the driver which will stop processing altogether - i saw it happening.  
Just wondering how to deal with this scenario? Maybe if connection fails then the script should disable whole kepware device to prevent driver from choking but then how to i enable it again? maybe i should keep checking just 1 tag from each plc when there was communication fault...

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 7, 2023, 11:50am UTC](https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511/7 "2023-02-07T11:50:51Z")

</div>

Use auto-demotion on the devices in Kepware. Page 8.

> **[Optimizing-KEPServerEX-V6-Projects\_1002.pdf](https://www.kepware.com/getattachment/eb555653-d9d2-4e1a-a4d2-b50e27d0fa3e/Optimizing-KEPServerEX-V6-Projects_1002.pdf)**
>
> 300.81 KB

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [February 7, 2023, 12:37pm UTC](https://forum.inductiveautomation.com/t/gateway-events-how-to-disable-in-code/69511/8 "2023-02-07T12:37:38Z")

</div>

fantastic idea about demotion - just reading more about it.

Also probably using 20 channels with 1 PLC device inside will be better than 1 channel with 20 devices because in my understanding these channels are separate and 1 cannot block the other which faulty device can derail the whole channel.
