public final class Hue extends Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
Hue.HueBridgeConnectionBuilder |
| Constructor | Description |
|---|---|
Hue(HueBridgeProtocol protocol,
String bridgeIp,
String apiKey) |
A basic constructor for initializing the Hue Bridge connection for this library.
|
Hue(String bridgeIp,
String apiKey) |
The basic constructor for initializing the Hue Bridge connection for this library.
|
| Modifier and Type | Method | Description |
|---|---|---|
Collection<DaylightSensor> |
getDaylightSensors() |
Returns all the daylight sensors configured into the Bridge.
|
Optional<DimmerSwitch> |
getDimmerSwitchByName(String switchName) |
Returns a specific dimmer switch by its name.
|
Collection<DimmerSwitch> |
getDimmerSwitches() |
Returns all the dimmer switches configured into the Bridge.
|
Collection<Room> |
getGroupsOfType(GroupType... groupTypes) |
Returns all groups of lights that match any of the specified group types.
|
Optional<MotionSensor> |
getMotionSensorByName(String sensorName) |
Returns a specific motion sensor by its name.
|
Collection<MotionSensor> |
getMotionSensors() |
Returns all the motion sensors configured into the Bridge.
|
Root |
getRaw() |
Returns the raw root node information of the REST API.
|
Optional<Room> |
getRoomByName(String roomName) |
Returns a specific room by its name.
|
Collection<Room> |
getRooms() |
Returns all the rooms configured into the Bridge.
|
Optional<TemperatureSensor> |
getTemperatureSensorByName(String sensorName) |
Returns a specific temperature sensor by its name.
|
Collection<TemperatureSensor> |
getTemperatureSensors() |
Returns all the temperature sensors configured into the Bridge.
|
Collection<Sensor> |
getUnknownSensors() |
Returns all the sensors configured into the Bridge.
|
Optional<Room> |
getZoneByName(String zoneName) |
Returns a specific zone by its name.
|
Collection<Room> |
getZones() |
Returns all the zones configured into the Bridge.
|
static Hue.HueBridgeConnectionBuilder |
hueBridgeConnectionBuilder(String bridgeIp) |
The method to be used if you do not have an API key for your application yet.
|
boolean |
isCaching() |
Tells whether this instance caches the states of objects, such as lights.
|
void |
refresh() |
Refreshes the room, lamp, etc.
|
void |
setCaching(boolean enabled) |
Controls whether cached states of objects, such as lights, should be used.
|
public Hue(String bridgeIp, String apiKey)
hueBridgeConnectionBuilder method if you do not have an API key yet.bridgeIp - The IP address of the Hue Bridge.apiKey - The API key of your application.public Hue(HueBridgeProtocol protocol, String bridgeIp, String apiKey)
hueBridgeConnectionBuilder method if you do not have an API key yet.protocol - The desired protocol for the Bridge connection. HTTP or UNVERIFIED_HTTPS,
as the certificate that the Bridge uses cannot be verified. Defaults to HTTP
when using the other constructor.bridgeIp - The IP address of the Hue Bridge.apiKey - The API key of your application.public void setCaching(boolean enabled)
Controls whether cached states of objects, such as lights, should be used.
Off (false) by default. If set on (true), querying light states will
NOT actually relay the query to the Bridge. Instead, it uses the state that was valid
when this method was called, or the state that was valid when subsequent calls to
the refresh() method were made.
One should use caching when performing multiple queries in a quick succession, such as when querying the states of all the individual lights in a Hue setup.
If caching is already on and you try to enable it again, this method does nothing. Similarly nothing happens if caching is already disabled and one tries to disable it again.
enabled - Set to true to have the lights cache their results from the Bridge.
Remember to call refresh() first when you need to retrieve the
absolutely current states.public boolean isCaching()
true if cached results are returned, false if all queries are directed to the Bridge.public void refresh()
setCaching(boolean) method. Calls to refresh()
will, in that case, refresh the states of the lights.public Collection<Room> getGroupsOfType(GroupType... groupTypes)
groupTypes - Type or types of groups to get.public Collection<Room> getRooms()
getGroupsOfType(GroupType...) with value GroupType.ROOM.public Collection<Room> getZones()
getGroupsOfType(GroupType...) with value GroupType.ZONE.public Optional<Room> getRoomByName(String roomName)
roomName - The name of a roomOptional.empty() if a room with the given name does not exist.public Optional<Room> getZoneByName(String zoneName)
zoneName - The name of a zoneOptional.empty() if a zone with the given name does not exist.public Root getRaw()
Hue was constructed).
To refresh the cache call the refresh() method.public Collection<Sensor> getUnknownSensors()
public Collection<TemperatureSensor> getTemperatureSensors()
public Collection<DimmerSwitch> getDimmerSwitches()
public Collection<MotionSensor> getMotionSensors()
public Collection<DaylightSensor> getDaylightSensors()
public Optional<TemperatureSensor> getTemperatureSensorByName(String sensorName)
sensorName - The name of a sensorOptional.empty() if a sensor with the given name does not exist.public Optional<MotionSensor> getMotionSensorByName(String sensorName)
sensorName - The name of a sensorOptional.empty() if a sensor with the given name does not exist.public Optional<DimmerSwitch> getDimmerSwitchByName(String switchName)
switchName - The name of a switchOptional.empty() if a dimmer switch with the given name does not exist.public static Hue.HueBridgeConnectionBuilder hueBridgeConnectionBuilder(String bridgeIp)
HueBridgeConnectionBuilder that initializes the process of
adding a new application to the Bridge.bridgeIp - The IP address of the Bridge.Copyright © 2020. All rights reserved.