Interface Button


public interface Button
A button of a Switch.
  • Method Summary

    Modifier and Type Method Description
    int getNumber()
    The number of this button in a switch.
    java.util.List<ButtonEvent> getPossibleEvents()
    A list of events that may be performed with the button.
  • Method Details

    • getNumber

      int getNumber()

      The number of this button in a switch.

      For a Philips Hue dimmer switch,
      1 is the ON button,
      2 is the button that makes the lights brighter,
      3 is the button that makes the lights dimmer, and
      4 is the OFF button.

      For a Philips Hue Tap switch,
      1 is the button with one dot,
      2 is the button with two dots,
      3 is the button with three dots, and
      4 is the button with four dots.

      Other devices, such as the Friends of Hue ones, will have their buttons in some order that one just needs to find out by pushing each one and looking at the result of the Switch.getLatestEvent() method after each push.

      Furthermore, some devices may have "virtual" buttons that this library cannot know about. These devices include at least the Senic Friends of Hue switch that has two rocker keys, i.e. four physical buttons. However, when one pushes both rockers up (or down) simultaneously, the device logs events from virtual buttons "5" and "6", which are never actually introduced to the Hue Bridge. This library will handle those presses as "button number -1", but one will still be able to tell them apart by inspecting the event code.

      Returns:
      An integer describing the number of this button. If the device does not introduce all of its buttons to the Hue Bridge, such buttons will have the number "-1".
    • getPossibleEvents

      java.util.List<ButtonEvent> getPossibleEvents()
      A list of events that may be performed with the button. The buttons of some devices may produce several kinds of events, while other types might produce only the INITIAL_PRESS event. This list may not be comprehensive, so a button may end up returning events of UNKNOWN type even if they are not listed here.
      Returns:
      A List of ButtonEvent object, describing the types of events that this button may perform. Note that this list may not be comprehensive, as at least some Friends of Hue brand of switches are known to produce events that they do not initially introduce to the Bridge.