Listing all devices installed across multiple hubs

I have 6 hubs in my environment at the moment and I am a heavy user of hubmesh. I find myself doing the same tedious task over and over again though when I'm removing hubmeshed devices and that is browsing to every hub's device list and searching for the device to see if it is in use on that hub.

Example using LightA as the device to be removed:

  • Checking LightA's device page on the hub it is installed on and check "in use by" and I find that "Hub mesh" is using the device. (There is no indication from here as to what other hubs are using the device.)
  • Browse to the next hub's device page, do a search to see if LightA is installed here (and if so perform required steps to remove LightA from apps and then remove it from hub).
  • Repeat above step for every hub in the environment.
  • Back to the first hub, turn off hub mesh sharing for LightA and then remove the device from the hub

What I would like to be able to do is to use a PowerShell script to search for a device by name across the installed devices of all hubs. I would have to be able to somehow get a device list from each hub first though that I could search through. Is there such an endpoint available? Worst case scenario, I can screen scrape the device list, but I'd rather it didn't get to that :wink:

Alternatively, is there a way to do this creating a Groovy app that could periodically spit out a list of all installed devices on that hub to a csv file in file manager? I've never written any apps, so it will be a learning curve for me, but I have written some drivers.

Edit: Or even better would be if the hub would be able to list what other hubs are using the device and show that in the In Use By list. For example:

In use by:
Room Lighting
Hub mesh
Hub mesh - HE hub Upstairs
Hub mesh - HE hub Garage

There are a few that might be useful...
Device lists:

/hub2/devicesList
/device/listJson?capability=capability.*

Data for one device:
/device/fullJson/$deviceId

3 Likes

:slight_smile: Thank you! I’ll give it a go later on tonight

1 Like

Thank you! I tested these last night and I believe they are exactly what I need for creating my search tool. I'm starting to think that I can also use them to create a map of all devices across all hubs to map out what devices are hub meshed to where and what apps and automations each device are used by.

Using this url returns 'not found'

192.168.x.xxx/hub2/devicesList/device/listJson?capability=capability.*

Does this url only respond if called within a groovy app or should the HE respond with device details from within a browser. Is there any documentation on these useful url's?

Thanks

Ian

/device/listJson?capability=capability.*

They are two separate endpoints

hubitat.local/hub2/devicesList
and
hubitat.local/device/listJson?capability=capability.*

1 Like

Thank you

Are these end points documented anywhere?

Thanks again
Ian