The module inspired by trionesControl module from Aritz Herrero. It provides API to control LED devices using triones protocol. The motivation to build this module was to make it cross-platform using BLEAK module instead of pygatt.
Using BLEAK client this module is supposed to support every platform that BLEAK supports:
- Windows 10, version 16299 (Fall Creators Update) or greater
- Linux distributions with BlueZ >= 5.43
- OS X/macOS support via Core Bluetooth API, from at least OS X version 10.11
Install trionesControl
with pip from PyPI:
pip install trionesControl
Or clone this repository and use build
module to generate wheel:
python -m build
Then install it using pip:
pip install dist/%GENERATED_WHEEL_FILE%
Initialize in a similar way to BleakClient using TrionesDevice class:
TrionesDevice(address_or_device: BLEDevice | str, timeout: float = 10,
winrt=None, backend: BaseBleakClient = None,
disconnected_callback: Callable[[BleakClient], None] = None)
Example:
from trionesDevice import TrionesDevice
# Initializing using MAC address
device = TrionesDevice('00:00:00:00:00:00')
connect()
make connection to device specified during initialization.disconnect()
disconnect from previously connected device.
power(on: bool=True)
turn the device on or off depending on boolean used as a parameter.setRGB(r: int, g: int, b: int)
set color.getStatus() -> TrionesDeviceStatus
returns instance of TrionesDeviceStatus which contains such fields as:power: bool
red: int
green: int
blue: int
MIT Licence - Copyright 2023 Bukreev Dmitriy
For more information, check LICENCE file.