38: Button Press
Press of a device button
Header
| Field | Name | Description | Type |
|---|---|---|---|
| 5 | Method | Request a service to be perform an action Possible values:
| uint8 |
Payload
| Field | Name | Description | Type | Unit |
|---|---|---|---|---|
| 1 | Button ID | ID 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:
| uint8 | |
| 2 | Duration | Duration of the button press in ms | uint32 | |
| 3 | Page ID | ID of the page the button was on when pressed, if the device has a screen. | uint8 | |
| 4 | Menu Item | ID 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
📡 Real example from RH2 ESP32 Toit on 2025-10-10This example is captured from an RH2 device as part of normal communications over I2C with the ESP32 co-processor, where Toit on the ESP32 has subscribed to button events from the RH2.
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
📡 Real example from RH2 P1 v2300 on 2025-10-16This example is captured from an RH2 device as part of normal communications over I2C with the ESP32 co-processor, after button events were subscribed to, and the right button was pressed.
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
📡 Real example from RH2 P1 v2300 on 2025-10-16This example is captured from an RH2 device as part of normal communications over I2C with the ESP32 co-processor, after button events were subscribed to.
Code
For convenience, the following constants can be used to reference this message type.