Package io.github.zeroone3010.yahueapi
Interface Light
public interface Light
A single Philips Hue -compatible light. Could be a bulb, a ceiling fixture, a LED strip, or anything in between.
Even remote controlled wall sockets are considered as "lights" by the Hue Bridge.
-
Method Summary
Modifier and Type Method Description java.lang.StringgetId()Returns the technical id of the light, as assigned by the Bridge.java.lang.IntegergetMaxLumens()Returns the maximum number of lumens that this light is capable of emitting, if the light reports such a number.java.lang.StringgetName()Returns the name of the light, as set by the user.StategetState()Gets the state of the light -- or returns the cached state if caching has been enabled withHue.setCaching(boolean).LightTypegetType()Returns info on the type of the light.booleanisOn()Queries the light state -- or returns the cached state if caching has been enabled withHue.setCaching(boolean).booleanisReachable()Queries the reachability of the light -- or returns the cached state if caching has been enabled withHue.setCaching(boolean).voidsetBrightness(int brightness)Sets the brightness of the light.voidsetState(State state)Sets a state for the light.voidturnOff()Turns the light off.voidturnOn()Turns the light on.
-
Method Details
-
getId
java.lang.String getId()Returns the technical id of the light, as assigned by the Bridge. The id stays the same even if the light name is changed by the user.
Note that the id is only unique within the context of a single bridge.
- Returns:
- Id of the light.
- Since:
- 2.4.0
-
getName
java.lang.String getName()Returns the name of the light, as set by the user.- Returns:
- Name of the light.
-
turnOn
void turnOn()Turns the light on. -
turnOff
void turnOff()Turns the light off. -
isOn
boolean isOn()Queries the light state -- or returns the cached state if caching has been enabled withHue.setCaching(boolean).- Returns:
- True if the light is on, false if it is off.
-
isReachable
boolean isReachable()Queries the reachability of the light -- or returns the cached state if caching has been enabled withHue.setCaching(boolean).- Returns:
- True if the light is reachable, false if it is not.
-
setBrightness
void setBrightness(int brightness)Sets the brightness of the light. If the light is off, does not turn it on, nor does0turn it off.- Parameters:
brightness- A value from0(minimum brightness) to254(maximum brightness).
-
getType
LightType getType()Returns info on the type of the light.- Returns:
- An enum value specifying the color and dimming capabilities of the light.
-
setState
Sets a state for the light.- Parameters:
state- A state to be set for this light.
-
getState
State getState()Gets the state of the light -- or returns the cached state if caching has been enabled withHue.setCaching(boolean).- Returns:
- The current state of the light.
-
getMaxLumens
java.lang.Integer getMaxLumens()Returns the maximum number of lumens that this light is capable of emitting, if the light reports such a number. This method will returnnullfor, for example, smart plugs.- Returns:
- Maximum lumens that this light is capable of emitting, or null if unknown or undefined.
- Since:
- 2.4.0
-