-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add graphical display menu #4105
Add graphical display menu #4105
Conversation
Derives from DisplayMenuComponent to provide similar functionality as lcd_menu but for displays which are not character/row driven. Eg. eink displays and anything else providing a DisplayBuffer
Hey there @MrMDavidson, CODEOWNERS = ["@MrMDavidson"] And run (message by NeedsCodeownersLabel) |
I'd be curious about your thoughts on this @numo68. One thought I had in starting this implementation is that the rendering/layout of menu items might be better suited to the menu items themselves rather than the menu. I'd then imagine basically having a specialised hierarchy of menu items (eg. |
Hi @MrMDavidson, Did you know i am working on a GUI (switchplate) version for esphome. Do you think we could intergrade your menu into my switchplate code at https://github.com/nielsnl68/switchplate |
Hi @MrMDavidson , nice to see someone stepping up and extending this for graphical displays, thanks :)
My idea was to have the menu item manage the data and states/transitions only, and the menu having the responsibility to render it. I still think that it is a clean way to separate the concerns. I can well imagine the menu rendering engine attaching some data to the menu items for caching purposes or similar (transparent to the item), or the menu item setting some kind of a 'dirty' flag indicating that the value to display changed so the positions/dimensions might need to be recalculated. Maintaining a parallel hierarchy for both menu and menu items depending on the type of display to use seem harder to maintain to me. I am however not very good at the best practices on how to implement GUIs so I guess I let others comment on what approach is optimal. |
excited to see the progress @MrMDavidson! I've been working on a lcd menu for esphome on my project here https://github.com/landonr/esphome-remote and I want to make it more useful for general esphome users as a component. I've been looking at https://github.com/Spirik/GEM for inspiration.
|
@MrMDavidson the menu component works exceptionally well on Character LCD displays and having the option to display the same logic on graphical displays is very welcome. Will this be full-screen only, or will this be able to be shown among other items on the screen, eg. in a rectangle to constrain it within a space, and/or on a separate page? |
@nagyrobi: It's all positioned dynamically so adding a bounding box to constrain it isn't too hard.
Currently it creates its own |
@numo68 I think the current approach works well as a sort of flyweight pattern and if there's no new menus. The problem I see is that if someone wants to add a new menu type they have to add a new
And any new styles of menu just require a new implementation of
The parallel hierarchy should only be an issue for the python code in
I might branch from this if I get a chance and have a quick hack at an example so we can see it in practice. |
A fix for the out-of-bounds draw is here: Check MrMDavidson#125 |
I found the cause. Still had a |
Item would be drawn below the y2-bound (h).
…phical-display-menu # Conflicts: # CODEOWNERS # esphome/core/defines.h
Fix out of bounds draw of last menu item(s)
Padding is only drawn when there are multiple items.
Use only the index as loop variable, don't use the size(counter). Using mixed index/counter is very confusing to read.
Scroll an additional line to make the selected item fully visible
Otherwise, all items would be draw but clipped.
Hi! How's this project going? I'm really excited about this, finally having a menu 🙂 |
Nope - you can use it as is now (provided you're okay with alpha code) as an external component. You can find details of doing this in my earlier comment - #4105 (comment) . Once the PR gets reviewed and accepted it'll go into a future release. Interim docs can be found in the PR for the docs project at esphome/esphome-docs#2572 Finally, until ESPHome 2023.12 is released you will need to be using the ESPHome Dev plugin for HomeAssistant (you can run it along side the release version) |
Thank you! I got it to work, finally, on my SSD1306. I first had some trouble with getting the fonts to work, but that was related to my HA setup and not graphical display. I will also try it on a ST7789, if that's supported. Looking forward to the official release! |
Yup - because the underlying abstraction is the one that all of the displays implement this will work for any of the graphical style displays. I personally use it with the Waveshare eink screens where it works pretty well!
Me too! If you encounter any issues please drop a note in here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in reviewing.
Just a few minor python nitpicks, but otherwise good to go.
@@ -116,6 +116,7 @@ esphome/components/gp8403/* @jesserockz | |||
esphome/components/gpio/* @esphome/core | |||
esphome/components/gps/* @coogle | |||
esphome/components/graph/* @synco | |||
esphome/components/graphical_display_menu/* @MrMDavidson |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jesserockz Thoughts on this? Should I set it to someone else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would it be set to someone else? This is your PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
What does this implement/fix?
Adds a new component
graphical_display_menu
/GraphicalDisplayMenu
which implementsDisplayMenuComponent
. Provides a mechanism forDisplayBuffer
based displays (einks, etc) to render menus. Code currently supports non-fixed-height menu options.Types of changes
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#2572
Test Environment
Popup Example
config.yaml
:Adavanced Drawing Mode Example
config.yaml
Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: