Class Hue
java.lang.Object
io.github.zeroone3010.yahueapi.v2.Hue
public class Hue extends Object
-
Field Summary
Fields Modifier and Type Field Description static longEVENTS_CONNECTION_TIMEOUT_MINUTESstatic DurationEVENTS_READ_TIMEOUTstatic StringHUE_APPLICATION_KEY_HEADER -
Constructor Summary
-
Method Summary
Modifier and Type Method Description Map<UUID,Light>getLights()Returns all the lights configured into the Bridge.Map<UUID,Device>getMotionSensors()Returns all the motion sensors configured into the Bridge.Optional<Group>getRoomByName(String roomName)Returns a specific room by its name.Map<UUID,Group>getRooms()Returns all the rooms configured into the Bridge.Map<UUID,Switch>getSwitches()Returns all the switches configured into the Bridge.Optional<Group>getZoneByName(String zoneName)Returns a specific zone by its name.Map<UUID,Group>getZones()Returns all the zones configured into the Bridge.static HueBridgeConnectionBuilderhueBridgeConnectionBuilder(String bridgeIp)The method to be used if you do not have an API key for your application yet.voidrefresh()Refreshes the room, lamp, etc.HueEventSourcesubscribeToEvents(HueEventListener eventListener)
-
Field Details
-
HUE_APPLICATION_KEY_HEADER
- See Also:
- Constant Field Values
-
EVENTS_CONNECTION_TIMEOUT_MINUTES
public static final long EVENTS_CONNECTION_TIMEOUT_MINUTES- See Also:
- Constant Field Values
-
EVENTS_READ_TIMEOUT
-
-
Constructor Details
-
Hue
The basic constructor for initializing the Hue Bridge APIv2 connection for this library. Sets up an encrypted but unverified HTTPS connection, as the Bridge uses a self-signed certificate that cannot be verified.- Parameters:
bridgeIp- The IP address of the Hue Bridge.apiKey- The API key of your application.- Since:
- 3.0.0
-
-
Method Details
-
refresh
public void refresh()Refreshes the room, lamp, etc. data from the Hue Bridge, in case it has been updated since the application was started.- Since:
- 3.0.0
-
getLights
Returns all the lights configured into the Bridge.- Returns:
- A Map of lights, the keys being their ids.
-
getSwitches
Returns all the switches configured into the Bridge. Different kinds of switches include, for example, the Philips Hue dimmer switch and the Philips Hue Tap switch.- Returns:
- A Map of switches, the keys being the IDs of the switches.
- Since:
- 3.0.0
-
getMotionSensors
Returns all the motion sensors configured into the Bridge.- Returns:
- A Map of motion sensors, the keys being the IDs of the sensors.
- Since:
- 3.0.0
-
getRooms
Returns all the rooms configured into the Bridge.- Returns:
- A Map of rooms, the keys being the IDs of the rooms.
- Since:
- 3.0.0
-
getZones
Returns all the zones configured into the Bridge.- Returns:
- A Map of zones, the keys being the IDs of the zones.
- Since:
- 3.0.0
-
getRoomByName
Returns a specific room by its name.- Parameters:
roomName- The name of a room- Returns:
- A room or
Optional.empty()if a room with the given name does not exist. - Since:
- 3.0.0
-
getZoneByName
Returns a specific zone by its name.- Parameters:
zoneName- The name of a zone- Returns:
- A zone or
Optional.empty()if a zone with the given name does not exist. - Since:
- 3.0.0
-
subscribeToEvents
-
hueBridgeConnectionBuilder
The method to be used if you do not have an API key for your application yet. Returns aHueBridgeConnectionBuilderthat initializes the process of adding a new application to the Bridge. You can test if you are connecting to a Hue Bridge endpoint before initializing the connection.- Parameters:
bridgeIp- The IP address of the Bridge.- Returns:
- A connection builder that initializes the application for the Bridge.
- Since:
- 3.0.0
-