Giter Site home page Giter Site logo

options for `btnmatrix` about esphome HOT 19 CLOSED

nagyrobi avatar nagyrobi commented on September 22, 2024
options for `btnmatrix`

from esphome.

Comments (19)

clydebarrow avatar clydebarrow commented on September 22, 2024

one_checked option from: https://docs.lvgl.io/8.3/widgets/core/btnmatrix.html#one-check

Already implemented.

we need on_value trigger to retrieve in x the ID of the button that was pressed.

Why? Each button in a button matrix can have its own actions. Although internally they are different to regular buttons, this is masked via the yaml config.

from esphome.

nagyrobi avatar nagyrobi commented on September 22, 2024

Why? Each button in a button matrix can have its own actions. Although internally they are different to regular buttons, this is masked via the yaml config.

For the users to easier implement something like key_collector to design an alarm input panel for example. With on_value you could use the same action to receive the different button presses...

It's like when you need to input a sequence of numbers like a pin code - without having to define complicated scripts to concatenate incoming strings located in global variables.
Actually, key_collector is a pretty well thought out component for this purpose. Maybe we could make btnmatrix work with it?

Also see #34 (comment)

from esphome.

nagyrobi avatar nagyrobi commented on September 22, 2024

one_checked option from: https://docs.lvgl.io/8.3/widgets/core/btnmatrix.html#one-check

Already implemented.

Tested, config passes through the schema, but doesn't have any effect. Multiple buttons can stay checked.

from esphome.

clydebarrow avatar clydebarrow commented on September 22, 2024

Actually, key_collector is a pretty well thought out component for this purpose. Maybe we could make btnmatrix work with it?

Or maybe make key_collector work with LVGL.

from esphome.

clydebarrow avatar clydebarrow commented on September 22, 2024

ested, config passes through the schema, but doesn't have any effect. Multiple buttons can stay checked.

Fixed.

from esphome.

nagyrobi avatar nagyrobi commented on September 22, 2024

Or maybe make key_collector work with LVGL.

I think both need to know about each other @ssieb

from esphome.

ssieb avatar ssieb commented on September 22, 2024

If the btnmatrix provides the key_provider interface, then it will work automatically.

from esphome.

nagyrobi avatar nagyrobi commented on September 22, 2024

@ssieb Can you point out a sample in the code?

from esphome.

ssieb avatar ssieb commented on September 22, 2024

Check out the wiegand and matrix_keypad components for example. It's very simple.

from esphome.

nagyrobi avatar nagyrobi commented on September 22, 2024

@clydebarrow maybe we could add a config option key_provider: true to btnmatrix root, and simply provide the texts put on the buttons to it as keys (and not allow symbols in this case).

from esphome.

clydebarrow avatar clydebarrow commented on September 22, 2024

That will work, no need for the config option, and it will just send the first character of the button label (key_provider can only send single characters.)

from esphome.

ssieb avatar ssieb commented on September 22, 2024

Symbols are fine. If you want to send more than a single character, then just call the send method multiple times.

from esphome.

nagyrobi avatar nagyrobi commented on September 22, 2024

@ssieb symbols here are graphical elements, not just *# keys.

@clydebarrow I thought about config option because one may use multiple btnmatrix instances (eg page navigation etc) and likely wouldn't want to use key_provider with those.

from esphome.

clydebarrow avatar clydebarrow commented on September 22, 2024

Symbols in the LVGL world are just Unicode strings.

The btnmatrix won't send any keys unless it's connected to a key_collector.

from esphome.

ssieb avatar ssieb commented on September 22, 2024

The key interface only handles uint8_t right now because it originally came from the keypad component. It could be expanded, but I'm not sure how useful that would be. What would you be using the keys for?
This should probably be a discord discussion. :-)

from esphome.

nagyrobi avatar nagyrobi commented on September 22, 2024

The btnmatrix won't send any keys unless it's connected to a key_collector.

Oh, you'd put at source_id the btnmatrix id?

from esphome.

ssieb avatar ssieb commented on September 22, 2024

Yes. As with most things in esphome, if there's only one source, it will pick it up automatically, but otherwise, you need to specify the source id.

from esphome.

clydebarrow avatar clydebarrow commented on September 22, 2024

If the btnmatrix provides the key_provider interface, then it will work automatically.

Done. Works a treat.

from esphome.

nagyrobi avatar nagyrobi commented on September 22, 2024

Recipe ready for the Cookbook: https://deploy-preview-3510--esphome.netlify.app/cookbook/lvgl#a-numeric-input-keypad

from esphome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.