Skip to main content

Hubitat Maker API Interface

Project description

Hubitat Elevation Maker API Interface

Test CodeQL Libraries.io dependency status for latest release

hubitatcontrol PyPI - Status PyPI GitHub

Intro

This guide assumes you own a Hubitat Elevation home automation controller.

If you are interested in purchasing one, you can purchase a unit from the manufactures website at hubitat.com or from Amazon.com

Changes

See CHANGELOG.md for current changes

Setup

To get the required API keys, you will need to log in to your Hubitat admin interface.

See Maker API Documentation for how to add the MakerAPI application and to generate new API keys

If you are using the cloud API endpoint for access, you will ALSO need to include the Cloud API key when setting up a new Hub object.

Install

pip install hubitatcontrol

Or if you want a copy direct from source

pip install git+https://github.com/Jelloeater/hubitatcontrol.git

Usage

API

Local Example

import hubitatcontrol as hc

hub = hc.Hub(host='http://192.168.1.100', token='Maker_Token',
app_id='Maker_App_ID') # Get Hub object to auth and poll against

# If you have a cloud based maker API, you can include the cloud token
# hub = hc.get_hub(host='https://cloud.hubitat.com', token='Maker_Token',
#                  app_id='Maker_App_ID', cloud_token='Cloud_API_token')

TEST_DEVICE = '1RGB'

device = hc.GetSingleDevice(hub).name(TEST_DEVICE)

# Turn on all the switches (includes lights)
device.turn_on() # Send command to device
print(device.switch)

# Get temprature from all sensors
for i in hc.GetDevices(hub).TemperatureSensor():
    print(f"{i.name} - {i.temperature}")

CLI Interface

  • If you have all the needed API keys added to your .env file, all you need to do is add them to your keyring
  • Once loaded into the keyring, you can run the CLI from anywhere on your system
hubitatcontrol --help
hubitatcontrol load-env-to-keyring
hubitatcontrol ls
❯ hubitatcontrol

 Usage: hubitatcontrol [OPTIONS] COMMAND [ARGS]...

 Hubitat Control CLI Interface

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion        [bash|zsh|fish|powershell|pwsh]  Install completion for the specified shell. │
│                                                              [default: None]                             │
│ --show-completion           [bash|zsh|fish|powershell|pwsh]  Show completion for the specified shell, to │
│                                                              copy it or customize the installation.      │
│                                                              [default: None]                             │
│ --help                                                       Show this message and exit.                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────╮
│ clear-keyring                      Clear Keyring passwords                                               │
│ level                              Turn on a device via it's Device ID                                   │
│ load-env-to-keyring                Load .env file at exec location to keyring                            │
│ ls                                 Prints current devices from system keyring                            │
│ off                                Turn on a device via it's Device ID                                   │
│ on                                 Turn on a device via it's Device ID                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯

 Version: 1.1.2   Project: https://github.com/Jelloeater/hubitatcontrol

Docs

Located in /docs folder

You will need a .dot file browser for the class diagrams

WIP: Setup ReadTheDocs auto gen

Issues / Features

See:

https://github.com/Jelloeater/hubitatcontrol/issues

Structure

Class Model

flowchart LR
Specific_Device --> Abstract_Device_Class --> Device--> Hub

Development setup

Testing is done with PyTest, you will need to set up the correct env vars for your local (or cloud) Hubitat API See .env.example

If you are using a local API endpoint, please leave HUBITAT_CLOUD_ID blank in the .env file.

Setup

Install Go-Task --> https://taskfile.dev/installation/

task setup
task

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hubitatcontrol-3.0.2.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hubitatcontrol-3.0.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file hubitatcontrol-3.0.2.tar.gz.

File metadata

  • Download URL: hubitatcontrol-3.0.2.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.5 Linux/6.8.0-51-generic

File hashes

Hashes for hubitatcontrol-3.0.2.tar.gz
Algorithm Hash digest
SHA256 76aba57a29cc62d725d3e52c61d63586f0ff7295c378a346d99c7a09184b44c1
MD5 755cdec1d87822b0fd9e2e2632f8116f
BLAKE2b-256 385591048e161e82d794d0994468869ccf6b5a3efd43a19ff9395e0c87c4c5c8

See more details on using hashes here.

File details

Details for the file hubitatcontrol-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: hubitatcontrol-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.5 Linux/6.8.0-51-generic

File hashes

Hashes for hubitatcontrol-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11838250f9e60e64ac8f0415a777f21b97e2b4eeaaf8c9cb152c5f0cffe6234f
MD5 6e30b18906a7a9be6bb5854bc3ea542d
BLAKE2b-256 bec87598459a3e9b6bba0b2be8adfa35d2e0672bafeca31b6eedec6b3d9290a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page