Class GroupImpl

java.lang.Object
io.github.zeroone3010.yahueapi.v2.GroupImpl
All Implemented Interfaces:
Group

public class GroupImpl
extends Object
implements Group
  • Constructor Details

  • Method Details

    • getId

      public UUID getId()
      Description copied from interface: Group

      Returns the technical id of the room, zone, or light group, as assigned by the Bridge. The id stays the same even if the room name is changed by the user.

      Specified by:
      getId in interface Group
      Returns:
      Id of the room/zone/light group.
    • getName

      public String getName()
      Description copied from interface: Group
      Returns the name of the room or zone, as set by the user.
      Specified by:
      getName in interface Group
      Returns:
      Name of the room or zone.
    • getScenes

      public List<Scene> getScenes()
      Description copied from interface: Group
      Lists all scenes that can be used with this group.
      Specified by:
      getScenes in interface Group
      Returns:
      List of scenes.
    • getSceneByName

      public Optional<Scene> getSceneByName​(String sceneName)
      Description copied from interface: Group
      Returns the scene matching the given human-readable name, if one exists.
      Specified by:
      getSceneByName in interface Group
      Parameters:
      sceneName - The human-readable name of the scene
      Returns:
      Optional Scene
    • getLights

      public Collection<Light> getLights()
      Description copied from interface: Group
      Returns all the lights that have been assigned to this group.
      Specified by:
      getLights in interface Group
      Returns:
      A Collection of Light objects.
    • getLightByName

      public Optional<Light> getLightByName​(String lightName)
      Description copied from interface: Group
      Returns one light, if found by the given name.
      Specified by:
      getLightByName in interface Group
      Parameters:
      lightName - Name of a light in this group.
      Returns:
      Optional.empty() if a light is not found by this name, an Optional<Light> if it is.
    • getType

      public ResourceType getType()
      Description copied from interface: Group
      Returns the type of this group, whether it is a room, zone, or grouped light.
      Specified by:
      getType in interface Group
      Returns:
      The type of this group of lights.
    • isAnyOn

      public boolean isAnyOn()
      Description copied from interface: Group
      Queries the state of the group of lights.
      Specified by:
      isAnyOn in interface Group
      Returns:
      True if any light is on in this group, false if not.
    • turnOn

      public void turnOn()
      Description copied from interface: Group
      Turns the lights on.
      Specified by:
      turnOn in interface Group
    • turnOff

      public void turnOff()
      Description copied from interface: Group
      Turns the lights off.
      Specified by:
      turnOff in interface Group
    • setBrightness

      public void setBrightness​(int brightness)
      Description copied from interface: Group
      Sets the brightness of the lights. If the lights are off, does not turn them on, nor does 0 turn them off.
      Specified by:
      setBrightness in interface Group
      Parameters:
      brightness - A value from 1 (minimum brightness) to 100 (maximum brightness).
    • setState

      public void setState​(UpdateState state)
      Description copied from interface: Group
      Sets a state for the light.
      Specified by:
      setState in interface Group
      Parameters:
      state - A state to be set for this light.
    • addLight

      public Collection<Light> addLight​(Light newLight)
      Description copied from interface: Group
      Adds the given light into this group. Note that if the light already belongs to a room, you must remove it from there first, or this operation will fail!
      Specified by:
      addLight in interface Group
      Parameters:
      newLight - The light to be added
      Returns:
      A Collection of Lights in this group after the operation.
    • removeLight

      public Collection<Light> removeLight​(Light lightToBeRemoved)
      Description copied from interface: Group
      Removes the given light from this group.
      Specified by:
      removeLight in interface Group
      Parameters:
      lightToBeRemoved - The light to be removed
      Returns:
      A Collection of Lights in this group after the operation.
    • toString

      public String toString()
      Overrides:
      toString in class Object