hueapi
hueapi
is a Python library for exploring and managing Philips Hue bridges and their associated lights. It is still in active development as of November 28, 2022.
hueapi
makes it easy to manage version-specific (API v1 or v2) functions while also providing a version-agnostic interface (named vunity) for scripts to work with any version.
Installing
hueapi
is currently only packaged as a Nix flake, so it can only be easily installed on NixOS or a system with Nix installed.
To experiment with hueapi
in a terminal without installing:
nix develop git+ssh://git@gitlab.com/keegandahm/hue-api.git
Then you can try it out:
from hueapi.vunity import HueBridgeVunity
bridge = HueBridgeVunity.for_host('Philips-hue', '<hue bridge username>')
for light in bridge.get_lights():
print(f'Found light "{light.get_name()}"')
Found light "Hue color lamp 1"
Found light "Desk Right"
Found light "Desk Left"
Found light "Desk Middle"
To add this flake as an input to your own flake, add the following to your flake.nix
:
{
...
inputs.hueapi.url = "git+ssh://gitlab@ssh.gitlab.vulnix.sh/keegan/hue-api.git";
...
}
For an example of hueapi
being used as a flake input, see the flake.nix
definition for huectl
(coming soon)