Skip to main content

Configuration and Logging

The CLI can be configured by creating a YAML file called config.yaml in the following location:

  • $HOME/.config/@smartthings/cli on MacOS or Linux
  • %LOCALAPPDATA%\@smartthings\cli on Windows

Profiles#

You can define multiple profiles with different configurations. Top-level keys other than the special logging key define these profiles.

The default profile is named "default" and will be used unless otherwise specified. Most users can put their configuration options here.

To choose a different profile, you can either set the SMARTTHINGS_PROFILE environment variable, or use the --profile (-p) command line argument (when both are used, the command line argument overrides the environment variable.)

Configuration Options#

The following per-profile config options are supported:

OptionDefault ValueDescription
indent2Indent level for JSON or YAML output.
compactTableOutputtrueCompact table output without lines between rows.
tokennoneUse a bearer token (such as a PAT) for authentication instead of the default login flow.

Example#

default:
indent: 4
compactTableOutput: false
tight:
indent: 1
compactTableOutput: true

Logging#

Logging is useful when you are developing the CLI itself (rather than using it).

The CLI uses log4js for logging.

Logging is configured using a YAML file called logging.yaml in the same location as the config file mentioned above. The contents of this file are passed directly to log4js, so any valid log4js configuration can be included here. The following categories are used in the CLI:

  • rest-client - This category is used for the SDK that interfaces with the API. Turn this on to see detailed information for HTTP calls are made to SmartThings.
  • cli - This is the generic logger used by the CLI.