aiolifx-scenes


Nameaiolifx-scenes JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/Djelibeybi/aiolifx-scenes
SummaryAsyncIO library to extract scenes from the LIFX Cloud.
upload_time2023-03-17 08:33:19
maintainer
docs_urlNone
authorAvi Miller
requires_python>=3.9,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aiolifx-scenes

An async library with a single input and a single output.

If you feed it a LIFX Cloud API Personal Access Token (PAT), it will return all the scenes you that token has access to on the LIFX Cloud.


## Usage

To generate a personal access token:

1. visit <https://cloud.lifx.com> and login using the same login credentials that you use for the LIFX smart phone app.
2. Once logged in, click the arrow next to your email in the top right-hand corner of the "Cloud home" page to reveal the menu.
3. With the menu revealed, click the "Personal access tokens" menu item.
4. On the personal access tokens page, click the big blue "Generate new token" button.

Once you have a personal access token, you can install the library:

```bash
$ pip install aiolifx-scenes
```

With the library installed, you can call it from your application:

```python
import aiolifx_scenes

PAT = "personal access token"

scenes = await aiolifx_scenes.async_get_scenes(token=PAT)
```

*Top tip:* use `aiolifx_scenes.get_scenes()` from non-async methods.

## Sanity checks

An extremely basic command-line tool is provided to enable easier sanity checking of your personal access token and existing LIFX scene information.

To use the tool, set the `LIFX_API_TOKEN` environment variable, then run  `lifx-scenes`. If human readability is important to you, consider piping the output through `jq`.

For example:

```bash
$ LIFX_API_TOKEN="your_lifx_api_personal_access_token" lifx-scenes | jq
[
    {
        'uuid': '031f1116-034f-4d92-a1f3-13420e532706',
        'name': 'My Scene',
        'account': {'uuid': 'bda95b31-948c-4c34-a330-c5f0c5eeb2a3'},
        'states': [
            {
                "selector": "id:d073d5xxxxxx",
                "power": "off",
                "brightness": 0.25,
                "color": {
                "hue": 0,
                "saturation": 0,
                "kelvin": 3500
                }
            },
            {
                "selector": "id:d073d5xxxxxx",
                "power": "off",
                "brightness": 0.25,
                "color": {
                "hue": 0,
                "saturation": 0,
                "kelvin": 2500
                }
            }
        ],
        'created_at': 1658591387,
        'updated_at': 1679022191
    }
]
```

## Credits

This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [waynerv/cookiecutter-pypackage](https://github.com/waynerv/cookiecutter-pypackage) project template.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Djelibeybi/aiolifx-scenes",
    "name": "aiolifx-scenes",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Avi Miller",
    "author_email": "me@dje.li",
    "download_url": "https://files.pythonhosted.org/packages/08/78/535f7e5c9ed525694aefeaa66f47fbe755c5fac32eb4178bd8f8ddb89da4/aiolifx_scenes-0.1.0.tar.gz",
    "platform": null,
    "description": "# aiolifx-scenes\n\nAn async library with a single input and a single output.\n\nIf you feed it a LIFX Cloud API Personal Access Token (PAT), it will return all the scenes you that token has access to on the LIFX Cloud.\n\n\n## Usage\n\nTo generate a personal access token:\n\n1. visit <https://cloud.lifx.com> and login using the same login credentials that you use for the LIFX smart phone app.\n2. Once logged in, click the arrow next to your email in the top right-hand corner of the \"Cloud home\" page to reveal the menu.\n3. With the menu revealed, click the \"Personal access tokens\" menu item.\n4. On the personal access tokens page, click the big blue \"Generate new token\" button.\n\nOnce you have a personal access token, you can install the library:\n\n```bash\n$ pip install aiolifx-scenes\n```\n\nWith the library installed, you can call it from your application:\n\n```python\nimport aiolifx_scenes\n\nPAT = \"personal access token\"\n\nscenes = await aiolifx_scenes.async_get_scenes(token=PAT)\n```\n\n*Top tip:* use `aiolifx_scenes.get_scenes()` from non-async methods.\n\n## Sanity checks\n\nAn extremely basic command-line tool is provided to enable easier sanity checking of your personal access token and existing LIFX scene information.\n\nTo use the tool, set the `LIFX_API_TOKEN` environment variable, then run  `lifx-scenes`. If human readability is important to you, consider piping the output through `jq`.\n\nFor example:\n\n```bash\n$ LIFX_API_TOKEN=\"your_lifx_api_personal_access_token\" lifx-scenes | jq\n[\n    {\n        'uuid': '031f1116-034f-4d92-a1f3-13420e532706',\n        'name': 'My Scene',\n        'account': {'uuid': 'bda95b31-948c-4c34-a330-c5f0c5eeb2a3'},\n        'states': [\n            {\n                \"selector\": \"id:d073d5xxxxxx\",\n                \"power\": \"off\",\n                \"brightness\": 0.25,\n                \"color\": {\n                \"hue\": 0,\n                \"saturation\": 0,\n                \"kelvin\": 3500\n                }\n            },\n            {\n                \"selector\": \"id:d073d5xxxxxx\",\n                \"power\": \"off\",\n                \"brightness\": 0.25,\n                \"color\": {\n                \"hue\": 0,\n                \"saturation\": 0,\n                \"kelvin\": 2500\n                }\n            }\n        ],\n        'created_at': 1658591387,\n        'updated_at': 1679022191\n    }\n]\n```\n\n## Credits\n\nThis package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [waynerv/cookiecutter-pypackage](https://github.com/waynerv/cookiecutter-pypackage) project template.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "AsyncIO library to extract scenes from the LIFX Cloud.",
    "version": "0.1.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e45b569cccb74ba6841eea0b4d3c496a519ec887546dff5177bbf1042b004a27",
                "md5": "50f5815e36756e789053c390fc9ef3aa",
                "sha256": "5e1101cd32ee5b16531e0c613ff961997d4ca8a9db898a41646fe7913a8542b1"
            },
            "downloads": -1,
            "filename": "aiolifx_scenes-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "50f5815e36756e789053c390fc9ef3aa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 4496,
            "upload_time": "2023-03-17T08:33:18",
            "upload_time_iso_8601": "2023-03-17T08:33:18.089481Z",
            "url": "https://files.pythonhosted.org/packages/e4/5b/569cccb74ba6841eea0b4d3c496a519ec887546dff5177bbf1042b004a27/aiolifx_scenes-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0878535f7e5c9ed525694aefeaa66f47fbe755c5fac32eb4178bd8f8ddb89da4",
                "md5": "f826ae8de808f68ef0c6378fe9b612de",
                "sha256": "770b2f50dacf9c25dea018cb2206bb92d528ef0b838edf76f8fcd1591dd1ac4b"
            },
            "downloads": -1,
            "filename": "aiolifx_scenes-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f826ae8de808f68ef0c6378fe9b612de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 3767,
            "upload_time": "2023-03-17T08:33:19",
            "upload_time_iso_8601": "2023-03-17T08:33:19.755055Z",
            "url": "https://files.pythonhosted.org/packages/08/78/535f7e5c9ed525694aefeaa66f47fbe755c5fac32eb4178bd8f8ddb89da4/aiolifx_scenes-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-17 08:33:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Djelibeybi",
    "github_project": "aiolifx-scenes",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aiolifx-scenes"
}
        
Elapsed time: 0.08070s