LuBeDa 3 years ago
commit 8e9cfd9c81

@ -4,7 +4,6 @@ about: Create a report to help us improve EspHoMaTriXv2
title: "[BUG]"
labels: bug
assignees: ''
---
<!-- Make sure to read the documentaion (https://github.com/lubeda/EspHoMaTriXv2/blob/main/README.md) before opening an issue. -->
@ -21,6 +20,7 @@ Add a description of the bug. Detail the expected behavior in contrast with the
- ESP32 or ESP8266
- EspHoMaTriXv2 version: [e.g. 2023.5.0]
## To Reproduce
Steps to reproduce the behavior:

@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE]"
labels: enhancement
about: Suggest an idea for this EspHoMaTriXv2
title: "[FEATURE REQUEST]"
labels: feature request
assignees: ''
---
<!-- Make sure to read the documentaion (https://github.com/lubeda/EspHoMaTriXv2/blob/main/README.md) before opening an issue. -->

@ -1,10 +1,10 @@
---
name: Question
about: Open an issue to ask something about EspHoMaTriXv2
title: "[QUESTION]"
labels: help wanted, question
assignees: ''
---
<!-- Make sure to read the documentaion (https://github.com/lubeda/EspHoMaTriXv2/blob/main/README.md) before asking questions. -->
@ -17,6 +17,7 @@ Add here your question.
- used Hardware:
- ESP32 or ESP8266
- EspHoMaTriXv2 version: [e.g. 2023.5.0]
## Logs

2
.gitignore vendored

@ -26,3 +26,5 @@ downloadawtrixicons.ps1
ltr1.png
ltr2.png
ltr3.png
8x32 iMAGE.xcf

Binary file not shown.

@ -4,7 +4,7 @@
## Important information
If you like my work, please donate me a star on github and consider sponsoring me!!
If you like my work, please donate me a star on GitHub and consider sponsoring me!!
## Introduction
@ -18,13 +18,13 @@ There are some "RGB-matrices" status displays/clocks out there, the commercial o
- [LaMetric](https://lametric.com/en-US/) commercial ~ €199
- [Ulanzi TC001](https://www.aliexpress.com/item/1005005008682055.html) commercial ~ €50
- [AWTRIX](https://awtrixdocs.blueforcer.de/#/) (project has been discontinued after more than 4 years now in August 2022)
- [AWTRIX](https://awtrixdocs.blueforcer.de/#/) (project has been discontinued after more than 4 years in August 2022)
- [Pixel It](https://docs.bastelbunker.de/pixelit/) (project is under active development)
- [AWTRIX-Light](https://github.com/Blueforcer/awtrix-light) From the developer of Awtrix, optimized for the Ulanzi TC001 Hardware
- [AWTRIX-Light](https://github.com/Blueforcer/awtrix-light) From the developer of Awtrix, optimized for the Ulanzi TC001 hardware
The solutions have their pros and cons. I tried some and used AwTrix for a long time. But the cons are so big (in my opinion) that I started an esphome.io variant. Targeted to an optimized Home Assistant integration, without paid blueprints and the need of MQTT.
But it had to be extensible, e.g. for the use as pool thermometer or as media player. All done by the magical power of esphome.
But it had to be extensible, e.g. for the use as a pool thermometer or as a media player. All done by the magical power of esphome.
### Features
@ -32,13 +32,13 @@ Based on a 8x32 RGB matrix, it displays a clock, the date and up to 24 other 'sc
### State
After the [old](https://github.com/lubeda/EsphoMaTrix) component became favorite, there were some feature requests, which showed that my old code was a mess. I reworked the whole code and restructured it, so it is now hopefully more extensible.
After the [old](https://github.com/lubeda/EsphoMaTrix) component became favorite, there were some feature requests, which indicated that my old code was a mess. I reworked the whole code and restructured it, so it is now hopefully more extensible.
## How to use
### The easy way
There is a little hype around the Ulanzi TC001 pixel clock. The easy way works with the Ulanzi TC001 hardware. For more customization and other hardware look [here](#the-funny-but-more-elaborate-way).
There is a little hype around the Ulanzi TC001 pixel clock. The easy way works with the Ulanzi TC001 hardware. For more customization and other hardware, look [here](#the-funny-but-more-elaborate-way).
In easy mode you'll have a clock with auto brightness control and after step 3 you can send states to the display an toggle on or off additional screen elements.
@ -75,13 +75,13 @@ If not, check the esphome logs for further investigations.
### The funny but more elaborate way
This is for the more advanced users. If you understand the concept of esphome, you can display nearly everything with this component. You are also able to create your own customized esphome based display with multiple sensors or even use it as microphone for the new [voice assist](https://esphome.io/components/voice_assistant.html) feature from home assistant.
This is for the more advanced users. If you understand the concept of esphome, you can display nearly everything with this component. You are also able to create your own customized esphome based display with multiple sensors, or even use it as a microphone for the new [voice assist](https://esphome.io/components/voice_assistant.html) feature from home assistant.
#### Concept
You can add screens to a queue and all these screens are displayed one after another.
![timing](./images/timingv2.png)
Each screen can display different information or animation or text, even in rainbox color. They all have a lifetime, if a screen isn't refreshed during its lifetime it will be removed from the queue. If there is nothing left in the queue, the date and time screens are displayed. Some screens can show additional features like an alarm or indicator see [elements](#display-elements).
Each screen can display different information or animation or text, even in rainbow color. They all have a lifetime, if a screen isn't refreshed during its lifetime it will be removed from the queue. If there is nothing left in the queue, the date and time screens are displayed. Some screens can show additional features like an alarm or indicator see [elements](#display-elements).
You can add screens from home assistant with service-calls or from esphome via lambdas in your YAML.
#### Screen types a.k.a. what is possible
@ -103,7 +103,7 @@ rainbow_date_screen => {"lifetime", "screen_time", "default_font"}
###### Lambda
You cann use these in [lambdas](https://esphome.io/guides/automations.html?highlight=lambda#lambda-action) in your esphome YAML.
You can use these in [lambdas](https://esphome.io/guides/automations.html?highlight=lambda#lambda-action) in your esphome YAML.
all parameters have a default value.
@ -155,7 +155,7 @@ void full_screen(string iconname, int =D_LIFETIME, int screen_time=D_SCREEN_TIME
##### alarm
The alarm is displayed in the upper right corner at all screen types! You can set its color and its size.
The alarm is displayed in the upper-right corner at all screen types! You can set its color and its size.
###### service
@ -163,7 +163,7 @@ The alarm is displayed in the upper right corner at all screen types! You can s
show_alarm => { "r", "g", "b","size"}
```
###### api
###### API
```c
void EHMTX::show_alarm(int r, int g, int b, int size=2);
@ -188,7 +188,7 @@ void hide_alarm();
##### Indicator
The indicator is in the lower left corner, but not displayed in fullscreen 8x32 animations. You can set its color.
The indicator is in the lower-left corner, but not displayed in full screen 8x32 animations. You can set its color.
###### Service
@ -236,9 +236,9 @@ void show_gauge(int percent, int r, int g, int b);
```
percent: 0-100 (resolution: one pixel per 12,5%)
r,g,b: 0-255 color components
r, g, b: 0-255 color components
To remove it call:
To remove it, call:
###### service
@ -246,7 +246,7 @@ To remove it call:
hide_gauge => no parameter
```
###### api
###### API
```c
void hide_gauge();
@ -254,7 +254,7 @@ void hide_gauge();
#### Installation of **EspHoMaTriXv2** custom component
**EspHoMaTriXv2** is a custom component, you have to include it in your YAML configuration. To always use the newest features you should use the repo, to use a stable version, you copy a working version to your esphome installation.
**EspHoMaTriXv2** is a custom component, you have to include it in your YAML configuration. To always use the newest features, you should use the repo, to use a stable version, you copy a working version to your esphome installation.
##### use of local copy
@ -269,7 +269,7 @@ external_components:
##### use from repo
Use the GitHub repo as component. Esphome refreshes the external components "only" once a day, perhaps you have to refresh it manually. In this mode, there may be breaking changes, so read the changelog and check the logs while installing the firmware.
Use the GitHub repo as a component. Esphome refreshes the external components "only" once a day, perhaps you have to refresh it manually. In this mode, there may be breaking changes, so read the changelog and check the logs while installing the firmware.
```yaml
external_components:
@ -281,7 +281,7 @@ external_components:
#### Addressable_light component
The **EspHoMaTriXv2** component requires a 8x32 pixel addressable_light, it is referenced by the id `matrix_component`.
The **EspHoMaTriXv2** component requires an 8x32 pixel addressable_light, it is referenced by the id `matrix_component`.
See the default [options](https://esphome.io/components/display/index.html)
@ -321,7 +321,7 @@ display:
.....
```
##### Type 3 (daisy chained 8x8 panels)
##### Type 3 (daisy-chained 8x8 panels)
```yaml
display:
@ -351,7 +351,7 @@ display:
The light component is used by the addressable_light component and referenced by id under `addressable_light_id:`.
To use the light component directly from home assistant add the sample lambdas```on_turn_on``` and ```on_turn_off``` to the light component.
To use the light component directly from home assistant, add the sample lambdas```on_turn_on``` and ```on_turn_off``` to the light component.
***Sample***
@ -380,7 +380,7 @@ light:
#### Time component
Since it is a clock, you need a time component e.g. [homeassistant](https://esphome.io/components/time/homeassistant.html). It is referenced by its id under `time_component:` The display shows `!t!` until the time source is synchronized and valid.
Since it is a clock, you need a time component, e.g. [homeassistant](https://esphome.io/components/time/homeassistant.html). It is referenced by its id under `time_component:` The display shows `!t!` until the time source is synchronized and valid.
#### Font
@ -392,7 +392,7 @@ You can configure two fonts if you like.
DarkPoet78 is also providing special fonts for 8x32 matrices in his [repo](https://github.com/darkpoet78/MatrixClockFonts)
For european starters you can use the font EHMTXv2.ttf of the copy2esphome folder.
For Europeans starters, you can use the font EHMTXv2.ttf of the copy2esphome folder.
```yaml
font:
@ -436,13 +436,13 @@ emhtx:
url: https://github.com/home-assistant/assets/raw/master/logo/logo-special.png
```
The id of the icons is used later to configure the screens to display. So you should name them wisely. If you like to group icons, you should prefix them e.g. with "weather_" (see Service **del_screen**)
The id of the icons is used later to configure the screens to display. So, you should name them wisely. If you like to group icons, you should prefix them e.g. with "weather_" (see Service **del_screen**)
The first defined icon will be used as a fallback icon, in case of an error, e.g. if you use a non-existing icon id.
GIFs are limited to 110 frames to limit the used amount of flash space.
All other solutions provide ready-made icons, especially Lametric has a big database of [icons](https://developer.lametric.com/icons). Please check the copyright of the icons you use. The maximum amount of icons is limited to 90 in the code and also by the flash space and the RAM of your board.
All other solutions provide ready-made icons, especially Lametric has a big database of [icons](https://developer.lametric.com/icons). Please check the copyright of the icons you use. The maximum number of icons is limited to 90 in the code and also by the flash space and the RAM of your board.
See also [icon parameter](#icons)
@ -507,9 +507,9 @@ ehmtxv2:
**week_start_monday** (optional, bool): default Monday is first day of week, false => Sunday
**scroll_interval** (optional, ms): the interval in ms to scroll the text (default=80), should be a multiple of the ```update_interval``` of the [display](https://esphome.io/components/display/addressable_light.html)
**scroll_interval** (optional, ms): the interval in ms to scroll the text (default=80), should be a multiple of the ```update_interval``` from the [display](https://esphome.io/components/display/addressable_light.html)
**frame_interval** (optional, ms): the interval in ms to display the next animation/icon frame (default = 192), should be a multiple of the ```update_interval``` of the [display](https://esphome.io/components/display/addressable_light.html). Can be overwritten per icon/GIF, see [icons](#icons-and-animations) parameter `frame_duration`
**frame_interval** (optional, ms): the interval in ms to display the next animation/icon frame (default = 192), should be a multiple of the ```update_interval``` of the [display](https://esphome.io/components/display/addressable_light.html). It can be overwritten per icon/GIF, see [icons](#icons-and-animations) parameter `frame_duration`
**icons2html** (optional, boolean): If true, generate the HTML-file (*filename*.html) to show all included icons. (default = `false`)
@ -521,8 +521,8 @@ ehmtxv2:
***Parameters***
See [icon details](#icons-and-animations)
- **frame_duration** (optional, ms): in case of a GIF-file the component tries to read the default interval for each frame. The default/fallback interval is 192 ms. In case you need to override the default value, set the duration per icon.
- **pingpong** (optional, boolean): in case of a GIF-file you can reverse the frames instead of starting from the first frame.
- **frame_duration** (optional, ms): in the case of a GIF-file, the component tries to read the default interval for each frame. The default/fallback interval is 192 ms. In case you need to override the default value, set the duration per icon.
- **pingpong** (optional, boolean): in the case of a GIF-file, you can reverse the frames instead of starting from the first frame.
- **file** (Exclusive, filename): a local filename
- **url** (Exclusive, url): a URL to download the icon
@ -540,7 +540,7 @@ See [icon details](#icons-and-animations)
## Control your display
A lot of features are accessible with services from home assistant and lambdas you can use in your YAML.
Numerous features are accessible with services from home assistant and lambdas you can use in your YAML.
### Public functions/services
@ -553,15 +553,15 @@ A lot of features are accessible with services from home assistant and lambdas y
|`hide_indicator`|none|hides the indicator|
|`hide_gauge`|none|hides the gauge|
|`hide_alarm`|none|hides the alarm|
|`show_gauge"`|"percent", "r", "g", "b"|set the heught of the gauge according to the percentage in the given color|
|`show_alarm`|"r", "g", "b", "size"|shows the color with the given size in the upper right corner|
|`show_indicator`|"r", "g", "b", "size"|shows the color with the given size in the lower right corner|
|`show_gauge"`|"percent", "r", "g", "b"|set the height of the gauge according to the percentage in the given color|
|`show_alarm`|"r", "g", "b", "size"|shows the color with the given size in the upper-right corner|
|`show_indicator`|"r", "g", "b", "size"|shows the color with the given size in the lower-right corner|
|`clock_color`|"r", "g", "b"|set the default color for the clock/date display|
|`today_color"`|"r", "g", "b"|set the special color for today in the day of week line|
|`weekday_color"`|"r", "g", "b"|set the default color in the day of week line|
|`del_screen`|"icon_name", "mode"|deletes the specified icon screen from the queue, the [mode](#modes) is a filter|
|`force_screen`|"icon_name", "mode"|displayes the seleted the specified icon screen from the queue, the [mode](#modes) is a filter|
|`full_screen`|"icon_name", "lifetime", "screen_time"|show the specified 8x32 icon as fullscreen|
|`force_screen`|"icon_name", "mode"|displays the selected the specified icon screen from the queue, the [mode](#modes) is a filter|
|`full_screen`|"icon_name", "lifetime", "screen_time"|show the specified 8x32 icon as full screen|
|`icon_screen`|"icon_name", "text", "lifetime", "screen_time", "default_font", "r", "g", "b"|show the specified icon with text|
|`rainbow_icon_screen`|"icon_name", "text", "lifetime", "screen_time", "default_font"|show the specified icon with text in rainbow color|
|`text_screen`|"text", "lifetime", "screen_time", "default_font", "r", "g", "b"|show the specified text|
@ -598,7 +598,7 @@ sensor:
##### Force screen
Force the selected [icon_screen](#icon-screen) ```icon_name``` to be displayed next. Afterward the loop continues from this screen. e.g. helpful for alarms. Or after an update of the value/text.
Force the selected [icon_screen](#icon-screen) ```icon_name``` to be displayed next. Afterward, the loop continues from this screen. e.g. helpful for alarms. Or after an update of the value/text.
```yaml
id(rgb8x32)->force_screen("homeassistant");
@ -617,13 +617,54 @@ Experienced programmers can use these public methods:
To use the display without homeassistant automations, you may use the [advanced functionality](#change-configuration-during-runtime) with triggers. The triggers can be fired by sensors, time or by the ehmtx component.
#### on_add_screen
There is a trigger available to do some local magic. The trigger ```on_add_screen``` is triggered every time a new screen with icon is added to the queue. In lambda's you can use two local variables:
**icon** (Name of the icon, std::string): value to use in lambda
**mode** ([mode](#modes) of the screen, uint8_t): value to use in lambda
See the examples:
##### Write information to esphome log
```yaml
ehmtxv2:
....
on_add_screen:
then:
- logger.log:
format: 'add screen: %s, mode: %d'
tag: "EHMTXv2 sample"
args:
- icon.c_str()
- mode
```
#### on_icon_error
The trigger ```on_icon_error``` is triggered if you try to add a screen with a non defined icon. In lambda's you can use one local string variable:
**icon** (Name of the icon, std::string): value to use in lambda
See the examples:
```yaml
ehmtxv2:
....
on_next_screen:
lambda: |-
ESP_LOGD("Check CONFIG","Iconname: %s",icon.c_str());
```
#### on_next_screen
There is a trigger available to do some local magic. The trigger ```on_next_screen``` is triggered every time a new screen is displayed (it doesn't trigger on the clock/date display!!). In lambda's you can use two local string variables:
The trigger ```on_next_screen``` is triggered every time a new screen is displayed (it doesn't trigger on the clock/date display!!). In lambda's you can use two local string variables:
**x** (Name of the icon, std::string): value to use in lambda
**icon** (Name of the icon, std::string): value to use in lambda
**y** (displayed text, std::string): value to use in lambda
**text** (displayed text, std::string): value to use in lambda
See the examples:
@ -634,13 +675,13 @@ ehmtxv2:
....
on_next_screen:
lambda: |-
ESP_LOGD("TriggerTest","Iconname: %s",x.c_str());
ESP_LOGI("TriggerTest","Text: %s",y.c_str());
ESP_LOGD("TriggerTest","Iconname: %s",icon.c_str());
ESP_LOGI("TriggerTest","Text: %s",text.c_str());
```
##### Send an event to Home Assistant
To send data back to home assistant you can use events.
To send data back to home assistant, you can use events.
```yaml
ehmtxv2:
@ -649,8 +690,8 @@ ehmtxv2:
- homeassistant.event:
event: esphome.next_screen
data_template:
iconname: !lambda "return x.c_str();"
text: !lambda "return y.c_str();"
iconname: !lambda "return icon.c_str();"
text: !lambda "return text.c_str();"
```
***Result***
@ -750,7 +791,7 @@ switch:
Service **skip_screen**
If there is more than one screen in the queue, it skip the actual displayed screen to the next screen.
If there is more than one screen in the queue, it skips the actual displayed screen to the next screen.
e.g. on the Ulanzi TC001
@ -805,7 +846,7 @@ To control your display, it has to be integrated in Home Assistant. Then it prov
### Services
All communication with Home Assistant use the homeasistant-api. The services can be provided by default or also defined additionally in the YAML. To define the additional services you need the id of the ehmtx-component e.g. ```id(rgb8x32)```.
All communication with Home Assistant use the homeasistant-api. The services can be provided by default or also defined additionally in the YAML. To define the additional services, you need the id of the ehmtx-component e.g. ```id(rgb8x32)```.
### Use in Home Assistant automations
@ -916,7 +957,7 @@ action:
### Integrate in Home Assistant UI
Add entities to Home Assistant UI for interactive control of your display
Add entities to the Home Assistant UI for interactive control of your display
#### Brightness
@ -954,9 +995,9 @@ switch:
### automatic brightness
Awtrix and PixelIt have hard-coded functionality. EHMTX is also capable to built something like that by lambdas. But this is all your freedom. See the Ulanzi simple YAML as a guide.
Awtrix and PixelIt have hard-coded functionality. EHMTX is also capable of building something like that by lambdas. But this is all your freedom. See the Ulanzi simple YAML as a guide.
Example: automatic brightness control with an bh1570 sensor
Example: automatic brightness control with a bh1570 sensor
```yaml
sensor:
@ -981,7 +1022,7 @@ sensor:
See this German tutorial video with information on setting up your display [RGB-LED Status Display für Home Assistant mit ESPHome | ESPHoMaTrix](https://www.youtube.com/watch?v=DTd9vAhet9A).
Another german tutorial video focused at the Ulanzi [Smarte Pixel Clock über Home Assistant steuern - Entitäten / Icons und mehr in der Ulanzi](https://www.youtube.com/watch?v=LgaT0mNbl34)
Another german tutorial video focused on the Ulanzi [Smarte Pixel Clock über Home Assistant steuern - Entitäten / Icons und mehr in der Ulanzi](https://www.youtube.com/watch?v=LgaT0mNbl34)
See this [nice article](https://blakadder.com/esphome-pixel-clock/) about EsphoMaTrix on a Ulanzi TC001 from [blakadder](https://github.com/blakadder).

@ -1,30 +1,30 @@
# To Do's
# To-Do's
## function
- [x] alarm on all screen but fullscreen
- [x] indicator on all screen but fullscreen and clock
- [x] alarm on all screens but full screen
- [x] indicator on all screens but full screen and clock
- [x] refreshing an icon screen should extend the display time
- [ ] scroll left to right
- [x] size of indicator and alarm
- [x] center text
- [x] alarm unabhängig von screen
- [x] del_screen with * and filter by type do delete all clocks etc.
- [x] force_screen with * and filter by type do delete all clocks etc.
- [x] gauge mit farbe und del_gaugeall clocks etc.
- [x] alarm independent of screen
- [x] del_screen with * and filter by type, do delete all clocks etc.
- [x] force_screen with * and filter by type, do delete all clocks etc.
- [x] gauge with color and del_gaugeall clocks etc.
- [ ] seconds point moveable
- [ ] seconds point to clock screen only
- [x] seconds point to clock screen only
- [x] rainbow icon and text
- [x] del_slot noch active?
- [x] CONF_ALARM weg?
- [x] del_slot still active?
- [x] CONF_ALARM remove?
- [x] reintroduce resize
## ux
## user experience
- [ ] blueprints
- [ ] Color in blueprints
- [x] Color in blueprints
- [ ] all modes in one blueprint
- [ ] external html with more blueprint helpers (icons and modes)
- [ ] external HTML with more blueprint helpers (icons and modes)
- [x] default values for all functions
- [x] provide sample font from [url](https://www.pentacom.jp/pentacom/bitfontmaker2/)
- [x] start animation
@ -32,7 +32,7 @@
## style
- [ ] in screen rename text_color to color
- [x] default_font before alarm paramater
- [x] default_font before alarm parameter
- [x] screen_time instead of showtime
- [x] lifetime instead of durations
- [x] remove actions in favor of functions
@ -44,9 +44,9 @@
- [ ] remake documentation
- [ ] more explanation for fonts
- [ ] reference to https://www.pentacom.jp/pentacom/bitfontmaker2/gallery/?id=13768
- [ ] sample yaml with voice
- [ ] sample YAML with voice
## noch prüfen
## do check
- [ ] Timer display with formation H:M:S
- [ ] find a way for automatically add smallfont
- [ ] Timer display with format H:M:S
- [ ] find a way to automatically add smallfont

@ -109,6 +109,7 @@ namespace esphome
}
}
ESP_LOGW(TAG, "icon: %s not found", name.c_str());
return MAXICONS;
}
@ -496,6 +497,10 @@ namespace esphome
{
ESP_LOGW(TAG, "icon %d not found => default: 0", icon);
icon = 0;
for (auto *t : on_icon_error_triggers_)
{
t->process(iconname);
}
}
EHMTX_queue *screen = this->find_icon_queue_element(icon);
@ -513,6 +518,10 @@ namespace esphome
screen->default_font = default_font;
screen->mode = MODE_ICON_SCREEN;
screen->icon_name = iconname;
for (auto *t : on_add_screen_triggers_)
{
t->process(screen->icon_name,(uint8_t)screen->mode);
}
ESP_LOGD(TAG, "icon screen icon: %d iconname: %s text: %s lifetime: %d screen_time: %d", icon, iconname.c_str(), text.c_str(), lifetime, screen_time);
screen->status();
}
@ -551,6 +560,10 @@ namespace esphome
{
ESP_LOGW(TAG, "icon %d not found => default: 0", icon);
icon = 0;
for (auto *t : on_icon_error_triggers_)
{
t->process(iconname);
}
}
EHMTX_queue *screen = this->find_icon_queue_element(icon);
screen->icon_name = iconname;
@ -561,6 +574,10 @@ namespace esphome
screen->default_font = default_font;
screen->mode = MODE_RAINBOW_ICON;
screen->calc_scroll_time();
for (auto *t : on_add_screen_triggers_)
{
t->process(screen->icon_name,(uint8_t)screen->mode);
}
ESP_LOGD(TAG, "rainbow_icon_screen icon: %d iconname: %s text: %s lifetime: %d screen_time: %d", icon, iconname.c_str(), text.c_str(), lifetime, screen_time);
screen->status();
}
@ -599,6 +616,10 @@ namespace esphome
if (icon >= this->icon_count)
{
ESP_LOGW(TAG, "full screen: icon %d not found => default: 0", icon);
for (auto *t : on_icon_error_triggers_)
{
t->process(iconname);
}
icon = 0;
}
EHMTX_queue *screen = this->find_icon_queue_element(icon);
@ -608,6 +629,10 @@ namespace esphome
screen->icon_name = iconname;
screen->screen_time = screen_time;
screen->endtime = this->clock->now().timestamp + lifetime * 60;
for (auto *t : on_add_screen_triggers_)
{
t->process(screen->icon_name,(uint8_t)screen->mode);
}
ESP_LOGD(TAG, "full screen: icon: %d iconname: %s lifetime: %d screen_time:%d ", icon, iconname.c_str(), lifetime, screen_time);
screen->status();
}
@ -881,6 +906,16 @@ namespace esphome
this->trigger(iconname, text);
}
void EHMTXAddScreenTrigger::process(std::string iconname, uint8_t mode)
{
this->trigger(iconname, mode);
}
void EHMTXIconErrorTrigger::process(std::string iconname)
{
this->trigger(iconname);
}
void EHMTXExpiredScreenTrigger::process(std::string iconname, std::string text)
{
this->trigger(iconname, text);

@ -30,6 +30,8 @@ namespace esphome
class EHMTX_queue;
class EHMTX_Icon;
class EHMTXNextScreenTrigger;
class EHMTXAddScreenTrigger;
class EHMTXIconErrorTrigger;
class EHMTXExpiredScreenTrigger;
class EHMTXNextClockTrigger;
@ -43,8 +45,10 @@ namespace esphome
bool show_day_of_week;
std::vector<EHMTXNextScreenTrigger *> on_next_screen_triggers_;
std::vector<EHMTXIconErrorTrigger *> on_icon_error_triggers_;
std::vector<EHMTXExpiredScreenTrigger *> on_expired_screen_triggers_;
std::vector<EHMTXNextClockTrigger *> on_next_clock_triggers_;
std::vector<EHMTXAddScreenTrigger *> on_add_screen_triggers_;
EHMTX_queue *find_icon_queue_element(uint8_t icon);
EHMTX_queue *find_free_queue_element();
@ -127,7 +131,7 @@ namespace esphome
void set_clock_color(int r=C_RED, int g=C_GREEN, int b=C_BLUE);
void set_today_color(int r, int g, int b);
void set_weekday_color(int r, int g, int b);
void show_alarm(int r=CA_RED, int g=C_GREEN, int b=C_BLUE, int s= 2);
void show_alarm(int r=CA_RED, int g=CA_GREEN, int b=CA_BLUE, int s= 2);
void show_gauge(int v,int r=C_RED, int g=C_GREEN, int b=C_BLUE); // int because of register_service
void hide_gauge();
void hide_indicator();
@ -150,6 +154,8 @@ namespace esphome
void draw_indicator();
void add_on_next_screen_trigger(EHMTXNextScreenTrigger *t) { this->on_next_screen_triggers_.push_back(t); }
void add_on_add_screen_trigger(EHMTXAddScreenTrigger *t) { this->on_add_screen_triggers_.push_back(t); }
void add_on_icon_error_trigger(EHMTXIconErrorTrigger *t) { this->on_icon_error_triggers_.push_back(t); }
void add_on_expired_screen_trigger(EHMTXExpiredScreenTrigger *t) { this->on_expired_screen_triggers_.push_back(t); }
void add_on_next_clock_trigger(EHMTXNextClockTrigger *t) { this->on_next_clock_triggers_.push_back(t); }
@ -197,6 +203,21 @@ namespace esphome
void process(std::string, std::string);
};
class EHMTXAddScreenTrigger : public Trigger<std::string, uint8_t>
{
public:
explicit EHMTXAddScreenTrigger(EHMTX *parent) { parent->add_on_add_screen_trigger(this); }
void process(std::string, uint8_t);
};
class EHMTXIconErrorTrigger : public Trigger<std::string>
{
public:
explicit EHMTXIconErrorTrigger(EHMTX *parent) { parent->add_on_icon_error_trigger(this); }
void process(std::string);
};
class EHMTXExpiredScreenTrigger : public Trigger<std::string, std::string>
{
public:

@ -41,6 +41,10 @@ NextScreenTrigger = ehmtx_ns.class_(
"EHMTXNextScreenTrigger", automation.Trigger.template(cg.std_string)
)
IconErrorTrigger = ehmtx_ns.class_(
"EHMTXIconErrorTrigger", automation.Trigger.template(cg.std_string)
)
ExpiredScreenTrigger = ehmtx_ns.class_(
"EHMTXExpiredScreenTrigger", automation.Trigger.template(cg.std_string)
)
@ -49,7 +53,10 @@ NextClockTrigger = ehmtx_ns.class_(
"EHMTXNextClockTrigger", automation.Trigger.template(cg.std_string)
)
CONF_EHMTX = "ehmtx"
AddScreenTrigger = ehmtx_ns.class_(
"EHMTXAddScreenTrigger", automation.Trigger.template(cg.std_string)
)
CONF_URL = "url"
CONF_FLAG = "flag"
CONF_TIMECOMPONENT = "time_component"
@ -77,6 +84,8 @@ CONF_TIME_FORMAT = "time_format"
CONF_DATE_FORMAT = "date_format"
CONF_ON_NEXT_SCREEN = "on_next_screen"
CONF_ON_NEXT_CLOCK = "on_next_clock"
CONF_ON_ICON_ERROR = "on_icon_error"
CONF_ON_ADD_SCREEN = "on_add_screen"
CONF_ON_EXPIRED_SCREEN= "on_expired_screen"
CONF_SHOW_SECONDS = "show_seconds"
CONF_WEEK_START_MONDAY = "week_start_monday"
@ -141,6 +150,16 @@ EHMTX_SCHEMA = cv.Schema({
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(NextScreenTrigger),
}
),
cv.Optional(CONF_ON_ICON_ERROR): automation.validate_automation(
{
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(IconErrorTrigger),
}
),
cv.Optional(CONF_ON_ADD_SCREEN): automation.validate_automation(
{
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(AddScreenTrigger),
}
),
cv.Optional(CONF_ON_EXPIRED_SCREEN): automation.validate_automation(
{
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(NextScreenTrigger),
@ -351,7 +370,7 @@ async def to_code(config):
cg.add(var.set_special_font_offset(config[CONF_special_FONT_XOFFSET], config[CONF_special_FONT_YOFFSET] ))
for conf in config.get(CONF_ON_NEXT_SCREEN, []):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [(cg.std_string, "x"), (cg.std_string, "y")], conf)
await automation.build_automation(trigger, [(cg.std_string, "icon"), (cg.std_string, "text")], conf)
for conf in config.get(CONF_ON_NEXT_CLOCK, []):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
@ -359,6 +378,14 @@ async def to_code(config):
for conf in config.get(CONF_ON_EXPIRED_SCREEN, []):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [(cg.std_string, "x"), (cg.std_string, "y")] , conf)
await automation.build_automation(trigger, [(cg.std_string, "icon"), (cg.std_string, "text")] , conf)
for conf in config.get(CONF_ON_ICON_ERROR, []):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [(cg.std_string, "icon")] , conf)
for conf in config.get(CONF_ON_ADD_SCREEN, []):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [(cg.std_string, "icon"), (cg.uint8 , "mode")] , conf)
await cg.register_component(var, config)

@ -1,22 +1,22 @@
blueprint:
name: |-
ehmtxv2: delete screen from 8x32 RGB-display
description: This blueprint is triggered by a state change. If the state is between certain values it will be displayed with special colors or no state change will be displayed
ehmtxv2: delete screen from 8x32 RGB-matrix
description: This blueprint is triggered by a state change and will remove a certain screen from the queue. The screen is selected by type an icon.
domain: automation
input:
ehmtx_device:
name: which device to display at
name: Which EspHoMaTriXv2 device to use
selector:
device:
integration: esphome
trigger_sensor:
name: which state change triggers
description: this entity triggers
name: Which state change triggers the automation?
selector:
entity:
domain: sensor
screen_mode:
name: the mode
name: The mode od the screen?
description: Some modes use a icon some not. The use "*" as icon, e.g. for MODE_BLANK.
selector:
select:
custom_value: true
@ -42,37 +42,26 @@ blueprint:
value: "9"
default: "5"
icon_name:
name: the icon
name: The icon to specify a screen.
selector:
select:
mode: dropdown
options:
["*","error","home_assistant","temperature","lightbulb","music","phone","car","sleep8x32",]
default: home_assistant
low_value:
name: below this vaule is a special color
selector:
number:
mode: box
min: -10000
max: +10000
low_color:
name: Low color
description: the color for values below the limit
selector:
color_rgb:
default: [40, 240, 40]
variables:
display: !input ehmtx_device
mode: parallel
trigger:
- platform: state
entity_id: !input trigger_sensor
action:
- mode: parallel
- service: esphome.{{ device_attr(display, "name") }}_del_screen
- service: |-
esphome.{{ device_attr(display, "name") }}_del_screen
data:
icon_name: !input icon_name
mode: !input screen_mode

@ -1,22 +1,21 @@
blueprint:
name: |-
ehmtxv2: hide screen elements to 8x32 RGB-display
description: removes the gauge,indicator or alarm element from your display
ehmtxv2: Hide screen elements on 8x32 RGB-matrix
description: Removes the gauge, indicator or alarm element from your EspHoMaTriXv2 display.
domain: automation
input:
ehmtx_device:
name: which device to display at
name: Which display to use
selector:
device:
integration: esphome
trigger_sensor:
name: which statechange triggers
description: this entity triggers
name: Which state change triggers this automation
selector:
entity:
domain: sensor
element:
name: the element
name: The screen element
selector:
select:
custom_value: true
@ -34,10 +33,12 @@ variables:
display: !input ehmtx_device
service: !input element
mode: parallel
trigger:
- platform: state
entity_id: !input trigger_sensor
action:
- mode: parallel
- service: esphome.{{ device_attr(display, "name") }}_{{service}}
- service: |-
esphome.{{ device_attr(display, "name") }}_{{service}}

@ -1,22 +1,23 @@
blueprint:
name: |-
ehmtxv2: show screen elements to 8x32 RGB-display
description: add a gauge,indicator or alarm element to your display
ehmtxv2: Show screen elements on 8x32 RGB-matrix
description: Add a gauge, indicator or alarm element to your EspHoMaTriXv2 display
domain: automation
input:
ehmtx_device:
name: which device to display at
name: Which device to display at?
selector:
device:
integration: esphome
trigger_sensor:
name: which state to show
description: what triggers this automation?
name: Which state-change triggers the screen element
selector:
entity:
domain: sensor
element:
name: the element
name: The screen element
description: |-
Indicator and alarm are in the corners at the right size and have a color and a size. The gauge has a color and a value in percent.
selector:
select:
custom_value: true
@ -30,7 +31,7 @@ blueprint:
value: show_indicator
default: show_indicator
gauge_value:
name: the value on the gauge
name: The value on the gauge (if selected)
selector:
number:
mode: slider
@ -38,7 +39,7 @@ blueprint:
max: 100
default: 50
size_value:
name: size of the alarm or indicator
name: The size of the alarm or indicator (if selected)
selector:
number:
mode: slider
@ -47,7 +48,6 @@ blueprint:
default: 2
element_color:
name: The color for the element
description: the color
selector:
color_rgb:
default: [240, 40, 40]
@ -57,17 +57,20 @@ variables:
myservice: !input element
value: !input gauge_value
size: !input size_value
mode: parallel
trigger:
- platform: state
entity_id: !input trigger_sensor
action:
- mode: parallel
- if:
- condition: template
value_template: |-
{{ myservice != "show_gauge" }}
then:
- service: esphome.{{ device_attr(display, "name") }}_{{ myservice }}
- service: |-
esphome.{{ device_attr(display, "name") }}_{{ myservice }}
data:
r: |-
{{ element_color[0] }}
@ -78,7 +81,8 @@ action:
size: |-
{{ size }}
else:
- service: esphome.{{ device_attr(display, "name") }}_{{ myservice }}
- service: |-
esphome.{{ device_attr(display, "name") }}_{{ myservice }}
data:
r: |-
{{ element_color[0] }}
@ -87,5 +91,5 @@ action:
b: |-
{{ element_color[2] }}
percent: |-
{{ element_color[2] }}
{{ value }}

@ -1,29 +1,29 @@
blueprint:
name: |-
ehmtxv2: show state with unit on on 8x32 RGB-display
description: This blueprint is triggered by a state change. If the state is between certain values it will be displayed with special colors or no state change will be displayed
ehmtxv2: show state with unit on 8x32 RGB-matrix
description: This blueprint is triggered by a state change. If the state is between certain values, it will be displayed with special colors or no state change will be displayed
domain: automation
input:
ehmtx_device:
name: which device to display at
name: Which EspHoMaTriX-device to display at?
selector:
device:
integration: esphome
trigger_sensor:
name: which state to show
description: This sensor state will be displayed
name: Which sensor state to show?
description: This sensor state will be displayed.
selector:
entity:
domain: sensor
multiple: true
default_color:
name: default text color
description: this is the default textcolor for values within the low and the high value
name: Default text color
description: This is the default text color for values within the low and the high value (90% white)
selector:
color_rgb:
default: [240, 240, 240]
lifetime:
name: how many minutes is this screen in the loop
name: How many minutes is this screen kept in the loop?
selector:
number:
min: 1
@ -31,7 +31,7 @@ blueprint:
step: 1
default: 2
screen_time:
name: minimum display time per loop in seconds
name: Minimum display time of this screen per loop in seconds?
selector:
number:
min: 6
@ -39,7 +39,8 @@ blueprint:
step: 2
default: 12
icon_name:
name: the icon
name: The icon associated to this state screen?
description: If you use additional icons in your YAML, you have to add them to this blueprint.
selector:
select:
mode: dropdown
@ -47,22 +48,24 @@ blueprint:
["error","home_assistant","temperature","lightbulb","music","phone","car","sleep8x32",]
default: home_assistant
use_friendly:
name: use the triggers friendly name in display
name: Use the triggers friendly name in display?
description: Add the friendly name of the sensor to the state display.
selector:
boolean:
default: true
default_font:
name: true uses the default, false the special font
name: Use the default or set false to use the special font.
selector:
boolean:
default: true
use_colors:
name: Use colors based on state values
name: Use colors based on state values?
description: If false, the default color will be used.
selector:
boolean:
default: false
low_value:
name: below this vaule is a special color
name: Below this value use "low color".
selector:
number:
mode: box
@ -71,12 +74,12 @@ blueprint:
default: 0
low_color:
name: Low color
description: the color for values below the limit
description: The color for values below the above limit.
selector:
color_rgb:
default: [40, 240, 40]
high_value:
name: upper limit
name: Above this value use the "high Color".
selector:
number:
mode: box
@ -88,8 +91,7 @@ blueprint:
description: Text color for values above the defined value
selector:
color_rgb:
default: [240, 40, 40]
default: [240, 40, 40]
variables:
display: !input ehmtx_device
@ -98,17 +100,19 @@ variables:
lo_color: !input low_color
hi_color: !input high_color
mode: queued
trigger:
- platform: state
entity_id: !input trigger_sensor
action:
- mode: parallel
- if:
- condition: template
value_template: "{{ not use_colors }}"
then:
- service: esphome.{{ device_attr(display, "name") }}_icon_screen
- service: |-
esphome.{{ device_attr(display, "name") }}_icon_screen
data:
icon_name: !input icon_name
screen_time: !input screen_time
@ -133,7 +137,8 @@ action:
entity_id: !input trigger_sensor
below: !input low_value
sequence:
- service: esphome.{{ device_attr(display, "name") }}_icon_screen
- service: |-
esphome.{{ device_attr(display, "name") }}_icon_screen
data:
icon_name: !input icon_name
screen_time: !input screen_time
@ -156,7 +161,8 @@ action:
entity_id: !input trigger_sensor
above: !input high_value
sequence:
- service: esphome.{{ device_attr(display, "name") }}_icon_screen
- service: |-
esphome.{{ device_attr(display, "name") }}_icon_screen
data:
icon_name: !input icon_name
screen_time: !input screen_time
@ -175,7 +181,8 @@ action:
b: |-
{{ hi_color[2] }}
default:
- service: esphome.{{ device_attr(display, "name") }}_icon_screen
- service: |-
esphome.{{ device_attr(display, "name") }}_icon_screen
data:
icon_name: !input icon_name
screen_time: !input screen_time

Loading…
Cancel
Save