Skip to content

An unofficial CLI for some Hubitat commands.

License

Notifications You must be signed in to change notification settings

dpb587/hubitat-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hubitat-cli

An unofficial CLI for some Hubitat commands.

Hubitat doesn't really have a formal API so this is a little hacky and may break across platform updates. It currently supports a few management commands that I rely on in automation (namely downloading backups and rotating HTTPS certificates). Use at your own risk.

Usage

Download and install the binary for your Linux, macOS, or Windows environment from the releases page. At a minimum, you'll need to configure the IP or hostname of your Hubitat node.

$ hubitat-cli --hub-url='http://192.0.2.100' ...

If your hub requires login (learn more), you will also want to configure your username and password.

$ hubitat-cli \
  --hub-url='http://192.0.2.100' \
  --hub-username='janedoe' \
  --hub-password='secretpassword' \
  ...

Environment variables may be used for many of the global flags to help with automation or avoid repetitive commands.

$ export HUBITAT_URL=http://192.0.2.100
$ export HUBITAT_USERNAME='janedoe'
$ export HUBITAT_PASSWORD='secretpassword'
$ hubitat-cli ...

Use the --help flag at any point to view more details on flags, arguments, and any available subcommands. For example, to download the latest backup you might use the following.

$ hubitat-cli backup download \
  --output=latest.lzf

To update server certificates you might use the following.

$ hubitat-cli advanced certificate update \
  --certificate-path=/mnt/config/tls.crt \
  --private-key-path=/mnt/config/tls.key

To manually reboot the hub (and optionally --follow progress until it's back online):

$ hubitat-cli reboot --follow

To check if updates are available:

$ hubitat-cli cloud check-for-update

To immediately apply an update (and optionally --follow progress until it's back online):

$ hubitat-cli cloud update-platform --follow

If the CLI is erroring or not behaving as you expect, try enabling logging with the -v verbosity flag. If logs are unhelpful or you still have a concern, refer to them when searching and reporting a project issue.

Advanced

If Hubitat has HTTPS enabled, the CLI will reject any certificates your system does not already trust. To trust a custom CA, configure the CA certificate file path with the --hub-ca-path= flag (or HUBITAT_CA_PATH environment variable). See the --help option for additional connection options and methods for disabling secure connections.

A minimal image is available for use from Docker, Kubernetes, or any other container runtime. To avoid potentially breaking changes, use a major version tag (e.g. v0) rather than the default latest tag.

$ docker run ghcr.io/dpb587/hubitat-cli

License

MIT License