Skip to main content

API for Keepsmile, LuckyStyle, Leeleberd, and related smart lights

Project description

Cheshire Cat

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cheshire-1.0.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cheshire-1.0.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file cheshire-1.0.0.tar.gz.

File metadata

  • Download URL: cheshire-1.0.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cheshire-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5692efc7a75688f3b074387839c5f6fad5c2607631ffa889d8cb842124654cd4
MD5 d5e1a8bc7c1db2c1e1ff8614a5794c17
BLAKE2b-256 7e9159133191699d5ba2a10bd263d18bf36a321e6915915bb019f7f25c487d85

See more details on using hashes here.

File details

Details for the file cheshire-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cheshire-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cheshire-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 111a06511466760f4efa76d84136afb7305ce1dc296e9d57e19087511717189e
MD5 e6f2849835d7e9a23015f9c7f0a51396
BLAKE2b-256 2756dff57e236dd9c950c86687bf09b06c0701eb07a033dac295a7ac3f893593

See more details on using hashes here.

Supported by

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