Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 2.61 KB

File metadata and controls

80 lines (60 loc) · 2.61 KB

Huey

Service to control Hue Bluetooth lights using the HueBLE library (big thanks to the author!) through a UNIX socket.

Its main purpose is to pair it with HueyUI, so lights can be controlled through a webinterface.

Usage

Turn on all the lights you want to connect to and run the discover.py script. This will create the address-list.txt file from which the server.py script will read which lights to connect to when it starts.

Run the server.py script to start the service. It will open a UNIX socket at ./var/huey.sock, which you can write commands to and read results from.

Commands

list

Returns a JSON string containing data about the state of all known lights.

It's an array containing an item for each light, that's structured like this:

{
    "address",
    "name",
    "is_in_temperature_mode",
    "is_available",
    "is_powered_on",
    "brightness",
    "temperature",
    "min_temperature",
    "max_temperature",
    "color": {
        "x",
        "y"
    }
}

[address]|poll

Polls the light associated with [address] for data about its current state.

[address]|info

Returns data about the light's state in a JSON string (same as list, but for a single light).

[address]|power|[power_state]

Turns the light on (power_state=true) or off (power_state=false)

[address]|brightness|[brightness_level]

Sets the brightness level. Valid range for brightness_level: 0-255

[address]|temperature|[temperature_level]

Sets the light's color temperature. Range is min_temperature-max_temperature for each light.

[address]|color|[x]|[y]

Sets the light's color using XY color coordinates (X and Y range is 0.0-1.0)

[address]|connect

Explicitly connects to the light.

[address]|name|[new_name]

Sets the name of the light.

Other scripts

set.py

Allows you to send commands to the service from the terminal as they are described above.

info.py [address]

Gets the light's state data from the service.

Note

If Huey is having trouble connecting to your lights, you might need to reset them first.

I was able to do this by powering them on (8 sec) and off (2 sec) a couple of times in a row, until they start blinking, indicating that they have been reset.

I don't know if this is the recommended way of resetting lights or if this works for all Hue lights. So use this method at your own risk!

Disclaimer

I made this (mostly) as a learning exercise. It works well enough for my purposes, but YMMV.

The docs here are hastily written and might contain errors.

It's likely this won't receive updates or bug fixes.