Python module for controlling and monitoring Bluetooth Philips Hue bulbs
Project description
HueBLE
Python module for controlling Bluetooth Philips Hue lights.
- 👌 Free software: MIT license
- 🍝 Sauce: https://github.com/flip-dots/HueBLE
- 🖨️ Documentation: https://hueble.readthedocs.io/en/latest/
- 📦 PIP: https://pypi.org/project/HueBLE/
This Python module enables you to control Philips Hue Bluetooth lights directly from your computer, without the need for a Hue bridge or ZigBee dongle. It leverages the Bleak library to interact with Bluetooth Philips Hue lights.
Features
- 💡 On/Off control
- 🌗 Brightness control
- 🌡️ Colour temp control
- 🌈 XY colour control
- ❔ Light state (power/brightness/temp/colour)
- ⚙️ Light configuration (name)
- 📊 Light metadata (manufacturer/model/zigbee address)
- 🤜 Supports push & polling models
- 🔂 Simple structure
- 📜 Mediocre documentation
- ✔️ More emojis than strictly necessary
Requirements
- 🐍 Python 3.11+
- 📶 Bleak 0.19.0+
- 📶 bleak-retry-connector
Supported Operating Systems
- 🐧 Linux (BlueZ)
- Ubuntu Desktop
- Arch (HomeAssistant OS)
- 🏢 Windows
- Windows 10
- 💾 Mac OSX
- Maybe?
Documentation
https://hueble.readthedocs.io/en/latest/
Installation
PIP
pip install HueBLE
Manual
HueBLE consists of a single file (HueBLE.py) which you can simply put in the same directory as your program. If you are using manual installation make sure the dependencies are installed as well.
pip install bleak bleak-retry-connector
Examples
Quick start example
Example code from example.py
import asyncio
from bleak import BleakScanner
import HueBLE
async def main():
# Address of light to connect to
address = "F6:9B:48:A4:D2:D8"
# Obtain the BLEDevice from bleak
device = await BleakScanner.find_device_by_address(address)
# Initialize the light object
light = HueBLE.HueBleLight(device)
# Optionally we could call connect but it will be called automatically
# on the first request to the light. You might want to call this if
# you want to subscribe to state changes without changing the lights state.
# await light.connect()
# Will automatically connect to the light and turn it off
await light.set_power(False)
# Wait
await asyncio.sleep(5)
# Turn the light back on again
await light.set_power(True)
if __name__ == "__main__":
asyncio.run(main())
Demo program
A more fully featured demo program can be found in examples/demo.py
which demonstrates all of the implemented features.
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
Built Distribution
File details
Details for the file hueble-1.0.6.tar.gz
.
File metadata
- Download URL: hueble-1.0.6.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08c6bde20651ec5c7daf7894a83930ae4519cb231d31718bc1c55df617d1169e |
|
MD5 | 26d85d37b7a1c2f7cbde675d08b5697a |
|
BLAKE2b-256 | 807bc6a34de5aaa0e4036e9d80f2b0edaa5700bdf2a6df530ec4715ae967290b |
File details
Details for the file HueBLE-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: HueBLE-1.0.6-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ed02536efb64d0722de6513da82d68e557bdc88b2118110cdc96451d469b58f |
|
MD5 | 2f1852014a4bc2781410b02c2e2c09df |
|
BLAKE2b-256 | bba2536da85cbf173594a67185f33a26fc7a1b5835b4380eb50c9b6fb0b1f06f |