adafruit_hue
¶
CircuitPython helper library for the Philips Hue
- Author(s): Brent Rubell
Implementation Notes¶
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- Adafruit ESP32SPI or ESP_ATcontrol library:
- https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol
- SimpleIO library:
- https://github.com/adafruit/Adafruit_CircuitPython_SimpleIO
-
class
adafruit_hue.
Bridge
(wifi_manager, bridge_ip=None, username=None)¶ HTTP Interface for interacting with a Philips Hue Bridge.
-
create_group
(lights, group_id)¶ 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
()¶ Discovers Philips Hue Bridge IP from the hosted broker discovery service. Returns the bridge’s IP address.
-
get_groups
()¶ Returns all the light groups available for a bridge.
-
get_light
(light_id)¶ Gets the attributes and state of a provided light. :param int light_id: Light identifier.
-
get_lights
()¶ Returns all the light resources available for a bridge.
-
get_scenes
()¶ Returns a list of all scenes currently stored in the bridge.
-
register_username
()¶ 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)¶ Returns RGB values as a HSL tuple. :param list rgb: RGB Values
-
set_group
(group_id, **kwargs)¶ Allows the user to turn the light on and off, modify the hue and effects. :param int 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, **kwargs)¶ 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 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, scene_id)¶ Sets a group scene. :param str scene: The scene identifier
-
show_light_info
(light_id)¶ Gets the attributes and state of a given light. :param int light_id: Light identifier.
-
toggle_light
(light_id)¶ Gets and toggles the current state of a specified light. :param int light_id: Light identifier.
-