Skip to main content

Python module for controlling and monitoring Bluetooth Philips Hue bulbs

Project description

HueBLE

HueBLE logo

PyPI Status Documentation Status Black

Python module for controlling Bluetooth Philips Hue lights.

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 (24.04)
    • Arch
    • Buildroot (HomeAssistant OS)
  • 🏢 Windows
    • Windows 10
  • 💾 Mac OSX
    • Sequoia (15.7)
  • 🛜 ESPHome (Bluetooth Proxy)
    • ESP32-C3-Super-Mini
    • ESP32-C5-N4R2

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 dbus-fast

Examples

Quick start example

Example code from example.py

[!NOTE] Do not forget to put the light in pairing mode before first connection!

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.

Disclaimer

HueBLE is a software library designed to work with Philips Hue. Philips Hue is a registered trademark of Philips. This project is not affiliated with, endorsed by, or sponsored by Philips (Though I wouldn't mind being sponsored 😉). All other trademarks cited herein are the property of their respective owners.

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

hueble-2.2.2.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

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

hueble-2.2.2-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file hueble-2.2.2.tar.gz.

File metadata

  • Download URL: hueble-2.2.2.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hueble-2.2.2.tar.gz
Algorithm Hash digest
SHA256 e322f46042e3d47d6e23e07ad1891305f4612917238aaf1a98126f00831414ae
MD5 aa678df4a300857d2e1c2cc22753617f
BLAKE2b-256 3f417198545b36313a4bbc013cd2bb2cfb765a5dfc61dfed8bccdc7453115c97

See more details on using hashes here.

Provenance

The following attestation bundles were made for hueble-2.2.2.tar.gz:

Publisher: publish-to-pypi.yml on flip-dots/HueBLE

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hueble-2.2.2-py3-none-any.whl.

File metadata

  • Download URL: hueble-2.2.2-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hueble-2.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a6857f969839fd68b170fd30b5f7d3d68d1cc6aea00580d40ec9949dcb269f68
MD5 54ff74f830b903e5d81df6a729ea7ce4
BLAKE2b-256 18064b4d021616bba5b31081276b07952dabae787608639623c4077bc64478c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hueble-2.2.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on flip-dots/HueBLE

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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