I’m stuck trying to figure out how to use Keypads for navigating/controlling LVGL pages/widgets as they are documented here but I am not able to find any example code or reference in the source. I have declared a bunch of physical buttons on my device as binary_sensor and can use these for basic page navigation but the documentation suggests more detailed control options. Using encoders would provide a significantly smaller subset of my available buttons. Is this a feature that has yet to be added or am I missing something?
If navigation is working, what’s not working for you? What are you expecting, or trying to achieve?
With “basic page navigation” i meant changing pages using actions like below which is working fine but rather limited in flexibility as I haven’t found a way to re purpose buttons depending on the current widget/page/context:
binary_sensor:
- platform: mch2022_rp2040
input: button_home
id: buttonHOME
on_press:
then:
- lvgl.page.show:
id: main_page
animation: MOVE_BOTTOM
time: 800ms
- platform: mch2022_rp2040
input: button_menu
id: buttonMENU
on_press:
then:
- lvgl.page.previous:
animation: MOVE_RIGHT
time: 800ms
And I am able to define 3 binary sensors as an encoder like this:
lvgl:
encoders:
enter_button: buttonACCEPT
sensor:
left_button: joystickLEFT
right_button: joystickRIGHT
but as I have lots more physical buttons available I would like to define more as part of the lvgl keypads feature, something like:
lvgl:
keypads:
up: joystickUP
down: joystickDOWN
left: joystickLEFT
right: joystickRIGHT
backspace: buttonBACK
but this results in the error:
[keypads] is an invalid option for [lvgl]. Please check the indentation.
I would like to use the full set of keys and joystick (total of 11 binary_sensors) on my device to navigate grids vertically, use the keyboard widget, interact with button matrices, etc without having add actions to the binary_sensor configurations but interact with LVGL natively just like the encoders feature but then with more keys. Again, maybe I am just not understanding the feature correct but the list of configurable buttons in the keypads section of the main configuration paragraph of the component doc suggests there’s more keypad functionality at the same “level” like encoders and touch screens.
I hope that clarifies my questions better. Thanks for your help!
That’s fixed in the current beta (and dev branch.) The keypad code got inadvertently dropped during a major refactoring to pass review just before the initial release, but the docs were already done.
If you use the beta version it will work as documented.