Developer CLI Community Documentation
Usage
- Download the appropriate binary from the
releases
tab of the github page. - Install it on your path and rename it to “smartthings”. It does not need
administrator privileges but of course will need to be executable. - Run
smartthings --help
to make sure it’s working. - Run a specific command with
smartthings <command>
Input and Output Considerations
Many commands in the CLI handle complex input and/or output, mostly for use with
the SmartThings REST API. Input can always be passed as JSON or YAML and in
a couple cases a “question and answer” mode is provided. The output format
will match the input format unless otherwise specified.
Name | Shortcut | Description |
---|---|---|
json | j | Write output in JSON format. |
yaml | y | Write output in YAML format. |
indent | Specify the number of spaces for YAML or JSON output | |
input | i | Specify a filename for input. |
output | o | Specify a filename for output. The extension of this file will control its type unless overridden with --json or --yaml . |
Configuration
The CLI can be configured by creating a YAML file called config.yaml
in the
following location:
-
$HOME/.config/@smartthings/cli
on OS/X or Linux -
%LOCALAPPDATA%\@smartthings\cli
on Windows
Authentication
The CLI supports an automatic login flow that pops up a browser window
asking you to log in and give the CLI permission to access your account.
The CLI will automatically request login as needed.
More details about configuration of the CLI can be found on the configuration documentation page.
Helpful Hints
- You can get more specific information about any command or sub-hierarchy
of commands by using--help
with a specific command or branch. For
example, you can run any of the following commands for varying level of
detail:-
smartthings capabilities --help
, smartthings capabilities:presentation --help
smartthings capabilities:presentation:create --help
-
- The CLI accepts data in YAML or JSON format and can
output data in either format as well as the default table format. - Commands that take input accept stdin or a file specified
by the--input
(shortcut-i
) flag. - Commands that output data will output the data to stdout unless a file
is specified the using--output (shortcut
-o`) flag. - When a command takes input and results in output, the format of the output
will match the input format unless an output filename is specified
using--output
with a different extension.