# Query HUB for attached Devices

**URL:** <https://community.tempest.earth/t/query-hub-for-attached-devices/757>\
**Category:** Developers\
**Created:** [April 5, 2018, 3:46pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757 "2018-04-05T15:46:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![btst.online](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/btst.online/32/16538_2.png) [@btst.online](https://community.tempest.earth/u/btst.online)\
**Post date:** [April 5, 2018, 3:46pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/1 "2018-04-05T15:46:22Z")

</div>

Via the UDP API, it would be beneficial to be able to query the HUB for what devices are attached… or have the HUB send out a UDP ‘devices’ packet that lists the attached devices.

I am working on a way to auto-detect multiple HUBs and multiple attached devices… so my Wx Console can be more intelligent, and show relevant data in an intuitive fashion.

Thoughts?  
–Sam

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [April 5, 2018, 4:11pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/2 "2018-04-05T16:11:38Z")

</div>

When you receive a UDP packet with type of “hub\_status” the “serial\_number” tells you which hub is it.

Then when you receive a packet with any other type 'hub\_sn" tells you which Hub it belongs to and the “serial\_number” tells you the device and type. I use this data to build my internal configuration.

---

<div class="post-metadata">

**Author:** ![btst.online](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/btst.online/32/16538_2.png) [@btst.online](https://community.tempest.earth/u/btst.online)\
**Post date:** [April 5, 2018, 4:15pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/3 "2018-04-05T16:15:52Z")

</div>

Yeah, that’s what I am working on now… Just thinking a single packet containing that data would be more efficient than waiting for x minutes for each data packet…

😃

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [April 5, 2018, 4:37pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/4 "2018-04-05T16:37:37Z")

</div>

At most you only have to wait 61 seconds.

---

<div class="post-metadata">

**Author:** ![btst.online](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/btst.online/32/16538_2.png) [@btst.online](https://community.tempest.earth/u/btst.online)\
**Post date:** [April 5, 2018, 4:40pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/5 "2018-04-05T16:40:36Z")

</div>

👍  
Agreed. Guess, I just want things to be handed to me on a silver platter… 😉

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [April 5, 2018, 4:43pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/6 "2018-04-05T16:43:55Z")

</div>

You and me. Let’s start an exclusive club. 😉

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [April 5, 2018, 4:52pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/7 "2018-04-05T16:52:42Z")

</div>

I’ve given this a lot of thought.

The Hub doesn’t have an API for UDP so that’s out. Maybe the Bluetooth API will offer something. It’s easy enough to add Bluetooth to a Pi and some other devices. That may give us what we want.

---

<div class="post-metadata">

**Author:** ![btst.online](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/btst.online/32/16538_2.png) [@btst.online](https://community.tempest.earth/u/btst.online)\
**Post date:** [April 5, 2018, 6:14pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/8 "2018-04-05T18:14:55Z")

</div>

I’m not sure the Bluetooth way is right… then you have to connect to each BT device to see if it is an SWS…then query.

Waiting for the UDP broadcasts appears to be the best way right now. Maybe WF will take the ‘devices’ HUB broadcast into account for v40 of the UDP spec.

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [April 5, 2018, 6:45pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/9 "2018-04-05T18:45:23Z")

</div>

From what I am able to tell is you connect to the Hub(s) I range. The API will handle the rest.

---

<div class="post-metadata">

**Author:** ![dsj](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/dsj/32/3_2.png) [@dsj](https://community.tempest.earth/u/dsj)\
**Post date:** [April 7, 2018, 12:10pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/10 "2018-04-07T12:10:30Z")

</div>

Adding a “connected devices” to the hub\_status message is not a bad idea. However, keep in mind that it would only be a best guess, because the device connections are not continuous. The AIR, for example, wakes up every minute, connects, then goes back to sleep. During that minute, the Hub doesn’t know if any particular devices is still there. It only knows it was there last time it connected.

---

<div class="post-metadata">

**Author:** ![vreihen](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vreihen/32/13217_2.png) [@vreihen](https://community.tempest.earth/u/vreihen)\
**Post date:** [April 7, 2018, 12:29pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/11 "2018-04-07T12:29:46Z")

</div>

> [@dsj](#):
>
> …It only knows it was there last time it connected.

While you’re making new status messages… 😉

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [April 7, 2018, 2:18pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/12 "2018-04-07T14:18:04Z")

</div>

That reminds me of the Raytheon manual on missile guidance.

“The missile knows where it is at all times. It knows this because it knows where it isn’t. By subtracting where it is from where it isn’t, or where it isn’t from where it is (whichever is greater), it obtains a difference, or deviation. The guidance subsystem uses deviations to generate corrective commands to drive the missile from a position where it is to a position where it isn’t, and arriving at a position where it wasn’t, it now is. Consequently, the position where it is, is now the position that it wasn’t, and it follows that the position that it was, is now the position that it isn’t.”

---

<div class="post-metadata">

**Author:** ![btst.online](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/btst.online/32/16538_2.png) [@btst.online](https://community.tempest.earth/u/btst.online)\
**Post date:** [April 9, 2018, 1:12pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/13 "2018-04-09T13:12:05Z")

</div>

I believe Buckaroo Bonzai summed up Raytheon’s statement:

“No matter where you go, there you are.”

---

<div class="post-metadata">

**Author:** ![btst.online](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/btst.online/32/16538_2.png) [@btst.online](https://community.tempest.earth/u/btst.online)\
**Post date:** [April 9, 2018, 1:13pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/14 "2018-04-09T13:13:34Z")

</div>

It would be OK if the connected\_devices field was not 100% accurate… it would at least give a starting point for determining what devices are out there.  
–Sam

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [September 1, 2018, 6:39am UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/15 "2018-09-01T06:39:51Z")

</div>

> [@dsj](#):
>
> The AIR, for example, wakes up every minute, connects, then goes back to sleep.

Let me ask about this. Does the entire Air go to sleep or just the radio? If it’s the entire Air, how does it detect lightning? Does it wake up if lightning strikes 30 seconds after it went to sleep?

---

<div class="post-metadata">

**Author:** ![vreihen](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vreihen/32/13217_2.png) [@vreihen](https://community.tempest.earth/u/vreihen)\
**Post date:** [September 1, 2018, 11:29am UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/16 "2018-09-01T11:29:43Z")

</div>

The Franklin chip has an IRQ function on pin #10, and I’m sure that it can be wired to wake just about anything short of [Rip Van Winkle](https://en.wikipedia.org/wiki/Rip_Van_Winkle) (a local story here)…

---

<div class="post-metadata">

**Author:** ![dsj](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/dsj/32/3_2.png) [@dsj](https://community.tempest.earth/u/dsj)\
**Post date:** [September 2, 2018, 2:25pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/17 "2018-09-02T14:25:44Z")

</div>

> [@GaryFunk](#):
>
> Does the entire Air go to sleep or just the radio? If it’s the entire Air, how does it detect lightning? Does it wake up if lightning strikes 30 seconds after it went to sleep?

What @vreihen said: the lightning sensor wakes it up when necessary. It’s probably more accurate to say the AIR is **normally** in a state of deep sleep, but it can be awakened instantly by various interrupts (a timer, the lightning sensor, the button, etc.)

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [September 2, 2018, 3:10pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/18 "2018-09-02T15:10:50Z")

</div>

I understand. You use the term sleep differently than I was taught.

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [September 2, 2018, 4:01pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/19 "2018-09-02T16:01:08Z")

</div>

> [@dsj](#):
>
> Adding a “connected devices” to the hub\_status message is not a bad idea. However, keep in mind that it would only be a best guess, because the device connections are not continuous.

Does the Hub know which devices are allowed to communicate with it? If yes, does it know the serial number of each device?

We are slowly accumulating information about the Station and gaining better understanding how this marvelous unit works. This is good for us but seemingly bad for you as we ask for more and more. ☀

---

<div class="post-metadata">

**Author:** ![dan.gealt](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/dan.gealt/32/4908_2.png) [@dan.gealt](https://community.tempest.earth/u/dan.gealt)\
**Post date:** [September 2, 2018, 4:31pm UTC](https://community.tempest.earth/t/query-hub-for-attached-devices/757/20 "2018-09-02T16:31:08Z")

</div>

Well Gary . . . Apparently you think that @dsj is a technical guy, but he is actually a landscape maintenance guy and his main job is to keep the application hedges neatly pruned and trimmed so they are pretty and presentable. 😜

[Next page](https://community.tempest.earth/t/query-hub-for-attached-devices/757.md?page=2)
