Class UpdateState

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

public class UpdateState
extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • on

      public UpdateState on()
      Makes this state turn the light(s) on.
      Returns:
      This state, for easy chaining of different methods.
      See Also:
      off(), on(boolean)
    • off

      public UpdateState off()
      Makes this state turn the light(s) off.
      Returns:
      This state, for easy chaining of different methods.
      See Also:
      on(), on(boolean)
    • on

      public UpdateState on​(boolean on)
      Toggles the on/off status of the light(s).
      Parameters:
      on - true to turn on, false to turn off.
      Returns:
      This state, for easy chaining of different methods.
      See Also:
      on(), off()
    • brightness

      public UpdateState brightness​(int brightness)
      Parameters:
      brightness - Brightness, from 0 to 100, 0 setting brightness to the lowest possible value.
      Returns:
      This state, for easy chaining of different methods.
    • color

      public UpdateState color​(Color color)
      One way of setting the color of the light(s).
      Parameters:
      color - A Color object to specify a color.
      Returns:
      This state, for easy chaining of different methods.
      See Also:
      xy(float, float)
    • xy

      public UpdateState xy​(float x, float y)
      Other way of setting the color of the light(s): CIE XY gamut position.
      Parameters:
      x - A value from 0 to 1.
      y - A value from 0 to 1.
      Returns:
      This state, for easy chaining of different methods.
      See Also:
      color(Color)
    • effect

      public UpdateState effect​(EffectType effectType)
      Starts an effect, or stops it with the EffectType.NO_EFFECT. Note that not all lights, not even all the color ones, support effects. You may check the supported effects with the Light.getSupportedEffects() method. Also note that rooms and zones do not support effects.
      Parameters:
      effectType - Type of effect.
      Returns:
      This state, for easy chaining of different methods.
    • alert

      public UpdateState alert()
      Alerts, i.e. flashes the light a few times.
      Returns:
      This state, for easy chaining of different methods.
    • sunrise

      public UpdateState sunrise​(Duration duration)

      Starts the timed sunrise effect. The maximum duration is six hours. The timed effect may be stopped with the clearTimedEffect() method.

      Note that not all lights, not even all the color ones, support timed effects. Also note that rooms and zones do not support timed effects.

      Parameters:
      duration - Duration of the sunrise effect.
      Returns:
      This state, for easy chaining of different methods.
      See Also:
      clearTimedEffect()
    • clearTimedEffect

      public UpdateState clearTimedEffect()

      Stops the timed effect.

      Note that not all lights, not even all the color ones, support timed effects. Also note that rooms and zones do not support timed effects.

      Returns:
      This state, for easy chaining of different methods.
      See Also:
      sunrise(Duration)
    • timedEffect

      public UpdateState timedEffect​(TimedEffectType effect, Duration duration)

      Starts a timed effect. As of December 2022, "sunrise" and "no effect" are the only two options that the Bridge offers. There are helper methods for both of those in this class, but this method exists here for extra convenience so that you can start and stop the effect with the same method, just changing the parameters.

      Note that not all lights, not even all the color ones, support timed effects. Also note that rooms and zones do not support timed effects.

      Parameters:
      effect - Type of the effect.
      duration - How long should the effect last.
      Returns:
      This state, for easy chaining of different methods.
      See Also:
      sunrise(Duration), clearTimedEffect()
    • gradient

      public UpdateState gradient​(List<Color> colors)
      Gradient color setting, for lights that support gradients. There must be exactly two, three, four, or five colors in the list.
      Parameters:
      colors - A List of Color objects to specify the colors. List length must be between 2 and 5, inclusive.
      Returns:
      This state, for easy chaining of different methods.