This repository has been archived on 2025-09-28. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
YaHueLib/DOCUMENTATION.md

8.9 KiB

Table of Contents

yahuelib

yahuelib.utils

rgb_to_hsv

def rgb_to_hsv(r: int, g: int, b: int) -> tuple

Convert RGB colors (255, 220, 100) to HSV (0.129, 0.608, 1.0)

kelvin_to_mired

def kelvin_to_mired(kelvin: int)

Convert the color temperature from Kelvin to Mired

yahuelib.controller

LightController Objects

class LightController(_BaseController)

Control a Philips Hue Light using the API of your Hue Bridge.

Arguments:

  • number: int - The number of your light
  • bridge_ip_address: str - The IP address of your Hue Bridge
  • bridge_api_user: str - The user used to authenticate to the API

Use the class method .from_name(name:str, ...) to use the name of a light instead of the number.

reachable

@property
def reachable() -> bool

Check if the light is reachable using LightController.reachable

on

@property
def on() -> bool

Check if the light is on using LightController.on

on

@on.setter
def on(on: bool)

Turn the light on/off using LightController.on = ...

brightness

@property
def brightness() -> int

Get the brightness using LightController.brightness

brightness

@brightness.setter
def brightness(brightness: float)

Set the brightness using LightController.brightness = ...

hue

@property
def hue() -> int

Get the hue using LightController.hue

hue

@hue.setter
def hue(hue: float)

Set the hue using LightController.hue = ...

saturation

@property
def saturation() -> int

Get the saturation using LightController.saturation

saturation

@saturation.setter
def saturation(saturation: float)

Set the saturation using LightController.saturation = ...

color_temperature

@property
def color_temperature()

Get the white color temperature in Mired using LightController.color_temperature

color_temperature

@color_temperature.setter
def color_temperature(mired: int)

Set the white color temperature in Mired (154 - 500) using LightController.color_temperature = ...

alert

def alert()

Flash the light once.

alert_long

def alert_long()

Flash the light for 10 seconds.

GroupController Objects

class GroupController(_BaseController)

Control a Philips Hue Light Group (Room/Zone) using the API of your Hue Bridge.

Arguments:

  • number: int - The number of your light group
  • bridge_ip_address: str - The IP address of your Hue Bridge
  • bridge_api_user: str - The user used to authenticate to the API

Use the class method .from_name(name:str, ...) to use the name of a group instead of the number.

any_on

@property
def any_on() -> bool

Check if any light in this group is on using GroupController.any_on

all_on

@property
def all_on() -> bool

Check if all lights in this group are on using GroupController.all_on

all_on

@all_on.setter
def all_on(on: bool)

Turn on/off all lights in this group using GroupController.all_on = ...

brightness

@property
def brightness() -> int

Get the last set brightness in this group using GroupController.brightness

brightness

@brightness.setter
def brightness(brightness: float)

Set the brightness of all lights in this group using GroupController.brightness = ...

hue

@property
def hue() -> int

Get the last set hue in this group using GroupController.hue

hue

@hue.setter
def hue(hue: float)

Set the hue of all lights in this group using GroupController.hue = ...

saturation

@property
def saturation() -> int

Get the last set saturation in this group using GroupController.saturation

saturation

@saturation.setter
def saturation(saturation: float)

Set the saturation of all lights in this group using GroupController.saturation = ...

color_temperature

@property
def color_temperature()

Get the last set white color temperature in Mired using GroupController.color_temperature

color_temperature

@color_temperature.setter
def color_temperature(mired: int)

Set the white color temperature in Mired (154 - 500) for all lights in this group using GroupController.color_temperature = ...

alert

def alert()

Flash all lights in the group once.

alert_long

def alert_long()

Flash all lights in the group for 10 seconds.

yahuelib.exceptions

LightOrGroupNotFound Objects

class LightOrGroupNotFound(Exception)

LightOrGroupNotFound Exception

APIError Objects

class APIError(Exception)

Generic APIError Exception