Shade Command Line

Shade's CLI provides a cross-platform terminal utility for controlling hue devices.

Install

Download the latest release And extract it in a location for execution.

The shade executable is located in the bin/ folder. Add it to your $PATH or execute it directly.

Run

Confirm the cli executes correctly by running the base --help command.

$ shade --help
Usage: main [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit

Commands:
(...)

Bridge Discovery

The discovery process uses Hue's API to find Hue Bridges on the local network. This is the only command in the CLI that requires an internet connection, and is only used to find bridges. If you know the IP address of the hue bridge that you want to connect to, this step can be skipped.

Request a list of local devices on the network with the discover command:

$ shade discover
001878fffe321a4a:
    ip: 192.168.1.23
    port: 443

Security

Shade is configured to use HTTPS by default when connecting to the hue bridge. However, since connections are done on a local network, the SSL certificate from the hue bridge must be trusted on your system before establishing a connection.

For each command, you have the option to specify a security scheme used for the HTTP connections.

Platform Trust (Default)

Platform trust is the default trust strategy for Shade. This will defer validation of the HTTPS connection to your platform, meaning you will have to manually install or mark the certificate as trusted on your system in order to connect to the hue bridge.

This option requires no configuration within Shade. However, it requires that the certificate be manually trusted in your system.

Insecure Connection

If you trust the network that your commands are running on, you can ignore the SSL connection with the --insecure flag when running commands.

For security reasons it is not recommended that you use an insecure connection unless you are on a trusted network.

Hue CA

The hue bridge is configured to use a custom CA in its HTTPS certificates. You can configure Shade to trust this root certificate manually, by specifying the IP and device ID of the bridge that were obtained during discovery in the Properties File located in your home directory: $HOME/.shade-cli.properties

hostname=01234xxabcdef
security=hue
ip=192.168.1.5

Authorize with the Hue Bridge

To request an authorization token, call the authorize command.

$ shade authorize --host=192.168.1.23
Press button on hue bridge to complete
Application Key: ********
Client Key: ********

The command will wait for the button on the hue bridge to be pressed in order to confirm the authorization before providing the keys.

Request Configuration

Requests made with the CLI require an api key and host specified or configured. You can specify these properties per-command or in a configuration file

Option Flags

For any command you can specify the host and key options explicitly.
(The authorize command does not need a key specified, and the discover command needs neither a key nor host)

$ shade list-lights --host=192.168.1.23 --key=*********

If your bridge does not support SSL connections, you may disable https verification with the --insecure flag:

$ shade list-lights --insecure --host=192.168.1.23 --key=*********

Config File

You can also specify the configuration via a file located in your home directory: $HOME/.shade-cli.properties

Set an application and client key with the following properties:

hostname=192.168.1.23
application_key=********
client_key=********
security=platform

Control Lights

You can control lights with the following commands:

Control Rooms

You can control rooms with the following commands:

Control Zones

You can control zones with the following commands:

Control Grouped Lights

You can control grouped lights with the following commands:

Control Devices

You can get/update information for devices with the following commands:

Resources

You can get information about bride api resources with the following commands:

Scenes

You can control scenes with the following commands: