A package to control Kelvin lights using usb or bluetooth. Set cct, hsi, rgb, rgbacl, read out various data and more.
Project description
Kelvin lights interface
This is a python package to interface with Kelvin lights using usb (serial) or bluetooth (experimental). This package is available on PyPI and can be installed with pip. To use it in your project, simply run:
pip install "python4yahdlc@git+https://x-token-auth:ATCTT3xFfGN0ehp5bAN5THYpRflG9MfmPsQODeO_e3B7bUpfvbX8QzITTwh583tovdBv9n3yCQFUfMoZ0sJBO5YyDXY8CDgGoo4T7qEioLbbiRTpHaruRuTYbvcdzwSGSXXFJUukSplZJDbv8fRu3BSp1F1TtNzriPGYzmosQAu2czU2ix19u7Y=B197A1B4@bitbucket.org/riftlabs/python4yahdlc.git@feature/fix_unsized_arrays" k_lights_interface
The official python4yahdlc package causes a segmentation fault on mac/linux which is why this fork must be used.
Features
- Control Kelvin devices. Set brightness, CCT and Duv, RGB, HSI, read out temperatures, voltages, and more.
- Supports Usb (serial) communication using the pyserial package
- Experimental support of BLE communication using the bleak package. Check bleak for hardware requirements.
Interface overview
| Light | Usb | Bluetooth |
|---|---|---|
| Play and Play Pro | Yes | Yes |
| Epos 300 | No | Yes |
| Epos 600 | Yes | Yes |
Usage
Logging
Set your desired log level using the set_log_level function
from k_lights_interface.k_logging import set_log_level, logging
set_log_level(logging.INFO)
Serial usage:
from k_lights_interface.k_serial_manager import KSerialManager
from k_lights_interface.k_logging import set_log_level, logging
set_log_level(logging.INFO)
dev_manager = KSerialManager()
devices = dev_manager.connect_to_all()
[print(dev) for dev in devices]
if (len(devices) == 0):
logging.error("No devices found. Make sure its connected via usb")
exit(1)
# Just use the first device for this example
try:
dev = devices[0]
dev.set_intensity(10)
dev.set_cct(6500, 0)
except Exception as e:
logging.error(f"Failed to set CCT: {e}")
BLE usage (THIS IS VERY EXPERIMENTAL):
import asyncio
from k_lights_interface.k_ble_manager import KBleManager
from k_lights_interface.k_logging import set_log_level, logging
async def main():
set_log_level(logging.INFO)
ble_manager = KBleManager()
devices = await ble_manager.connect_to_all()
if len(devices) == 0:
print("No devices found")
return
print(devices)
ret, device_stats = devices[0].get_device_stats()
print(device_stats)
if __name__ == "__main__":
asyncio.run(main())
print("finished")
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file k_lights_interface-0.2.4.tar.gz.
File metadata
- Download URL: k_lights_interface-0.2.4.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c9a391672ed46ec721596ff2fb0408815fb093f2c85d71c91924691e0a4b7e3
|
|
| MD5 |
e78e7468b4cea91c6cea823a32cb5d5f
|
|
| BLAKE2b-256 |
65ac8c5a3047a6467166098618bb6c3dc8b5f94b3d7c4064609d3dd6e6d2d367
|
File details
Details for the file k_lights_interface-0.2.4-py3-none-any.whl.
File metadata
- Download URL: k_lights_interface-0.2.4-py3-none-any.whl
- Upload date:
- Size: 31.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df1de86cc49d621a66469fbf93cdceaa03d88feba1796edebcd76f7b038ff912
|
|
| MD5 |
e747221a618c26eaa6fb051e5a6c6f7f
|
|
| BLAKE2b-256 |
941507ec4945b8bfe25d8b712258ed9264c865801a5268efb7d3be3a70719529
|