esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
412 stars 26 forks source link

add an 'icon' component for matrix displays e.g. 8x32 RGB #1584

Closed lubeda closed 2 years ago

lubeda commented 2 years ago

Describe the problem you have/What new integration you would like Dynamic accessing images and animations is complicated you have to do something like this:

switch(HETicon) { case 0: it.image(0, 0, id(i00)); break; case 1: it.image(0, 0, id(i01)); break; default: it.image(0, 0, id(a01)); }

Using animations is difficult too because images dont support the next_frame() function.

There should be a class icon with objects of the type image and animation. Each object should have the same dimension e.g. 8x8 pixels. They should be accesible by an indexnumber like in an array. They shold also be animation awere so from the developer perspective they should support .next_frame() like animations even if they are images (do nothing on next_frame()). Please describe your use case for this integration and alternatives you've tried:

Additional context

I am trying to build a kind of LaMetric status display with esphome. The messages and the icons to display should be dynamic, the icons (images, animation) should only be hardcoded on compile time. The text should come from home assistant with an icon-number. Think of a weather display with the temeprature as text and the overall condition as an icon.

I tried to create a component like this by my self. The problem is that i dont know the IDs of all animations that will be defined, so i cant wait for all the definitions.

in theory ther should be something like this: 'cg.add(RawExpression("display::Animation* IconArray[31]= {"+ ','.join(str(e) for e in icons) +"};"))'

There are two projects bases on an esp with are nice and usefull but not as flexible as esphome solution. Awtrix PixelIt

lubeda commented 2 years ago

Since i learned a lot about esphome i found a solution. https://github.com/lubeda/EsphoMaTrix