I am trying out coding an app for Homey, and I have an operational device. Now when I have the device running in a given zone, I want to go through the other devices in the same zone.
I have been able to fetch a list of all devices from the api (homey-api module) using
api.devices.getDevices(). But I found no data on the device class about the active zone (such as
this.zone). So I thought I would need to fetch the device-object from the API so I can read the zone id and find what devices is in the same zone. However, to fetch a device (api.devices.getDevice()), I require the ID of the active device. It is not available on
this.id, there is no
getId() function (similar to
getName etc) and the only id I can find is
this.getData().id which is not the same ID as the device id, but the one that I gave it when it was paired.
How can I get the active device/zone inside the device code?