Skip to main content

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

Release files for cheshire 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cheshire 1.0.0
File Size Uploaded
cheshire-1.0.0.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cheshire 1.0.0
File Interpreter ABI Platform
cheshire-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / cheshire-1.0.0.tar.gz

Download URL cheshire-1.0.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5692efc7a75688f3b074387839c5f6fad5c2607631ffa889d8cb842124654cd4
BLAKE2b-256 checksum
How to use checksums
7e9159133191699d5ba2a10bd263d18bf36a321e6915915bb019f7f25c487d85
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / cheshire-1.0.0-py3-none-any.whl

Download URL cheshire-1.0.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
111a06511466760f4efa76d84136afb7305ce1dc296e9d57e19087511717189e
BLAKE2b-256 checksum
How to use checksums
2756dff57e236dd9c950c86687bf09b06c0701eb07a033dac295a7ac3f893593
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.1

2 release files

0.3.1

2 release files

0.2.1

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page