# \[SDK3\] Listing devices on settings page

**URL:** <https://community.homey.app/t/sdk3-listing-devices-on-settings-page/59623>\
**Category:** Developers\
**Created:** [February 2, 2022, 4:37pm UTC](https://community.homey.app/t/sdk3-listing-devices-on-settings-page/59623 "2022-02-02T16:37:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maikel](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/maikel/32/12410_2.png) [@Maikel](https://community.homey.app/u/Maikel)\
**Post date:** [February 2, 2022, 4:37pm UTC](https://community.homey.app/t/sdk3-listing-devices-on-settings-page/59623/1 "2022-02-02T16:37:22Z")

</div>

I am developing a custom app and currently I’m working on the settings page. The settings page needs to show a list of all devices for the current app.  
The settings page makes a call to retrieve the list:

```auto
Homey.api("GET", "/devices", async (error, result) => {
	if (error) return Homey.alert(error);
	Homey.confirm(JSON.stringify(result));
	...
}

```

The api.js contains a mapped method called ‘listDevices’:

```auto
const util = require('util')

module.exports = {
	async listDevices({homey, query}) {
		console.log("API - List Devices");
		console.log(`ID: ${homey.app.id}`);
		
		const driver = await homey.drivers.getDriver("<my driver id>");
		let devices = await driver.getDevices();
		console.log(`Device: ${util.inspect(devices)}`);
		return devices;
	}
};

```

Unfortunately, this doesn’t seem to work. The log in api.js does show a list of devices, but the confirm-dialog only shows an id.  
I also tried moving the retrieving of the devices to my app.js, but that didn’t make a difference. I also tried retrieving the device by the ID:

```auto
let deviceIds = driver.getDevices();
let devices = [];
for (let deviceId in deviceIds) {
	devices.push(driver.getDevice(deviceId));
}

```

But that results in an error: invalid\_device\_by\_data.

I tried learning from other apps I found on Github. Some of those apps use ‘athom-api’, but that looks like a workaround to me.

What am I doing wrong here? I wouldn’t expect the retrieval of a list of devices for a driver to be this difficult.

---

<div class="post-metadata">

**Author:** ![Maikel](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/maikel/32/12410_2.png) [@Maikel](https://community.homey.app/u/Maikel)\
**Post date:** [February 2, 2022, 5:21pm UTC](https://community.homey.app/t/sdk3-listing-devices-on-settings-page/59623/2 "2022-02-02T17:21:09Z")

</div>

After I found a different topic about debugging here, I did some debugging from VSCode (instead of adding more logging) and found out I just had to map the devices list to a list of IDs and names.  
I guess that would work for the settings page.
