Skip to content

Commit 6dab3dd

Browse files
authored
Update Berry.md - Button events
Link to sample code for these not very obvious calls.
1 parent 8102532 commit 6dab3dd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/Berry.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,13 @@ Driver methods are called with the following parameters: `f(cmd, idx, payload, r
390390
- `web_add_button()`: (deprecated) synonym of `web_add_console_button()`
391391
- `web_add_main_button()`, `web_add_management_button()`, `web_add_console_button()`, `web_add_config_button()`: add a button to Tasmota's Web UI on a specific page
392392
- `web_add_handler()`: called when Tasmota web server started, and the right time to call `webserver.on()` to add handlers
393-
- `button_pressed()`: called when a button is pressed
394393
- `save_before_restart()`: called just before a restart
395394
- `mqtt_data(topic, idx, data, databytes)`: called for MQTT payloads matching `mqtt.subscribe`. `idx` is zero, and `data` is normally unparsed JSON.
396395
- `set_power_handler(cmd, idx)`: called whenever a Power command is made. `idx` is a combined index value, with one bit per relay or light currently on. `cmd` can be ignored.
397-
- `any_key(cmd, idx)`: called when an interaction with Button or Switch occurs. `idx` is encoded as follows: `device_save << 24 | key << 16 | state << 8 | device`
398396
- `display()`: called by display driver with the following subtypes: `init_driver`, `model`, `dim`, `power`.
397+
- `button_pressed(cmd, idx)`: called when a button is pressed. See [sample code]([url](https://github.com/arendst/Tasmota/pull/21711#issuecomment-2198649833)).
398+
- `button_multi_pressed(cmd, idx)`: called for button multi-press. See [sample code]([url](https://github.com/arendst/Tasmota/pull/21711#issuecomment-2198649833)).
399+
- `any_key(cmd, idx)`: called when an interaction with Button or Switch occurs. `idx` is encoded as follows: `device_save << 24 | key << 16 | state << 8 | device`<br> See [sample code]([url](https://github.com/arendst/Tasmota/pull/21711#issuecomment-2198649833)).
399400

400401
Then register the driver with `tasmota.add_driver(<driver>)`.
401402

0 commit comments

Comments
 (0)