Skip to main content

AsyncIO library to extract scenes from the LIFX Cloud.

Project description

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:

$ pip install aiolifx-scenes

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

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:

$ 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 and the waynerv/cookiecutter-pypackage project template.

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

aiolifx_scenes-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

aiolifx_scenes-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file aiolifx_scenes-0.1.0.tar.gz.

File metadata

  • Download URL: aiolifx_scenes-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for aiolifx_scenes-0.1.0.tar.gz
Algorithm Hash digest
SHA256 770b2f50dacf9c25dea018cb2206bb92d528ef0b838edf76f8fcd1591dd1ac4b
MD5 f826ae8de808f68ef0c6378fe9b612de
BLAKE2b-256 0878535f7e5c9ed525694aefeaa66f47fbe755c5fac32eb4178bd8f8ddb89da4

See more details on using hashes here.

File details

Details for the file aiolifx_scenes-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aiolifx_scenes-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e1101cd32ee5b16531e0c613ff961997d4ca8a9db898a41646fe7913a8542b1
MD5 50f5815e36756e789053c390fc9ef3aa
BLAKE2b-256 e45b569cccb74ba6841eea0b4d3c496a519ec887546dff5177bbf1042b004a27

See more details on using hashes here.

Supported by

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