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_no_bleak_limit-0.5.7.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

cheshire_no_bleak_limit-0.5.7-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file cheshire_no_bleak_limit-0.5.7.tar.gz.

File metadata

  • Download URL: cheshire_no_bleak_limit-0.5.7.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for cheshire_no_bleak_limit-0.5.7.tar.gz
Algorithm Hash digest
SHA256 37e6246fa70fbfdb55bb765ce07c950581606248b423df8cdfe78d23234acbaa
MD5 68758a5c53f549a2ca06538c69f73302
BLAKE2b-256 8939dca0695900970e143bb009eea1fba2dacd540694db5414ad98d93bedf9f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for cheshire_no_bleak_limit-0.5.7.tar.gz:

Publisher: python-publish.yml on Shaderhoth/cheshire

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cheshire_no_bleak_limit-0.5.7-py3-none-any.whl.

File metadata

File hashes

Hashes for cheshire_no_bleak_limit-0.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 78c31934757f9b28f9a0ed5fa4e8d471c7cfb4dd30525458d00ed88b1071284f
MD5 d7c33995f5f767d15d8713f22de81ba9
BLAKE2b-256 b369e654af412c0010f262b1d29aa808edb2edaad1236aadbf97eec43003f797

See more details on using hashes here.

Provenance

The following attestation bundles were made for cheshire_no_bleak_limit-0.5.7-py3-none-any.whl:

Publisher: python-publish.yml on Shaderhoth/cheshire

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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