Skip to content

38: Button Press

Press of a device button

FieldNameDescriptionType
5MethodRequest a service to be perform an action
Possible values:
  • 1: SET— Set one or more values that are provided in the message payload.
  • 2: GET— Get values for the associated message type.
  • 3: SUBSCRIBE— Subscribe to values for the associated message type. Can be used in conjunction with other header fields to define the subscription parameters, such as Interval, Duration, Timeout, Storage Level and Message Level. If no interval is provided, messages will be sent as and when new data is available. Some data, such as GPS position, may require a set interval to be provided.
  • 5: UNSUBSCRIBE— Unsubscribe from a previous subscription.
uint8
This is an extract of header fields that are relevant to this message type, you can find them all documented in the Headers section.

Payload

FieldNameDescriptionTypeUnit
1Button IDID of the button.
Zero indexed.

Devices may have buttons in different locations, however the following is a common layout:
0 = Action button (usually center)
1 = Left / Up button
2 = Right / Down button

Possible values:
  • 0: Action
  • 1: Up_Left
  • 2: Down_Right
uint8
2DurationDuration of the button press in msuint32
3Page IDID of the page the button was on when pressed, if the device has a screen.uint8
4Menu ItemID of the menu item the button was on when pressed, if the device has a screen and a menu was showing.
Zero indexed.
uint8

Examples

Subscribe to button events
A client might subscribe to the button press events of a Lightbug Device forever (or until unsubscribing).
Button 2 press event of 270ms
At the end of a button press, the device will send a message with the button ID and duration of the press.
Button 0 pressed on page 15, with menu item 1 selected.
If the device is on a menu page, the menu item will be included.

Code

For convenience, the following constants can be used to reference this message type.