huex v0.8.0 Huex View Source

Elixir client for Philips Hue connected light bulbs.

  • Query functions return the response from the API.
  • Command functions return a Bridge struct in order to be pipeline friendly.

Read more on the GitHub page.

Link to this section Summary

Types

Application and device identifier used for authorization. Either a “app-name#device-name” string or {“app-name”, “device-name”} tuple

Group identifier can be either a numberic or a binary (e.g. “1”). Special group 0 always contains all the lights

Tuple containing respectively the hue (0-65535), staturation (0-255) and value/brillance (0-255) components

Light identifier can be either a numberic or a binary (e.g. “1”)

Scene identifier for a bridge

Possible status of a Bridge

Tuple containing the x (0-0.8) and y (0-0.8) component of the color

Functions

Requests authorization for the given devicetype on the given bridge. Returns an “authorized” connection

Creates a connection with the bridge available on the given host or IP address. Username can be obtained using authorize/2

Fetches all informations available about the given group connected to the bridge. Requires the connection to be authorized

Lists the light groups configured for the given bridge. Requires the connection to be authorized

Fetches all informations available in the bridge

Fetches all informations available about the given light connected to the bridge. Requires the connection to be authorized

Lists the lights connected to the given bridge. Requires the connection to be authorized

Fetches all informations available about the given scene connected to the bridge. Requires the connection to be authorized

Lists the scenes setup in the given bridge. Requires the connection to be authorized

Sets the brigthness of the given light (a value between 0 and 1). Requires the connection to be authorized

Sets the brigthness of the given light (a value between 0 and 1) using the given transition time (in ms). Requires the connection to be authorized

Sets the color of the given light using Philips’ proprietary bi-dimensional color space. Requires the connection to be authorized

Sets the color of the given light using Philips’ proprietary bi-dimensional color space using the given transition time (in ms). Requires the connection to be authorized

Sets the brigthness of the given group (a value between 0 and 1). Requires the connection to be authorized

Sets the brigthness of the given group (a value between 0 and 1) using the given transition time (in ms). Requires the connection to be authorized

Sets the color of the given group using Philips’ proprietary bi-dimensional color space. Requires the connection to be authorized

Sets the color of the given group using Philips’ proprietary bi-dimensional color space using the given transition time (in ms). Requires the connection to be authorized

Sets the state of the given group. For a list of accepted keys, look at the state object in the response of group_info Requires the connection to be authorized

Sets the state of the given light. For a list of accepted keys, look at the state object in the response of light_info Requires the connection to be authorized

Turns the given group off. Requires the connection to be authorized

Turns the given group off using the given transition time (in ms). Requires the connection to be authorized

Turns the given group on. Requires the connection to be authorized

Turns the given group on using the given transition time (in ms). Requires the connection to be authorized

Turns the given light off. Requires the connection to be authorized

Turns the given light off using the given transition time (in ms). Requires the connection to be authorized

Turns the given light on. Requires the connection to be authorized

Turns the given light on using the given transition time (in ms). Requires the connection to be authorized

Link to this section Types

Link to this type devicetype() View Source
devicetype() :: binary() | {binary(), binary()}

Application and device identifier used for authorization. Either a “app-name#device-name” string or {“app-name”, “device-name”} tuple

Group identifier can be either a numberic or a binary (e.g. “1”). Special group 0 always contains all the lights.

Tuple containing respectively the hue (0-65535), staturation (0-255) and value/brillance (0-255) components

Light identifier can be either a numberic or a binary (e.g. “1”)

Scene identifier for a bridge

Link to this type status() View Source
status() :: nil | :ok | :error

Possible status of a Bridge

Link to this type xy_color() View Source
xy_color() :: {float(), float()}

Tuple containing the x (0-0.8) and y (0-0.8) component of the color

Link to this section Functions

Link to this function authorize(bridge, devicetype) View Source
authorize(Huex.Bridge.t(), devicetype()) :: Huex.Bridge.t()

Requests authorization for the given devicetype on the given bridge. Returns an “authorized” connection.

Bridge authorization is a one-time process per devicetype and goes as follow:

  1. Press the link button on your bridge device
  2. Call authorize to obtain a random username for the given devicetype
  3. The bridge username will be set and the returned bridge can now be used to issue queries and commands
  4. Store the username to reuse it with connect/2 next time your interact with this bridge
Link to this function connect(host, username \\ nil) View Source
connect(binary(), binary()) :: Huex.Bridge.t()

Creates a connection with the bridge available on the given host or IP address. Username can be obtained using authorize/2.

Link to this function group_info(bridge, group) View Source
group_info(Huex.Bridge.t(), group()) :: Map.t()

Fetches all informations available about the given group connected to the bridge. Requires the connection to be authorized.

Lists the light groups configured for the given bridge. Requires the connection to be authorized.

Fetches all informations available in the bridge.

Link to this function light_info(bridge, light) View Source
light_info(Huex.Bridge.t(), light()) :: Map.t()

Fetches all informations available about the given light connected to the bridge. Requires the connection to be authorized.

Lists the lights connected to the given bridge. Requires the connection to be authorized.

Link to this function scene_info(bridge, scene) View Source
scene_info(Huex.Bridge.t(), scene()) :: Map.t()

Fetches all informations available about the given scene connected to the bridge. Requires the connection to be authorized

Lists the scenes setup in the given bridge. Requires the connection to be authorized

Link to this function set_brightness(bridge, light, brightness) View Source
set_brightness(Huex.Bridge.t(), light(), float()) :: Huex.Bridge.t()

Sets the brigthness of the given light (a value between 0 and 1). Requires the connection to be authorized.

Link to this function set_brightness(bridge, light, brightness, transition_time_ms) View Source
set_brightness(Huex.Bridge.t(), light(), float(), non_neg_integer()) ::
  Huex.Bridge.t()

Sets the brigthness of the given light (a value between 0 and 1) using the given transition time (in ms). Requires the connection to be authorized.

Link to this function set_color(bridge, light, arg) View Source
set_color(Huex.Bridge.t(), light(), hsv_color()) :: Huex.Bridge.t()
set_color(Huex.Bridge.t(), light(), xy_color()) :: Huex.Bridge.t()

Sets the color of the given light using Philips’ proprietary bi-dimensional color space. Requires the connection to be authorized.

Link to this function set_color(bridge, light, arg, transition_time_ms) View Source

Sets the color of the given light using Philips’ proprietary bi-dimensional color space using the given transition time (in ms). Requires the connection to be authorized.

Link to this function set_group_brightness(bridge, group, brightness) View Source
set_group_brightness(Huex.Bridge.t(), group(), float()) :: Huex.Bridge.t()

Sets the brigthness of the given group (a value between 0 and 1). Requires the connection to be authorized.

Link to this function set_group_brightness(bridge, group, brightness, transition_time_ms) View Source
set_group_brightness(Huex.Bridge.t(), group(), float(), non_neg_integer()) ::
  Huex.Bridge.t()

Sets the brigthness of the given group (a value between 0 and 1) using the given transition time (in ms). Requires the connection to be authorized.

Link to this function set_group_color(bridge, group, arg) View Source
set_group_color(Huex.Bridge.t(), group(), hsv_color()) :: Huex.Bridge.t()
set_group_color(Huex.Bridge.t(), group(), xy_color()) :: Huex.Bridge.t()

Sets the color of the given group using Philips’ proprietary bi-dimensional color space. Requires the connection to be authorized.

Link to this function set_group_color(bridge, group, arg, transition_time_ms) View Source
set_group_color(Huex.Bridge.t(), group(), hsv_color(), non_neg_integer()) ::
  Huex.Bridge.t()
set_group_color(Huex.Bridge.t(), group(), xy_color(), non_neg_integer()) ::
  Huex.Bridge.t()

Sets the color of the given group using Philips’ proprietary bi-dimensional color space using the given transition time (in ms). Requires the connection to be authorized.

Link to this function set_group_state(bridge, group, new_state) View Source
set_group_state(Huex.Bridge.t(), group(), Map.t()) :: Huex.Bridge.t()

Sets the state of the given group. For a list of accepted keys, look at the state object in the response of group_info Requires the connection to be authorized.

Link to this function set_state(bridge, light, new_state) View Source
set_state(Huex.Bridge.t(), light(), Map.t()) :: Huex.Bridge.t()

Sets the state of the given light. For a list of accepted keys, look at the state object in the response of light_info Requires the connection to be authorized.

Link to this function turn_group_off(bridge, group) View Source
turn_group_off(Huex.Bridge.t(), group()) :: Huex.Bridge.t()

Turns the given group off. Requires the connection to be authorized.

Link to this function turn_group_off(bridge, group, transition_time_ms) View Source
turn_group_off(Huex.Bridge.t(), group(), non_neg_integer()) :: Huex.Bridge.t()

Turns the given group off using the given transition time (in ms). Requires the connection to be authorized.

Link to this function turn_group_on(bridge, group) View Source
turn_group_on(Huex.Bridge.t(), group()) :: Huex.Bridge.t()

Turns the given group on. Requires the connection to be authorized.

Link to this function turn_group_on(bridge, group, transition_time_ms) View Source
turn_group_on(Huex.Bridge.t(), group(), non_neg_integer()) :: Huex.Bridge.t()

Turns the given group on using the given transition time (in ms). Requires the connection to be authorized.

Link to this function turn_off(bridge, light) View Source
turn_off(Huex.Bridge.t(), light()) :: Huex.Bridge.t()

Turns the given light off. Requires the connection to be authorized.

Link to this function turn_off(bridge, light, transition_time_ms) View Source

Turns the given light off using the given transition time (in ms). Requires the connection to be authorized.

Turns the given light on. Requires the connection to be authorized.

Link to this function turn_on(bridge, light, transition_time_ms) View Source

Turns the given light on using the given transition time (in ms). Requires the connection to be authorized.