[Smartthings Cli] Unable to get rules

I’ve been using the cli for a while now without issue. This morning I was modifying a rule and I tried to bring up the existing rules to delete the one being replaced and it couldn’t find anything.

mikefitzgerald@Mikes-MacBook-Air ~ % smartthings rules

no items found

Searching through the forums led me to try to reset my session, no luck. Then I logged out of my session and logged back in, still the same. Then I tried appending my PAT to the command and it returned my rules.

mikefitzgerald@Mikes-MacBook-Air ~ % smartthings rules --token=####-####-####

Any ideas on how to fix this? Other commands work, devices, etc. Just not rules.

Thanks

1 Like

I am the other way around. If I use the default authentication in the CLI I get the rules. If I use a PAT for a location member nothing is returned (it is actually a 403).

This is new and disastrous. It means that Wild Thing, my cross checking app, is broken. I’ve been using it in various forms for years now. It would actually be impossible for ST do anything worse than that.

Let’s ask @nayelyz if she can make some enquiries.

1 Like

I don’t know for sure, but it appears that this happened at the same time that people said their routines no longer showed up in the app. For discussion of that issue, see the following thread:

Cannot edit routines/Missing Routines (18 Jan 2023)

That one briefly appeared on the official status page yesterday, but then was marked as “fixed“ when it clearly wasn’t fixed for everyone or for all access methods. :thinking:

I also removed the creds…

mikefitzgerald@Mikes-MacBook-Air ~ % rm /Users/mikefitzgerald/.config/@smartthings/cli/credentials.json

and logged back in. Same thing, I get the full list with my PAT, but nothing with just “smartthings rules”

Rules cannot be seen from the app, ever.

1 Like

Right, I know that, but routines are now wrappers for rules.

So routines disappeared from the app for some people at the same time that you’re reporting the CLI no longer returns a list of rules.

Could just be a coincidence, but since it’s the same underlying infrastructure, it seemed like it might be more than that. :thinking:

1 Like

I can still see my API Rules using the API Browser+.

You could never see your routines at my.smartthing.com.

1 Like

Hi, everyone

I remember seeing something like this in the past with a tool to create basic Rules which used the OAuth authentication to be able to create them for you.
But, if you tried to get them from the API directly, they didn’t appear. What I noticed is that the difference was in the Access Token type. In this case, I think it’s happening again because the CLI’s login flow also uses OAuth and if you created the Rule with your PAT, it won’t appear and vice-versa.
I’ll check with the team for more details about this behavior and let you know their feedback.

1 Like

My routines have reappeared, along with the new Smart Lighting app and scenes… took almost 24 hours, but seems OK now.

1 Like

@nayelyz Just to be clear, I could view rules yesterday with standard auth, today I can only see them if i append my PAT.

@nayelyz I am the opposite. I can still view the Rules with the default authorisation in the CLI which is the method I use to create and manage them.

However using a PAT, which I have been doing for years, has started returning a 403. Nothing else I know how to access in the API seems to be affected, including Scenes. It is just Rules.

I suspect it does indeed depend on the type of token used. It is badly broken though, however you look at it.

2 Likes

Would the PAT vs OAUTH issue also explain why I can see my rules in the CLI and still manage them there but not see them via the /rules api? I just get an empty object from the API now when listing rules but I can see them all via the CLI just fine (I use YAML to create my rules using the CLI but can’t see them via the API at all and this seems new within the last week or so).

I believe so. That is what is currently happening to me. I think those who have experienced it the other way around may have been creating Rules using Todd’s API Browser or similar.

I’m not terribly happy about it. It’s not that I couldn’t switch my Rules to a PAT in a couple of minutes if necessary, it is just that I am a bit fed up of the whole concept of ownership and security in ST being so opaque. How do I know if something is broken if I don’t know how it is supposed to work in the first place?

Following on to the above comment there is a certain added irony in that I couldn’t quite get my head around why it ever worked. We see webhook apps and Glitch apps maintain their own set of Rules and I was never clear why the CLI behaved differently.

Hi, everyone
Following up on this, I created a report about this behavior. I was able to reproduce that we cannot see Rules created by the CLI and in the API directly in the same list as it depends on the token used to create it.
Once I get more info, I’ll let you know.

3 Likes

I know you’ll let us know when you do hear anything, but I just wanted to keep this thread active as it is important to know the path forwards. As things stand I can either manage Rules using the default CLI authentication OR I can use a PAT belonging to any of the Location members. Though it is odd that it has suddenly become one or the other, if it is how it is going to be going ahead than that’s fine, though the CLI team might be advised to twiddle their help texts if that is the case. I am just about to move mine over as I can’t function without being able to see my Rules with a PAT.

1 Like