Welcome to bleak-smlight documentation!

bleak-smlight

CI Status Documentation Status Test coverage percentage CodSpeed Badge

Poetry Ruff pre-commit

PyPI Version Supported Python versions License


Documentation: https://bleak-smlight.readthedocs.io

Source Code: https://github.com/bluetooth-devices/bleak-smlight


A Bleak backend that receives Bluetooth Low Energy advertisements from a SMLIGHT SLZB BLE proxy. The proxy is scan only, so this library registers a non connectable scanner with habluetooth; it does not support GATT connections. The UDP proxy protocol lives in pysmlight, this library is the host side glue that feeds advertisements into Bleak. See the architecture docs for how the pieces fit together.

Usage

import asyncio

import habluetooth

from bleak_smlight import SMLIGHTConnectionManager, SMLIGHTDeviceConfig

DEVICES: list[SMLIGHTDeviceConfig] = [
    {"source": "AA:BB:CC:DD:EE:FF", "name": "slzb-proxy", "host": "10.0.0.5"},
]


async def main() -> None:
    await habluetooth.BluetoothManager().async_setup()
    managers = [SMLIGHTConnectionManager(d) for d in DEVICES]
    await asyncio.gather(*(m.start() for m in managers))
    try:
        await asyncio.Event().wait()  # advertisements now flow into Bleak
    finally:
        await asyncio.gather(*(m.stop() for m in managers))


asyncio.run(main())

Installation

Install this via pip (or your favourite package manager):

pip install bleak-smlight

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

This package was created with Copier and the browniebroke/pypackage-template project template.