@TAustin, Love the API Browser+.
Noticed that you had a method to enable/disable a rule. I don’t see a similar method in the CLI. Am I missing something?
Thanks
Henry
@TAustin, Love the API Browser+.
Noticed that you had a method to enable/disable a rule. I don’t see a similar method in the CLI. Am I missing something?
Thanks
Henry
I don’t think you are! - There is no such option documented on the CLI page that I can see.
Add a virtual switch as a condition and turn it on or off?
The CLI is largely a wrapper around the Core SDK library which in turn is a wrapper around the API. Enabling and disabling of Rules isn’t in the API Reference and nor is it in the Core SDK which often includes undocumented things. So although the CLI can sometimes do its own things, as it did with Edge stuff until the Core SDK caught up, it generally works with what is already written.
The API calls to enable/disable Rules are exposed in a Postman collection. Not everything in that collection works but those do.
Incidentally, Location Modes aren’t in the CLI at the moment but there is a Pull Request in to add them.
There are quite a few things that can be done with the API using existing privileges that aren’t explicitly documented, are tucked away in libraries, or are just plain not mentioned anywhere.
Update: It would probably be sensible to note the API calls here.
PUT https://api.smartthings.com/rules/{{ruleId}}/status/disable?locationId={{locationId}}
PUT https://api.smartthings.com/rules/{{ruleId}}/status/enable?locationId={{locationId}}
I’ve submitted a feature request for this directly to the CLI GitHub repository. The CLI team actively engage with the ‘issues’ submitted there and I think it helps visibility.
However I’ll just tag @nayelyz and @AlejandroPadilla here as a courtesy so they are aware I’ve done so.