Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Add a flag to the devices command to filter devices by which Hub they're joined to #588

Open
dljsjr opened this issue Feb 7, 2024 · 0 comments
Labels
enhancement New feature or request reviewed

Comments

@dljsjr
Copy link

dljsjr commented Feb 7, 2024

Is your feature request related to a problem? Please describe.
My specific use-case is probably pretty niche, but I think this could be a valuable filter either way.

I have several locations where I have more than one hub, and I will often have the same devices joined to multiple hubs in the same location. This makes it challenging to determine exactly which device record to isolate when using smartthings devices.

Here are two examples of where this happens:

  1. I have various LAN devices that will auto-join any time I trigger a "Scan Nearby" flavored discovery. I want to remove them from some of my hubs, but not all of them.
  2. I frequently like to test the same device on multiple versions of hub-core by using different hub products. For example, I'll test things on the newest hubcore using my Aeotec v3, and I'll use my TV or ST Station hubs to test slightly older firmware.

Describe the solution you'd like
A -H flag or something similar to the capital H flag used in other commands to identify a Hub Device UUID that would only return devices that are joined to the given hub.

Describe alternatives you've considered

  1. Put all of my hubs in different locations and filter by location

This doesn't work great because it's a lot of friction/moving around in the app that slows me down. Also, with more and more products having ST Hub functionality built-in, there is certainly going to be more occurrences for multiple hubs in the same location across the fleet. So there's potential value in getting ahead of that.

  1. Doing my own filtering with jq

This gets me part way there. For example, I do have a one-liner I sometimes use that looks like this:

st devices -p production -j | jq -r --arg hub $HUB_UUID '.[] | select(.parentDeviceId == $hub)'

Where this falls down, though, is that I work with a lot of parent-child devices. This is only a top-level filter, meaning I'd have to craft a gnarly pipeline if I wanted to get all the devices joined to my hub plus child devices.

@dljsjr dljsjr added the enhancement New feature or request label Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request reviewed
Projects
None yet
Development

No branches or pull requests

2 participants