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
Hashes for aiolifx_scenes-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e1101cd32ee5b16531e0c613ff961997d4ca8a9db898a41646fe7913a8542b1 |
|
MD5 | 50f5815e36756e789053c390fc9ef3aa |
|
BLAKE2b-256 | e45b569cccb74ba6841eea0b4d3c496a519ec887546dff5177bbf1042b004a27 |