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). 📡 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. 📡 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. 📡 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.