hubitatcontrol


Namehubitatcontrol JSON
Version 3.0.1 PyPI version JSON
download
home_pagehttps://pypi.org/project/hubitatcontrol
SummaryHubitat Maker API Interface
upload_time2024-08-17 22:00:14
maintainerNone
docs_urlNone
authorJesse Schoepfer
requires_python<4.0,>=3.10
licenseMIT
keywords hubitat makerapi requests
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hubitat Elevation Maker API Interface

[![Test](https://github.com/Jelloeater/hubitatcontrol/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Jelloeater/hubitatcontrol/actions/workflows/test.yml)
[![CodeQL](https://github.com/Jelloeater/hubitatcontrol/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/Jelloeater/hubitatcontrol/actions/workflows/codeql.yml)
[![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/pypi/hubitatcontrol)](https://libraries.io/pypi/hubitatcontrol)

[![hubitatcontrol](https://snyk.io/advisor/python/hubitatcontrol/badge.svg)](https://snyk.io/advisor/python/hubitatcontrol)
![PyPI - Status](https://img.shields.io/pypi/status/hubitatcontrol)
[![PyPI](https://img.shields.io/pypi/v/hubitatcontrol)](https://pypi.org/project/hubitatcontrol/)
[![GitHub](https://img.shields.io/github/license/jelloeater/hubitatcontrol)](https://github.com/Jelloeater/hubitatcontrol/blob/main/LICENSE)

## 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](https://hubitat.com/products) or from [Amazon.com](https://www.amazon.com/Hubitat-Elevation-Home-Automation-Hub/dp/B07D19VVTX/)

## Changes
See [CHANGELOG.md](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](https://docs2.hubitat.com/en/apps/maker-api) 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

```shell
pip install hubitatcontrol
```

**Or if you want a copy direct from source**

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

## Usage

### API
**Local Example**

```python
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

```bash
hubitatcontrol --help
hubitatcontrol load-env-to-keyring
hubitatcontrol ls
```

```text
❯ 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](docs)

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**

```mermaid
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/>

```shell
task setup
task
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/hubitatcontrol",
    "name": "hubitatcontrol",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "hubitat, makerapi, requests",
    "author": "Jesse Schoepfer",
    "author_email": "jelloeater@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/9e/67/fc5bae4d8c1de1309abe29874f0943c086a61716c828373891d4564edd1b/hubitatcontrol-3.0.1.tar.gz",
    "platform": null,
    "description": "# Hubitat Elevation Maker API Interface\n\n[![Test](https://github.com/Jelloeater/hubitatcontrol/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Jelloeater/hubitatcontrol/actions/workflows/test.yml)\n[![CodeQL](https://github.com/Jelloeater/hubitatcontrol/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/Jelloeater/hubitatcontrol/actions/workflows/codeql.yml)\n[![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/pypi/hubitatcontrol)](https://libraries.io/pypi/hubitatcontrol)\n\n[![hubitatcontrol](https://snyk.io/advisor/python/hubitatcontrol/badge.svg)](https://snyk.io/advisor/python/hubitatcontrol)\n![PyPI - Status](https://img.shields.io/pypi/status/hubitatcontrol)\n[![PyPI](https://img.shields.io/pypi/v/hubitatcontrol)](https://pypi.org/project/hubitatcontrol/)\n[![GitHub](https://img.shields.io/github/license/jelloeater/hubitatcontrol)](https://github.com/Jelloeater/hubitatcontrol/blob/main/LICENSE)\n\n## Intro\n\nThis guide assumes you own a **Hubitat Elevation** home automation controller.\n\nIf you are interested in purchasing one, you can purchase a unit from the manufactures website at [hubitat.com](https://hubitat.com/products) or from [Amazon.com](https://www.amazon.com/Hubitat-Elevation-Home-Automation-Hub/dp/B07D19VVTX/)\n\n## Changes\nSee [CHANGELOG.md](CHANGELOG.md) for current changes\n\n## Setup\n\nTo get the required API keys, you will need to log in to your Hubitat admin interface.\n\nSee [Maker API Documentation](https://docs2.hubitat.com/en/apps/maker-api) for how to add the `MakerAPI` application and to generate new API keys\n\nIf 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.\n\n## Install\n\n```shell\npip install hubitatcontrol\n```\n\n**Or if you want a copy direct from source**\n\n```shell\npip install git+https://github.com/Jelloeater/hubitatcontrol.git\n```\n\n## Usage\n\n### API\n**Local Example**\n\n```python\nimport hubitatcontrol as hc\n\nhub = hc.Hub(host='http://192.168.1.100', token='Maker_Token',\napp_id='Maker_App_ID') # Get Hub object to auth and poll against\n\n# If you have a cloud based maker API, you can include the cloud token\n# hub = hc.get_hub(host='https://cloud.hubitat.com', token='Maker_Token',\n#                  app_id='Maker_App_ID', cloud_token='Cloud_API_token')\n\nTEST_DEVICE = '1RGB'\n\ndevice = hc.GetSingleDevice(hub).name(TEST_DEVICE)\n\n# Turn on all the switches (includes lights)\ndevice.turn_on() # Send command to device\nprint(device.switch)\n\n# Get temprature from all sensors\nfor i in hc.GetDevices(hub).TemperatureSensor():\n    print(f\"{i.name} - {i.temperature}\")\n\n```\n\n\n### CLI Interface\n- If you have all the needed API keys added to your .env file, all you need to do is add them to your keyring\n- Once loaded into the keyring, you can run the CLI from anywhere on your system\n\n```bash\nhubitatcontrol --help\nhubitatcontrol load-env-to-keyring\nhubitatcontrol ls\n```\n\n```text\n\u276f hubitatcontrol\n\n Usage: hubitatcontrol [OPTIONS] COMMAND [ARGS]...\n\n Hubitat Control CLI Interface\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --install-completion        [bash|zsh|fish|powershell|pwsh]  Install completion for the specified shell. \u2502\n\u2502                                                              [default: None]                             \u2502\n\u2502 --show-completion           [bash|zsh|fish|powershell|pwsh]  Show completion for the specified shell, to \u2502\n\u2502                                                              copy it or customize the installation.      \u2502\n\u2502                                                              [default: None]                             \u2502\n\u2502 --help                                                       Show this message and exit.                 \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 clear-keyring                      Clear Keyring passwords                                               \u2502\n\u2502 level                              Turn on a device via it's Device ID                                   \u2502\n\u2502 load-env-to-keyring                Load .env file at exec location to keyring                            \u2502\n\u2502 ls                                 Prints current devices from system keyring                            \u2502\n\u2502 off                                Turn on a device via it's Device ID                                   \u2502\n\u2502 on                                 Turn on a device via it's Device ID                                   \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\n Version: 1.1.2   Project: https://github.com/Jelloeater/hubitatcontrol\n```\n\n## Docs\n\n[Located in /docs folder](docs)\n\nYou will need a .dot file browser for the class diagrams\n\n**WIP: Setup ReadTheDocs auto gen**\n\n## Issues / Features\nSee:\n\nhttps://github.com/Jelloeater/hubitatcontrol/issues\n\n## Structure\n\n**Class Model**\n\n```mermaid\nflowchart LR\nSpecific_Device --> Abstract_Device_Class --> Device--> Hub\n```\n\n## Development setup\n\nTesting is done with PyTest, you will need to set up the correct env vars for your local (or cloud) Hubitat API\nSee `.env.example`\n\nIf you are using a local API endpoint, please leave `HUBITAT_CLOUD_ID` blank in the `.env` file.\n\n**Setup**\n\nInstall Go-Task --> <https://taskfile.dev/installation/>\n\n```shell\ntask setup\ntask\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Hubitat Maker API Interface",
    "version": "3.0.1",
    "project_urls": {
        "Documentation": "https://github.com/Jelloeater/hubitatcontrol/tree/main/docs",
        "Homepage": "https://pypi.org/project/hubitatcontrol",
        "Repository": "https://github.com/Jelloeater/hubitatcontrol"
    },
    "split_keywords": [
        "hubitat",
        " makerapi",
        " requests"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "583896f3a8119b9856e04fa869dbfdb631699f9b994251b30607cef9ab3080ca",
                "md5": "964f725e3fc33807b7b57dc094301522",
                "sha256": "330591200d82322eb41eea54db9cbdac5933948630f428c6d3b2786bd640b4b4"
            },
            "downloads": -1,
            "filename": "hubitatcontrol-3.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "964f725e3fc33807b7b57dc094301522",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 9929,
            "upload_time": "2024-08-17T22:00:12",
            "upload_time_iso_8601": "2024-08-17T22:00:12.614078Z",
            "url": "https://files.pythonhosted.org/packages/58/38/96f3a8119b9856e04fa869dbfdb631699f9b994251b30607cef9ab3080ca/hubitatcontrol-3.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9e67fc5bae4d8c1de1309abe29874f0943c086a61716c828373891d4564edd1b",
                "md5": "6677d5f0aaaaa0bda7cc3f65456ed2bf",
                "sha256": "8ced62673bb1568abf2b777f8e3c581d860f1da56651c452624f6bfeaf98acaa"
            },
            "downloads": -1,
            "filename": "hubitatcontrol-3.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6677d5f0aaaaa0bda7cc3f65456ed2bf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 9881,
            "upload_time": "2024-08-17T22:00:14",
            "upload_time_iso_8601": "2024-08-17T22:00:14.209751Z",
            "url": "https://files.pythonhosted.org/packages/9e/67/fc5bae4d8c1de1309abe29874f0943c086a61716c828373891d4564edd1b/hubitatcontrol-3.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-17 22:00:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Jelloeater",
    "github_project": "hubitatcontrol",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hubitatcontrol"
}
        
Elapsed time: 0.28912s