How to get a devices zone name

Hi.

Sorry for asking a simple question - I have started developing in Homeyscript (I usually develop in C# or PHP).

I wat to do a Danfoss Ally <-> DeCONZ thing, and for that I need to get the zone name of a device. I easy get the zone-id of the device, but I can’t find a way to look up the zone name via the ID.

I can’t find anyting in the documentation regarding that. In my test loop I can get zone name in one loop and zone id in another. Isn’t there an easier way?

// Get all devices

const devices = await Homey.devices.getDevices();

const zones = await Homey.zones.getZones();

for (const zone of Object.values(zones))

{

log(\nZone '${zone.name}');
log(\nZone '${zone.id}');

}

for (const device of Object.values(devices)) {
if (device.class === ‘thermostat’) {
log(\nZone '${device.zone}');
log(\nZone '${Homey.zones.getZone(device.zone)}');
}

}

OK.

I found : device.zoneName

Why isn’t this in the documentation or part of the intellisense.

1 Like