hubitatcontrol


Namehubitatcontrol JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/Jelloeater/hubitatcontrol
SummaryHubitat Maker API Interface
upload_time2023-05-31 05:04:21
maintainer
docs_urlNone
authorJesse Schoepfer
requires_python>=3.10,<4.0
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://github.com/Jelloeater/hubitatcontrol",
    "name": "hubitatcontrol",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "hubitat,makerapi,requests",
    "author": "Jesse Schoepfer",
    "author_email": "jelloeater@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/9b/08/da1f888f8ec204bdf7b8fdb201fe9e07f17a4ab3e54f932eb736e9143dcb/hubitatcontrol-3.0.0.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.0",
    "project_urls": {
        "Homepage": "https://github.com/Jelloeater/hubitatcontrol"
    },
    "split_keywords": [
        "hubitat",
        "makerapi",
        "requests"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f62b1b4388ef5502d70d0d21ac1d0bf665d8a371c78335d18fa22ad61824ab8b",
                "md5": "b9eb566d69d08ac1c635dd6d06d92198",
                "sha256": "1eb08f79eac4f4aedcf1e36651dbad08d5fcaca2d8ffd8b96ee2f6e783a9b404"
            },
            "downloads": -1,
            "filename": "hubitatcontrol-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9eb566d69d08ac1c635dd6d06d92198",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 9885,
            "upload_time": "2023-05-31T05:04:19",
            "upload_time_iso_8601": "2023-05-31T05:04:19.869686Z",
            "url": "https://files.pythonhosted.org/packages/f6/2b/1b4388ef5502d70d0d21ac1d0bf665d8a371c78335d18fa22ad61824ab8b/hubitatcontrol-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9b08da1f888f8ec204bdf7b8fdb201fe9e07f17a4ab3e54f932eb736e9143dcb",
                "md5": "a33fea765361d6e46517f4e648900b3b",
                "sha256": "f4872da03e052491aa58714a581793365ebf13171933e8e971bc445fb907123b"
            },
            "downloads": -1,
            "filename": "hubitatcontrol-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a33fea765361d6e46517f4e648900b3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 9861,
            "upload_time": "2023-05-31T05:04:21",
            "upload_time_iso_8601": "2023-05-31T05:04:21.631212Z",
            "url": "https://files.pythonhosted.org/packages/9b/08/da1f888f8ec204bdf7b8fdb201fe9e07f17a4ab3e54f932eb736e9143dcb/hubitatcontrol-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-31 05:04:21",
    "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.07512s