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

11 KiB

Table of Contents

yahuelib

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.

check_reachable

def check_reachable() -> bool

Check if the light is reachable

check_on

def check_on() -> bool

Check if the light is on

set_on

def set_on(on: bool)

Turn the light on/off

get_brightness

def get_brightness() -> int

Get the brightness

set_brightness

def set_brightness(brightness: int)

Set the brightness (0 - 254)

get_hue

def get_hue() -> int

Get the hue

set_hue

def set_hue(hue: int)

Set the hue (0 - 65535)

get_saturation

def get_saturation() -> int

Get the saturation

set_saturation

def set_saturation(saturation: int)

Set the saturation (0 - 254)

get_color_temperature

def get_color_temperature() -> int

Get the white color temperature in Mired

set_color_temperature

def set_color_temperature(mired: int)

Set the white color temperature in Mired (154 - 500)

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.

check_any_on

def check_any_on() -> bool

Check if any light in this group is on

check_all_on

def check_all_on() -> bool

Check if all lights in this group are on

set_all_on

def set_all_on(on: bool)

Turn on/off all lights in this group

get_brightness

def get_brightness()

Get the last set brightness in this group

set_brightness

def set_brightness(brightness: int)

Set the brightness (0 - 254) of all lights in this group

get_hue

def get_hue() -> int

Get the last set hue in this group

set_hue

def set_hue(hue: int)

Set the hue (0 - 65535) of all lights in this group

get_saturation

def get_saturation() -> int

Get the last set saturation in this group

set_saturation

def set_saturation(saturation: int)

Set the saturation (0 - 254) of all lights in this group

get_color_temperature

def get_color_temperature() -> int

Get the last set white color temperature in Mired

set_color_temperature

def set_color_temperature(mired: int)

Set the white color temperature in Mired (154 - 500) for all lights in this group

alert

def alert()

Flash all lights in the group once.

alert_long

def alert_long()

Flash all lights in the group for 10 seconds.

MotionSensor Objects

class MotionSensor(_BaseController)

check_on

def check_on() -> bool

Check if the sensor is on

set_on

def set_on(on: bool)

Turn the sensor on/off

check_reachable

def check_reachable() -> bool

Check if the sensor is reachable

get_battery

def get_battery() -> int

Get the current charge of the battery in percent

get_sensitivity

def get_sensitivity() -> int

Get the sensitivity of the sensor

set_sensitivity

def set_sensitivity(sensitivity: int)

Set the sensitivity of the sensor

get_sensitivitymax

def get_sensitivitymax() -> int

Get the maximum sensititvity of the sensor

check_ledindication

def check_ledindication() -> bool

Check if the LED indication is turned on or off

set_ledindication

def set_ledindication(on: bool)

Turn the LED indicator on/off

get_presence

def get_presence() -> bool

Check if the motion sensor detected the presence of someone in it's reach

yahuelib.utils

rgb_to_hsv

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

Convert RGB colors (255, 220, 100) to Philips Hue's hue, saturation and brightness values (8456, 154, 254) imprecisely

kelvin_to_mired

def kelvin_to_mired(kelvin: int)

Convert the color temperature from Kelvin to Mired

yahuelib.exceptions

DeviceNotFound Objects

class DeviceNotFound(Exception)

DeviceNotFound Exception

APIError Objects

class APIError(Exception)

Generic APIError Exception