Determine location(hub) that a device is connected to?

Is there any way to determine the location (what hub) a device ID is connected to? It doesn’t seem to be part of the device class.

Thanks!

def hubIp = device.hub.getDataValue("name")

a-ha, thank you very much.

In this function, I can’t seem to get the hub info - any ideas?

private deviceItem(it) {
 def hubinfo = it.hub.getDataValue("name")
 it ? [id: it.id, label: it.displayName, hub: hubinfo] : null
}

This is the code I’m using to call that function (part of the API I am building)

def type = params.deviceType
settings[type]?.collect{deviceItem(it)} ?: []

@geko any ideas? thanks!

An update - figured it out, I was able to simply say device.hub.id / device.hub.name…

Now only if I could get the deviceTypeId…