# Detect changing zone

**URL:** <https://community.homey.app/t/detect-changing-zone/31996>\
**Category:** Developers\
**Created:** [July 3, 2020, 12:49pm UTC](https://community.homey.app/t/detect-changing-zone/31996 "2020-07-03T12:49:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![henit](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henit/32/27054_2.png) [@henit](https://community.homey.app/u/henit)\
**Post date:** [July 3, 2020, 12:49pm UTC](https://community.homey.app/t/detect-changing-zone/31996/1 "2020-07-03T12:49:16Z")

</div>

In the Device SDK, there is methods for detecting things like `onAdded` and `onRemoved`. But is there any way to detect that the device has been moved to another zone? I tried the `onSettings` method, but it is not called when changing zone in a paired device.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [July 3, 2020, 1:12pm UTC](https://community.homey.app/t/detect-changing-zone/31996/2 "2020-07-03T13:12:03Z")

</div>

_Possibly_ through the [`zone.update` event](https://developer.athom.com/docs/api/HomeyAPI.ManagerZones.html#.event:%2522zone.update%2522) in the Web API. I don’t think there’s anything in the Apps SDK available.

---

<div class="post-metadata">

**Author:** ![henit](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henit/32/27054_2.png) [@henit](https://community.homey.app/u/henit)\
**Post date:** [July 3, 2020, 1:35pm UTC](https://community.homey.app/t/detect-changing-zone/31996/3 "2020-07-03T13:35:31Z")

</div>

Do you have an example of an app on github or somewhere else using events from the Web API? I am wondering a bit on how to manage the manager context and such.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [July 3, 2020, 1:48pm UTC](https://community.homey.app/t/detect-changing-zone/31996/4 "2020-07-03T13:48:33Z")

</div>

Homeykit subscribes to `device.update` events: [https://github.com/swttt/com.swttt.homekit/blob/233af11a0ff81638076157f7b76c9c32dae755ea/app.js#L92](https://github.com/swttt/com.swttt.homekit/blob/233af11a0ff81638076157f7b76c9c32dae755ea/app.js#L92)

---

<div class="post-metadata">

**Author:** ![henit](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henit/32/27054_2.png) [@henit](https://community.homey.app/u/henit)\
**Post date:** [July 3, 2020, 2:17pm UTC](https://community.homey.app/t/detect-changing-zone/31996/5 "2020-07-03T14:17:01Z")

</div>

Ah, I was afraid I had to instanciate a manager object and wanted to avoid mem leaks. This worked, and it was emitted when zone was changed.

Thank you very much!
