CLI access on 2 hubs

I have 2 hubs on the same location. When access the CLI, how to I gain access to the second hub?

The CLI gives you access at the user account level so you have access to every Location you are a member of. Where does the lack of access come in?

I have two hubs in the same Location and my default account on the CLI can’t see the hubs for Edge type stuff. I have the CLI additionally configured with the user that owns the Location and the hubs and so I add --profile name when required.

When discussing access issues the developer relations team and/or Engineering have referred to the ‘hub owner’ rather than the Location owner, so it might be that the user that actually installed the hub in the Location is key.

Curiously although my user account can’t see the Edge stuff on the hubs in the CLI or the mobile app, it can when using going via channel invitations on the web.

I am the only user/owner for both hubs.
I was trying to update a driver on hub 2 but when I run the command smartthings edge:driver:install I do not see the drivers that are installed only on hub 2

Do you not see the required channel listed after selecting the hub, or do you not see the drivers after selecting the channel?

I’ve not got any production drivers so I don’t know how they behave, and I doubt I have any insight regardless …

I don’t see an option to select between the hubs in the CLI. I think I’m missing a command.

Using commands
smartthings edge:driver:install

The smartthings edge:drivers:install command should show you a list of your hubs, even if you only have one of them. Once you’ve selected your hub it will then go on to ask you to select the channel and then the driver.

What it actually does under the hood is:

  • Query the API for all your devices of type HUB (similar to smartthings devices --type=HUB).
  • Query the API for all your locations with an allowed=true parameter.
  • Filters out any hubs that don’t have a locationId.
  • Filters out any hubs in a location that you don’t have delete permission for (meaning it has been shared with you).

smartthings edge:drivers:install

i am not shown a list of my hubs

smartthings devices --type=HUB shows both hubs with ID’s

Not sure if it matters but hub 1 is on beta and hub 2 is not.

It doesn’t make any difference for my hubs, but we aren’t talking about my hubs.

You could perhaps run set SMARTTHINGS_DEBUG=true before running the CLI command to see if it says anything interesting in the debugging.

1 Like

@nayelyz can you help with this issue? CLI is only showing drivers on 1 of 2 hubs.

1 Like

Which version of the CLI are you using? I am usually pretty good at keeping up to date with it and yet I just found out I was ten releases behind (latest is 19, I was on 9). There seems to have been quite a bit of refactoring going on over the Summer and I wonder if there was a rogue release in there.

I’m on version 16.

Just a thought, do you have a default hub set? You can probably see it if you do …

smartthings config default

If you have, and it will be obvious, you can do

smartthings config:reset

That will clear the answers to all saved questions for your default profile.

That was it! Thank you so much. I reset the config and now I get the option to select the hub to install the driver to!

1 Like

I’m glad that is sorted. I just got lucky because I ran the driver install command using a profile I hadn’t used it on before and it asked me if I wanted to save my hub selection as a default. Then the penny dropped.

1 Like