aioketraapi


Nameaioketraapi JSON
Version 0.1.12 PyPI version JSON
download
home_pagehttps://github.com/s4v4g3/aio-ketra-api.git
SummaryKetra Lighting API
upload_time2023-11-21 18:47:06
maintainer
docs_urlNone
authorJoe Savage
requires_python>=3.6
license
keywords openapi openapi-generator ketra lighting api
VCS
bugtrack_url
requirements certifi six python_dateutil setuptools urllib3
Travis-CI
coveralls test coverage No coveralls.
            # aioketraapi
aiohttp-based Python Client SDK for controlling Ketra lighting products.   Based on Ketra API documentation available
[here](https://s3.amazonaws.com/ketra-software/KetraMobileAPI/v1/KetraN4APIoverview.pdf).

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.4.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Python 3.6+

## Installation & Usage
### pip install

You can install from pypi using:

```sh
pip install aioketraapi
```

Or, you can install directly from github using:

```sh
pip install git+https://github.com/s4v4g3/aio-ketra-api.git
```

Note that in either case you may need to run `pip` with root permission: `sudo pip install aioketraapi` or `sudo pip install git+https://github.com/s4v4g3/aio-ketra-api.git`


Then import the package:
```python
import aioketraapi
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import aioketraapi
```

## Getting Started

In order to use this package you will need to contact Ketra Support and get assigned a client_id and client_secret.

### Authentication

You will only need to obtain a single access token for a given user account; at present the access tokens do not expire.

```python

import asyncio
from aioketraapi.oauth import OAuthTokenResponse

async def main():

    client_id = 'YOUR CLIENT ID'
    client_secret = 'YOUR CLIENT SECRET'
    username = '<your Ketra Design Studio username here>'
    password = '<your Ketra Design Studio password here>'

    oauth_token = await OAuthTokenResponse.request_token(client_id, client_secret, username, password)
    access_token = oauth_token.access_token
    print(f"My access token is {access_token}")

if __name__ == '__main__':
    asyncio.run(main())

```

### Usage

```python
import asyncio
from aioketraapi.n4_hub import N4Hub
from aioketraapi.models.lamp_state import LampState

async def main():

    # Find the installation id for your installation by logging into https://my.goketra.com
    # and finding your installation in the list and going to the “Details” page for your
    # installation. The installation id is displayed in the URL of this page, for example
    # a URL of https://my.goketra.com/installations/0fbcada7-b318-4d29-858c1ea3ac1fd5cb
    # would indicate an installation id of “0fbcada7-b318-4d29-858c1ea3ac1fd5cb”
    installation_id = 'my-installation-id'

    # Use the access token received from the authentication step above
    access_token = 'access token received from authentication step'

    # Set to False to access your installation directly through your local network,
    # set to True to access your installation through the cloud (requires remote access
    # to be enabled in Design Studio for the installation)
    use_cloud = False
    hub = await N4Hub.get_hub(installation_id,
                              access_token,
                              use_cloud=use_cloud)

    # get the keypads in the installation and print all button names
    keypads = await hub.get_keypads()
    for keypad in keypads:
        for button in keypad.buttons:
            print(button.scene_name)
            # activate the "Natural" button on the "Kitchen" keypad
            if button.scene_name == "Kitchen Natural":
                await button.activate()

    # get the groups in the installation and print all group names
    groups = await hub.get_groups()
    for group in groups:
        print(group.name)
        # Control the "Office" group
        if group.name == "Office":
            await group.set_state(LampState(transition_time=13000, cct=2000, brightness=0.95, power_on=True))


if __name__ == '__main__':
    asyncio.run(main())
```

## License

The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/s4v4g3/aio-ketra-api.git",
    "name": "aioketraapi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "OpenAPI,OpenAPI-Generator,Ketra Lighting API",
    "author": "Joe Savage",
    "author_email": "joe@savage.zone",
    "download_url": "https://files.pythonhosted.org/packages/61/b3/93384bd453682a90499498ee22ffff22d53aedf360be8bad71ce25b5b170/aioketraapi-0.1.12.tar.gz",
    "platform": null,
    "description": "# aioketraapi\r\naiohttp-based Python Client SDK for controlling Ketra lighting products.   Based on Ketra API documentation available\r\n[here](https://s3.amazonaws.com/ketra-software/KetraMobileAPI/v1/KetraN4APIoverview.pdf).\r\n\r\nThis Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:\r\n\r\n- API version: 1.4.0\r\n- Package version: 1.0.0\r\n- Build package: org.openapitools.codegen.languages.PythonClientCodegen\r\n\r\n## Requirements.\r\n\r\nPython 3.6+\r\n\r\n## Installation & Usage\r\n### pip install\r\n\r\nYou can install from pypi using:\r\n\r\n```sh\r\npip install aioketraapi\r\n```\r\n\r\nOr, you can install directly from github using:\r\n\r\n```sh\r\npip install git+https://github.com/s4v4g3/aio-ketra-api.git\r\n```\r\n\r\nNote that in either case you may need to run `pip` with root permission: `sudo pip install aioketraapi` or `sudo pip install git+https://github.com/s4v4g3/aio-ketra-api.git`\r\n\r\n\r\nThen import the package:\r\n```python\r\nimport aioketraapi\r\n```\r\n\r\n### Setuptools\r\n\r\nInstall via [Setuptools](http://pypi.python.org/pypi/setuptools).\r\n\r\n```sh\r\npython setup.py install --user\r\n```\r\n(or `sudo python setup.py install` to install the package for all users)\r\n\r\nThen import the package:\r\n```python\r\nimport aioketraapi\r\n```\r\n\r\n## Getting Started\r\n\r\nIn order to use this package you will need to contact Ketra Support and get assigned a client_id and client_secret.\r\n\r\n### Authentication\r\n\r\nYou will only need to obtain a single access token for a given user account; at present the access tokens do not expire.\r\n\r\n```python\r\n\r\nimport asyncio\r\nfrom aioketraapi.oauth import OAuthTokenResponse\r\n\r\nasync def main():\r\n\r\n    client_id = 'YOUR CLIENT ID'\r\n    client_secret = 'YOUR CLIENT SECRET'\r\n    username = '<your Ketra Design Studio username here>'\r\n    password = '<your Ketra Design Studio password here>'\r\n\r\n    oauth_token = await OAuthTokenResponse.request_token(client_id, client_secret, username, password)\r\n    access_token = oauth_token.access_token\r\n    print(f\"My access token is {access_token}\")\r\n\r\nif __name__ == '__main__':\r\n    asyncio.run(main())\r\n\r\n```\r\n\r\n### Usage\r\n\r\n```python\r\nimport asyncio\r\nfrom aioketraapi.n4_hub import N4Hub\r\nfrom aioketraapi.models.lamp_state import LampState\r\n\r\nasync def main():\r\n\r\n    # Find the installation id for your installation by logging into https://my.goketra.com\r\n    # and finding your installation in the list and going to the \u201cDetails\u201d page for your\r\n    # installation. The installation id is displayed in the URL of this page, for example\r\n    # a URL of https://my.goketra.com/installations/0fbcada7-b318-4d29-858c1ea3ac1fd5cb\r\n    # would indicate an installation id of \u201c0fbcada7-b318-4d29-858c1ea3ac1fd5cb\u201d\r\n    installation_id = 'my-installation-id'\r\n\r\n    # Use the access token received from the authentication step above\r\n    access_token = 'access token received from authentication step'\r\n\r\n    # Set to False to access your installation directly through your local network,\r\n    # set to True to access your installation through the cloud (requires remote access\r\n    # to be enabled in Design Studio for the installation)\r\n    use_cloud = False\r\n    hub = await N4Hub.get_hub(installation_id,\r\n                              access_token,\r\n                              use_cloud=use_cloud)\r\n\r\n    # get the keypads in the installation and print all button names\r\n    keypads = await hub.get_keypads()\r\n    for keypad in keypads:\r\n        for button in keypad.buttons:\r\n            print(button.scene_name)\r\n            # activate the \"Natural\" button on the \"Kitchen\" keypad\r\n            if button.scene_name == \"Kitchen Natural\":\r\n                await button.activate()\r\n\r\n    # get the groups in the installation and print all group names\r\n    groups = await hub.get_groups()\r\n    for group in groups:\r\n        print(group.name)\r\n        # Control the \"Office\" group\r\n        if group.name == \"Office\":\r\n            await group.set_state(LampState(transition_time=13000, cct=2000, brightness=0.95, power_on=True))\r\n\r\n\r\nif __name__ == '__main__':\r\n    asyncio.run(main())\r\n```\r\n\r\n## License\r\n\r\nThe library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Ketra Lighting API",
    "version": "0.1.12",
    "project_urls": {
        "Homepage": "https://github.com/s4v4g3/aio-ketra-api.git"
    },
    "split_keywords": [
        "openapi",
        "openapi-generator",
        "ketra lighting api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4eb6a2aea7731752c19f3a67950af0f9d3ca93c6f69c2f0cf68616dc71bc13f4",
                "md5": "ff9018cfa659823926b1f489ce974ba3",
                "sha256": "ec6a1c6d24523890f8987c016dad354e2202479be2574a9014c173ae592a86e1"
            },
            "downloads": -1,
            "filename": "aioketraapi-0.1.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ff9018cfa659823926b1f489ce974ba3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 103577,
            "upload_time": "2023-11-21T18:47:03",
            "upload_time_iso_8601": "2023-11-21T18:47:03.877429Z",
            "url": "https://files.pythonhosted.org/packages/4e/b6/a2aea7731752c19f3a67950af0f9d3ca93c6f69c2f0cf68616dc71bc13f4/aioketraapi-0.1.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "61b393384bd453682a90499498ee22ffff22d53aedf360be8bad71ce25b5b170",
                "md5": "bfbf56f60b51b9b5e8e43c0104b8764e",
                "sha256": "89ed545a0a40e3e2a1dcd0f9d3861684d43c382ddf2a31b68cff69e354d52a4c"
            },
            "downloads": -1,
            "filename": "aioketraapi-0.1.12.tar.gz",
            "has_sig": false,
            "md5_digest": "bfbf56f60b51b9b5e8e43c0104b8764e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 55684,
            "upload_time": "2023-11-21T18:47:06",
            "upload_time_iso_8601": "2023-11-21T18:47:06.594952Z",
            "url": "https://files.pythonhosted.org/packages/61/b3/93384bd453682a90499498ee22ffff22d53aedf360be8bad71ce25b5b170/aioketraapi-0.1.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-21 18:47:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "s4v4g3",
    "github_project": "aio-ketra-api",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "certifi",
            "specs": [
                [
                    ">=",
                    "14.05.14"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    ">=",
                    "1.10"
                ]
            ]
        },
        {
            "name": "python_dateutil",
            "specs": [
                [
                    ">=",
                    "2.5.3"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "21.0.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    ">=",
                    "1.15.1"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "aioketraapi"
}
        
Elapsed time: 0.18618s