Hue.Room (Hue v0.2.0)

Copy Markdown View Source

Rooms, addressed by name.

:ok = Hue.Room.set(bridge, "Living Room", on: false)

A room is not what accepts the write

A room has no on state of its own. What responds is the grouped_light service the room owns, and set/3 walks there for you. get/2 deliberately returns the room — that is what you asked for — so if you want the group's current brightness, read it with Hue.Bridge.grouped_light/3 instead.

An empty room owns no grouped_light at all, and set/3 returns {:error, %Hue.Error{reason: :no_grouped_light}} rather than inventing one. Two of the six rooms on the reference bridge are in exactly that state.

Options are Hue.Light's, checked against the group rather than a single bulb, plus :await and :await_timeout — see Hue.Bridge.await_write/5.

Summary

Functions

Fetches one room by name or rid.

Every room the bridge knows about.

Queues a change to every light in a room. See Hue.Light for options.

Functions

get(bridge, target)

@spec get(atom(), String.t()) :: {:ok, map()} | {:error, Hue.Error.t()}

Fetches one room by name or rid.

list(bridge)

@spec list(atom()) :: {:ok, [map()]} | {:error, Hue.Error.t()}

Every room the bridge knows about.

set(bridge, target, options)

@spec set(atom(), String.t(), keyword()) :: :ok | {:error, Hue.Error.t()}

Queues a change to every light in a room. See Hue.Light for options.