java.lang.Object
io.github.zeroone3010.yahueapi.v2.Hue

public class Hue
extends Object
  • Field Details

  • Constructor Details

    • Hue

      public Hue​(String bridgeIp, String apiKey)
      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

      public Map<UUID,​Light> getLights()
      Returns all the lights configured into the Bridge.
      Returns:
      A Map of lights, the keys being their ids.
    • getSwitches

      public Map<UUID,​Switch> 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

      public Map<UUID,​Device> 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

      public Map<UUID,​Group> 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

      public Map<UUID,​Group> 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

      public Optional<Group> getRoomByName​(String roomName)
      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

      public Optional<Group> getZoneByName​(String zoneName)
      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

      public HueEventSource subscribeToEvents​(HueEventListener eventListener)
    • hueBridgeConnectionBuilder

      public static HueBridgeConnectionBuilder hueBridgeConnectionBuilder​(String bridgeIp)
      The method to be used if you do not have an API key for your application yet. Returns a HueBridgeConnectionBuilder that 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