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).
Protocol
3
3
Length
230
23 bytes
Type
380
38 (Button Press)
Header Count
30
3
Header Types
5151
5, 15, 1
Method
13
3 (SUBSCRIBE)
Storage Level
110
10 (RAM)
Message ID
4240205250100
1694158320
Payload Count
00
0
Checksum
20053
13768
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.
Protocol
3
3
Length
290
29 bytes
Type
380
38 (Button Press)
Header Count
10
1
Header Types
1
1
Message ID
473000
73
Payload Count
30
3
Payload Types
123
1, 2, 3
Button ID
12
2 (Down_Right)
Duration
414100
270
Page ID
11
1
Checksum
232189
48616
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.
Protocol
3
3
Length
320
32 bytes
Type
380
38 (Button Press)
Header Count
10
1
Header Types
1
1
Message ID
472000
72
Payload Count
40
4
Payload Types
1234
1, 2, 3, 4
Button ID
10
0 (Action)
Duration
471100
327
Page ID
115
15
Menu Item
11
1
Checksum
10757
14699

Code ​

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