# How does a SmartApp get hub properties and information?

**URL:** <https://community.smartthings.com/t/how-does-a-smartapp-get-hub-properties-and-information/7383>\
**Category:** Writing SmartApps\
**Created:** [November 25, 2014, 10:21pm UTC](https://community.smartthings.com/t/how-does-a-smartapp-get-hub-properties-and-information/7383 "2014-11-25T22:21:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tracstarr](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tracstarr](https://community.smartthings.com/u/tracstarr)\
**Post date:** [November 25, 2014, 10:21pm UTC](https://community.smartthings.com/t/how-does-a-smartapp-get-hub-properties-and-information/7383/1 "2014-11-25T22:21:33Z")

</div>

So this is similar to [this topic](http://community.smartthings.com/t/how-does-a-device-type-get-access-to-hub-properties/4438) but specific to SmartApps. I can’t seem to figure out how to get the local IP of the hub within a SmartApp. I just can’t find enough information about “physicalgraph” class or otherwise to determine how i can call the getDataValue function that seems to be available on devices. Sorry if I’m missing the (less-than) obvious.

---

<div class="post-metadata">

**Author:** ![tracstarr](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tracstarr](https://community.smartthings.com/u/tracstarr)\
**Post date:** [November 27, 2014, 9:14pm UTC](https://community.smartthings.com/t/how-does-a-smartapp-get-hub-properties-and-information/7383/2 "2014-11-27T21:14:57Z")

</div>

Anyone? I’m still lost with this one. I’m trying to keep my LAN connected devices talking only via LAN and not STH-\>LAN-\>WAN-\>STH

---

<div class="post-metadata">

**Author:** ![tracstarr](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tracstarr](https://community.smartthings.com/u/tracstarr)\
**Post date:** [November 28, 2014, 3:11am UTC](https://community.smartthings.com/t/how-does-a-smartapp-get-hub-properties-and-information/7383/3 "2014-11-28T03:11:11Z")

</div>

Well, I can finally answer my own question. A SmartApp has a location, which contains a list of hubs. I’m a bit lost here as to why an app can have multiple hubs. Perhaps I misunderstand some basics about apps. They seem to not exist on individual hubs? Anyway, I’m not sure how multiple hubs work together either. That being said, I can access the first value of the list as my “current” hub. At this point I think it’s safe to assume there will always be one hub, and that I don’t care if there are multiple?

Thus, I can get the IP of the hub from the app as:

```
def localHubIp = location.hubs[0].localIP
```

---

<div class="post-metadata">

**Author:** ![geko](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/geko/32/34862_2.png) [@geko](https://community.smartthings.com/u/geko)\
**Post date:** [December 5, 2014, 6:24am UTC](https://community.smartthings.com/t/how-does-a-smartapp-get-hub-properties-and-information/7383/4 "2014-12-05T06:24:31Z")

</div>

> [@tracstarr](#):
>
> I’m a bit lost here as to why an app can have multiple hubs.

There can be multiple hubs installed at any location. Apps are attached to a location and thus can access multiple hubs. Devices, on the other hand, are attached to specific hubs, unless they are “virtual” devices that don’t use hub services I.e. either Zibgee, or Zwave, or local HTTP protocols.
