adafruit_hue

CircuitPython helper library for the Philips Hue

  • Author(s): Brent Rubell

Implementation Notes

Software and Dependencies:

class adafruit_hue.Bridge(wifi_manager: HTTPProtocol, bridge_ip: str | None = None, username: str | None = None)

HTTP Interface for interacting with a Philips Hue Bridge.

create_group(lights: List[str | int], group_id: str) Any

Creates a new group containing the lights specified and optional name. :param list lights: List of light identifiers. :param str group_id: Optional group name.

discover_bridge() str

Discovers Philips Hue Bridge IP from the hosted broker discovery service. Returns the bridge’s IP address.

get_groups() Any

Returns all the light groups available for a bridge.

get_light(light_id: int | str) str

Gets the attributes and state of a provided light. :param int|str light_id: Light identifier.

get_lights() Any

Returns all the light resources available for a bridge.

get_scenes() Any

Returns a list of all scenes currently stored in the bridge.

register_username() str

Attempts to register a Hue application username for use with your bridge. Provides a 30 second delay to press the link button on the bridge. Returns username or None.

static rgb_to_hsb(rgb: Sequence[int]) Sequence[int]

Returns RGB values as a HSL tuple. :param list rgb: RGB Values

set_group(group_id: int | str, **kwargs) Any

Allows the user to turn the light on and off, modify the hue and effects. :param int|str group_id: Group identifier. You can pass the following as (optional) valid kwargs into this method: :param bool on: On/Off state of the light :param int bri: Brightness value of the light (1 to 254) :param int hue: Hue value to set the light to (0 to 65535) :param int sat: Saturation of the light (0 to 254) (more settings at https://developers.meethue.com/develop/hue-api/lights-api/#set-light-state )

set_light(light_id: int | str, **kwargs) str

Allows the user to turn the light on and off, modify the hue and effects. You can pass the following as valid kwargs into this method: :param int|str light_id: Light identifier :param bool on: On/Off state of the light :param int bri: Brightness value of the light, 0-100% (1 to 254) :param int hue: Hue value to set the light, in degrees (0 to 360) (0 to 65535) :param int sat: Saturation of the light, 0-100% (0 to 254) (more settings at: https://developers.meethue.com/develop/hue-api/lights-api/#set-light-state )

set_scene(group_id: int | str, scene_id: str) None

Sets a group scene. :param int|str group_id: the group identifier :param str scene: The scene identifier

show_light_info(light_id: int | str) str

Gets the attributes and state of a given light. :param int|str light_id: Light identifier.

toggle_light(light_id: int | str) str

Gets and toggles the current state of a specified light. :param int|str light_id: Light identifier.