API for Keepsmile, LuckyStyle, Leeleberd, and related smart lights
Project description
Cheshire
API for Keepsmile and related Bluetooth LE lights.
Usage
The example below scans for Bluetooth LE devices and tries to control any which are supported.
For more detailed instructions, see the user guide.
import asyncio
from bleak import BleakScanner, BleakClient
from cheshire.compiler.state import LightState
from cheshire.generic.command import *
from cheshire.hal.devices import Connection, connect_to_ble_device
async def main():
# Discover Bluetooth LE devices
discover = await BleakScanner.discover()
connections: list[Connection] = []
# Connect to supported devices
for bleak_device in discover:
if bleak_device.name == None:
continue
# Connect to this device if it's one we support
if connection := await connect_to_ble_device(bleak_device):
print(f"Connected to {bleak_device.name}")
connections.append(connection)
async def send_all(state: LightState):
# Push light state to connected devices
for c in connections:
await c.apply(state)
# Update desired light state
state = LightState()
state.update(SwitchCommand(on=True))
state.update(BrightnessCommand(0x30))
state.update(RGBCommand(0x0e, 0x0, 0xaa))
# state.update(EffectCommand(Effect.JUMP_7))
await send_all(state)
asyncio.run(main())
Supported Devices
Device | Bluetooth Name | Support |
---|---|---|
Keepsmile Led Strip Lights | KS03-XXXX | Yes |
Keepsmile Led Strip Lights (New) | KS03~XXXX | Yes |
Keepsmile Double Side Lighting Led Floor Lamp | ? | Unknown |
luckystyle Floor Lamp | KS01-XXXX | Untested |
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
cheshire-0.5.6.tar.gz
(8.0 kB
view details)
Built Distribution
cheshire-0.5.6-py3-none-any.whl
(12.6 kB
view details)
File details
Details for the file cheshire-0.5.6.tar.gz
.
File metadata
- Download URL: cheshire-0.5.6.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7b7665ec76bb156cd2e5aae34bf7ff028d1682de37f6a463e1b05e932d66fd2 |
|
MD5 | 2784cd98e752e4c45950cf9f9d307c6d |
|
BLAKE2b-256 | 7b40b3d772dbdd46283d4b618eb1ec9ecda697032d528043faedf84982fe0a75 |
File details
Details for the file cheshire-0.5.6-py3-none-any.whl
.
File metadata
- Download URL: cheshire-0.5.6-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2984b17e8fd557a1b5ef479b1b759405c351711de10a845767d93694cdc79be |
|
MD5 | 8a8cf3e7e3a7f07d150ae5133532709c |
|
BLAKE2b-256 | b5d54dae0d1d8405e402d92c3266676c6e5bfe6e68d0a5c59afc37d3798c32f6 |