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:
- visit https://cloud.lifx.com and login using the same login credentials that you use for the LIFX smart phone app.
- 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.
- With the menu revealed, click the "Personal access tokens" menu item.
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 770b2f50dacf9c25dea018cb2206bb92d528ef0b838edf76f8fcd1591dd1ac4b |
|
MD5 | f826ae8de808f68ef0c6378fe9b612de |
|
BLAKE2b-256 | 0878535f7e5c9ed525694aefeaa66f47fbe755c5fac32eb4178bd8f8ddb89da4 |
File details
Details for the file aiolifx_scenes-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: aiolifx_scenes-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e1101cd32ee5b16531e0c613ff961997d4ca8a9db898a41646fe7913a8542b1 |
|
MD5 | 50f5815e36756e789053c390fc9ef3aa |
|
BLAKE2b-256 | e45b569cccb74ba6841eea0b4d3c496a519ec887546dff5177bbf1042b004a27 |