Skip to main content

Simple python package to control smart lights using the Triones porotocol

Project description

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.

  • 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.

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.

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

trionesControl-1.0.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

trionesControl-1.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file trionesControl-1.0.0.tar.gz.

File metadata

  • Download URL: trionesControl-1.0.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for trionesControl-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6fef89099a1b02157aaa39208867c1561fef3b48e36ae2ab42bca8d6bd527ffc
MD5 7d314a352c9c8bbcedaf48894aa776a2
BLAKE2b-256 679a0e2178ad4294cf7ebf004ea44076cec45eb7efa6bbefb41d3d3c7e0c2cab

See more details on using hashes here.

File details

Details for the file trionesControl-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: trionesControl-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for trionesControl-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d59f0ed0ac5af3c7dc91e0550680c1ac3010e0709f5616549a394e82fcabc55a
MD5 8905467c8297271f7a5b3ce03af7cadf
BLAKE2b-256 3cca757e6c87eee6bc91fe8d993464463ec7b113bfec59028df5e965dac2b32f

See more details on using hashes here.

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