Code Monkey home page Code Monkey logo

hubitat-cli's Introduction

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

hubitat-cli's People

Contributors

dpb587 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hugoh nrobbins00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.