trionesControl
This module implements the triones protocol reverse engineered by madhead with python, offering a programmatic way to control these kind of lights without needing the app on your phone. To learn more about the protocol, please read the following specification:
Requirements
This package only works on Linux, it uses pygatt and depends on blueZ.
The package has been tested in python 3 (3.8.5) but it may work on previous versions, even python 2.7, as long as pygatt requirements are met.
Installation
Install trionesControl with pip from PyPI:
pip install trionesControl
This will install all the dependencies used by this package and pexpect, an optional pygatt needed to use it's BlueZ backend.
Documentation
Connexion handling
connect(MAC): Connect to the device with the mac address specified.connect(MAC, False): Connect to the device with the mac address specified and dont reset previous connections for using multiple devices at once.disconnect(device): Disconnects from the specified device.
LED Control
-
powerOn(device): Powers on the device, the LEDs will turn on. -
powerOff(device): Powers off the device, the LEDs will turn off. -
setRGB(r: int, g: int, b: int, device): Sets the LED color configuration of the device to the r, g and b colors. (0-255) -
setWhite(intensity: int, device): Sets the device's LED to white with the specified intensiy. (0-255) -
setBuiltIn(mode: int, speed: int, device): Activates the selected predefined built-in mode at the selected speed (0-255). The built modes go from 37 to 56.
All the functions do not wait for any response from the device by default. This can be overriden by adding an aditional argument set to True.
powerOn(device, True): Powers on the device, the LEDs will turn on and waits for a reponse.
Example use
The unittest code available in tests/test.py can be used as a sample to use the available functions of the package. You can test your bulb / LED strip by using the following code too.
Connect and power on the device
import time
import trionesControl.trionesControl as tc
#Change the mac address to the one of your bulb or LED strip
device = tc.connect('00:00:00:00:00:00')
tc.powerOn(device)
Change colors
# RGB mode
tc.setRGB(100,100,100, device)
time.sleep(1)
tc.setRGB(255, 255, 255, device)
time.sleep(1)
tc.setRGB(255,0,0, device)
time.sleep(1)
tc.setRGB(0,255,0, device)
#White mode
time.sleep(10)
tc.setWhite(255, device)
Built-in modes
#Change built-in modes (37-56)
time.sleep(10)
tc.setBuiltIn(37, 1)
tc.time(10)
Power off and disconnect
tc.powerOff(device)
tc.disconnect(device)
Licence
MIT Licence - Copyright 2020 Aritz Herrero
For more information, check LICENCE file.
Metadata
Release files for trionesControl 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trionesControl-1.2.0.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trionesControl-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / trionesControl-1.2.0.tar.gz
| Download URL | trionesControl-1.2.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15f2ee511ac1bbd05810e79b276787089c1e9e6deee423d82f3f8bf975b4aac6
|
|
BLAKE2b-256 checksum How to use checksums |
5fcfeae0ad34ce1a4da21c5e59434e12e4bc8f52b897371c628e3c847479a90b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
|
Release files / trionesControl-1.2.0-py3-none-any.whl
| Download URL | trionesControl-1.2.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98314503754dadce4c8cb8fc4406a73c8fc7c78013fdaebae4f4c87f321d518d
|
|
BLAKE2b-256 checksum How to use checksums |
48955ecb5e0e62f3565f9c92d45672ba81077bb8943e66bad72734031702d178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
|