Get list of all connected devices to homey hub

Hello everyone,

I’'m new into the Homey community and wanted to create a little plugin to get by lights behaving has i wanted.
I started at first with a little script, where i can use 2 calls to retrieve the list of zones and the list of all the devices connected to my hub

const devices = Object.values(await Homey.devices.getDevices());
const zones = Object.values(await Homey.zones.getZones());

All is working fine with that script so i was happy and wanted to switch to a little plugin of my own to make things a bit more clean.

But, when i’m in my “app.ts” i don’t find anyway to get all the devices connected to the hub. Only the devices created (inside of the drivers folder) inside of the plugin, and that i don’t want. I would like to be able to just fetch all the devices connected to the hub simply, and be able to , for exemple to a

device.setCapabilityValue("onoff", false);

Is there any way to get the list of all the devices connected to the hub inside of the plugin, and not just the devices managed by the plugin itself ?

you need the WebAPI from within the App if you want to do things out of your own app.

The Web API is also used by HomeyScript and apps using the homey:manager:api permission. Learn more »

1 Like

Taking the risk to look full noob here, but when i try to use the AthomCloudAPI (from : https://api.developer.homey.app/) it seems that the app crash because it cannot find the dependency.

image

For now i just wanted to have the simple devices list as in the exemple, but it crash instanly…
Here is the little code snipped i have currently (the same of the one of the doc)

Any idea on what i’m missing there ?