philble
philble copied to clipboard
Philips Hue Bluetooth Low Energy (BLE) light client library in Python
philble
Python 3 library to control Philips Hue lights over Bluetooth Low Energy (BLE). Uses
the Adafruit_BluefruitLE
library to issue Bluetooth commands.
- Works on Linux and macOS (tested on 10.14)
- Install:
pip install .
- Minimal working example: See
example.py
- If things go wrong: HOWTO: Factory reset a Hue bulb by Mozilla IOT.

API
See philble/client.py
for commands available and mapping on to the BLE interface.
import philble.client
client = philble.client.Client(device)
-
power(False | True)
-
brightness(1..254)
-
temperature(153...454)
: Color temperature decreases as index increases, for some reason. -
color(hex string)
lightcom
A small demo, providing an IPython
REPL for controlling light fixtures. Modify
config.py
to provide names for your lights. The light client objects are available
in a global variable called l
.

TODO:
- [ ] Figure out which sleeps are due to BLE library oddness and which are due to my sloppy implementation.
- [ ] Read current values for these parameters.
- [ ] Fully understand color code.
- [ ] Provide HSL input for colors - probably easier to reason about for lighting.
- [ ] Save state after lamp power-cycle.
- [ ] Create demo to activate lamps relative to sunrise/sunset.