# Abstract Tag Driver - how to known a device is disabled?

**URL:** <https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816>\
**Category:** Module Development\
**Created:** [April 24, 2018, 3:42pm UTC](https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816 "2018-04-24T15:42:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [April 24, 2018, 3:42pm UTC](https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816/1 "2018-04-24T15:42:39Z")

</div>

Hi,  
I try to stop some task inside an abstract Tag driver when the device is disabled.  
But I don’t find how to obtainthis information with the driver context ?

---

<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:** [April 24, 2018, 3:54pm UTC](https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816/2 "2018-04-24T15:54:20Z")

</div>

Your device driver’s shutdown() method will be called.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [April 24, 2018, 4:00pm UTC](https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816/3 "2018-04-24T16:00:56Z")

</div>

Thanks @pturmel,  
But when I restart the module, the shutdown method of the device is restarted too.  
@Kevin.Herron, the enable/disabled state of the device is not available anywhere ?

---

<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:** [April 24, 2018, 4:07pm UTC](https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816/4 "2018-04-24T16:07:43Z")

</div>

Your driver instance is “started” when your DriverType creates it. Your driver instance is told to shutdown via the shutdown method, and will be garbage collected when all of your own references are deleted. Any given instance will not be restarted. This sequence happens for any event that starts and stops your device, including module restart.  
If your module is creating objects with their own lifetimes that interact with your devices, you must implement a flag in your driver to remember that it is shut down, and supply that to interested code with an isShutdown() method. Or something like that. Perhaps you should manage a static list of your own driver instances.

---

<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:** [April 24, 2018, 4:12pm UTC](https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816/5 "2018-04-24T16:12:56Z")

</div>

Remember that your module hook has its own shutdown() method. That is separate from the driver instance shutdown. I believe it happens after all enabled devices in your module are shutdown.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 24, 2018, 4:22pm UTC](https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816/6 "2018-04-24T16:22:13Z")

</div>

Phil’s right, there’s no difference between being disabled and being shutdown, or being removed, other than when you get disabled/removed you aren’t subsequently started back up…

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [April 24, 2018, 5:27pm UTC](https://forum.inductiveautomation.com/t/abstract-tag-driver-how-to-known-a-device-is-disabled/17816/7 "2018-04-24T17:27:03Z")

</div>

Ok I see, thanks a lot @pturmel and @Kevin.Herron for those clarifications. 😌
