Homey Community Forum

Detect changing zone

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.

Possibly through the zone.update event in the Web API. I don’t think there’s anything in the Apps SDK available.

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.

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

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!