From 92291d727b4091bca8bf43e148cbf0fd38d37462 Mon Sep 17 00:00:00 2001 From: LuBeDa Date: Sun, 7 May 2023 14:14:13 +0200 Subject: [PATCH 1/6] on_icon_error --- components/ehmtxv2/EHMTX.cpp | 18 ++++++++++++++++++ components/ehmtxv2/EHMTX.h | 13 ++++++++++++- components/ehmtxv2/__init__.py | 15 ++++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index 45d77f6..a643f32 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -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); @@ -551,6 +556,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; @@ -599,6 +608,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); @@ -881,6 +894,11 @@ namespace esphome this->trigger(iconname, text); } + void EHMTXIconErrorTrigger::process(std::string iconname) + { + this->trigger(iconname); + } + void EHMTXExpiredScreenTrigger::process(std::string iconname, std::string text) { this->trigger(iconname, text); diff --git a/components/ehmtxv2/EHMTX.h b/components/ehmtxv2/EHMTX.h index 1da158b..fd6a7a8 100644 --- a/components/ehmtxv2/EHMTX.h +++ b/components/ehmtxv2/EHMTX.h @@ -30,6 +30,7 @@ namespace esphome class EHMTX_queue; class EHMTX_Icon; class EHMTXNextScreenTrigger; + class EHMTXIconErrorTrigger; class EHMTXExpiredScreenTrigger; class EHMTXNextClockTrigger; @@ -43,6 +44,7 @@ namespace esphome bool show_day_of_week; std::vector on_next_screen_triggers_; + std::vector on_icon_error_triggers_; std::vector on_expired_screen_triggers_; std::vector on_next_clock_triggers_; EHMTX_queue *find_icon_queue_element(uint8_t icon); @@ -127,7 +129,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 +152,7 @@ namespace esphome void draw_indicator(); void add_on_next_screen_trigger(EHMTXNextScreenTrigger *t) { this->on_next_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 +200,14 @@ namespace esphome void process(std::string, std::string); }; + class EHMTXIconErrorTrigger : public Trigger + { + public: + explicit EHMTXIconErrorTrigger(EHMTX *parent) { parent->add_on_icon_error_trigger(this); } + void process(std::string); + }; + + class EHMTXExpiredScreenTrigger : public Trigger { public: diff --git a/components/ehmtxv2/__init__.py b/components/ehmtxv2/__init__.py index c97fb2b..7bc8467 100644 --- a/components/ehmtxv2/__init__.py +++ b/components/ehmtxv2/__init__.py @@ -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,6 @@ NextClockTrigger = ehmtx_ns.class_( "EHMTXNextClockTrigger", automation.Trigger.template(cg.std_string) ) -CONF_EHMTX = "ehmtx" CONF_URL = "url" CONF_FLAG = "flag" CONF_TIMECOMPONENT = "time_component" @@ -77,6 +80,7 @@ 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_EXPIRED_SCREEN= "on_expired_screen" CONF_SHOW_SECONDS = "show_seconds" CONF_WEEK_START_MONDAY = "week_start_monday" @@ -141,6 +145,11 @@ 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_EXPIRED_SCREEN): automation.validate_automation( { cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(NextScreenTrigger), @@ -361,4 +370,8 @@ async def to_code(config): trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var) await automation.build_automation(trigger, [(cg.std_string, "x"), (cg.std_string, "y")] , 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, "x")] , conf) + await cg.register_component(var, config) From 125d0c2d5501cd20154897e1671d07f35397a66c Mon Sep 17 00:00:00 2001 From: LuBeDa Date: Sun, 7 May 2023 15:08:27 +0200 Subject: [PATCH 2/6] trigger ON_ADD_SCREEN --- README.md | 55 +++++++++++++++++++++++++++++----- components/ehmtxv2/EHMTX.cpp | 9 ++++++ components/ehmtxv2/EHMTX.h | 10 +++++++ components/ehmtxv2/__init__.py | 20 +++++++++++-- 4 files changed, 84 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f5bfee8..8daf7f9 100644 --- a/README.md +++ b/README.md @@ -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,8 +675,8 @@ 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 @@ -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*** diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index a643f32..6050cba 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -518,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(); } @@ -894,6 +898,11 @@ 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); diff --git a/components/ehmtxv2/EHMTX.h b/components/ehmtxv2/EHMTX.h index fd6a7a8..7ed5507 100644 --- a/components/ehmtxv2/EHMTX.h +++ b/components/ehmtxv2/EHMTX.h @@ -30,6 +30,7 @@ namespace esphome class EHMTX_queue; class EHMTX_Icon; class EHMTXNextScreenTrigger; + class EHMTXAddScreenTrigger; class EHMTXIconErrorTrigger; class EHMTXExpiredScreenTrigger; class EHMTXNextClockTrigger; @@ -47,6 +48,7 @@ namespace esphome std::vector on_icon_error_triggers_; std::vector on_expired_screen_triggers_; std::vector on_next_clock_triggers_; + std::vector on_add_screen_triggers_; EHMTX_queue *find_icon_queue_element(uint8_t icon); EHMTX_queue *find_free_queue_element(); @@ -152,6 +154,7 @@ 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); } @@ -200,6 +203,13 @@ namespace esphome void process(std::string, std::string); }; + class EHMTXAddScreenTrigger : public Trigger + { + public: + explicit EHMTXAddScreenTrigger(EHMTX *parent) { parent->add_on_add_screen_trigger(this); } + void process(std::string, uint8_t); + }; + class EHMTXIconErrorTrigger : public Trigger { public: diff --git a/components/ehmtxv2/__init__.py b/components/ehmtxv2/__init__.py index 7bc8467..add1e5d 100644 --- a/components/ehmtxv2/__init__.py +++ b/components/ehmtxv2/__init__.py @@ -53,6 +53,10 @@ NextClockTrigger = ehmtx_ns.class_( "EHMTXNextClockTrigger", automation.Trigger.template(cg.std_string) ) +AddScreenTrigger = ehmtx_ns.class_( + "EHMTXAddScreenTrigger", automation.Trigger.template(cg.std_string) +) + CONF_URL = "url" CONF_FLAG = "flag" CONF_TIMECOMPONENT = "time_component" @@ -81,6 +85,7 @@ 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" @@ -150,6 +155,11 @@ EHMTX_SCHEMA = cv.Schema({ 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), @@ -360,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) @@ -368,10 +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, "x")] , conf) + 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) From 3d0ad21e8f58be7df2c60f50558c816a873790c5 Mon Sep 17 00:00:00 2001 From: LuBeDa Date: Sun, 7 May 2023 18:47:56 +0200 Subject: [PATCH 3/6] spell and gramar --- README.md | 80 ++++++++++++++++++------------------ TODO.md | 34 +++++++-------- components/ehmtxv2/EHMTX.cpp | 8 ++++ 3 files changed, 65 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 8daf7f9..607cf10 100644 --- a/README.md +++ b/README.md @@ -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 @@ -24,7 +24,7 @@ There are some "RGB-matrices" status displays/clocks out there, the commercial o 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"); @@ -681,7 +681,7 @@ ehmtxv2: ##### 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: @@ -791,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 @@ -846,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 @@ -957,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 @@ -995,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: @@ -1022,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). diff --git a/TODO.md b/TODO.md index 5561f64..d344d1b 100644 --- a/TODO.md +++ b/TODO.md @@ -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] 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 diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index 6050cba..a739f6f 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -574,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(); } @@ -625,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(); } From 9d07ff7083650e3f2f6a2fa1524a6a6973d54428 Mon Sep 17 00:00:00 2001 From: LuBeDa Date: Sun, 7 May 2023 19:08:42 +0200 Subject: [PATCH 4/6] nice things up --- .github/ISSUE_TEMPLATE/bug_report.md | 51 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 27 ++++++++++++ .github/ISSUE_TEMPLATE/question.md | 29 ++++++++++++ .gitignore | 4 ++ 8x32 iMAGE.xcf | Bin 7272 -> 8970 bytes TODO.md | 2 +- 6 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/question.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..0cc06c5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,51 @@ +--- +name: Bug report +about: Create a detailed report to help us improve +title: "[BUG]" +labels: bug +assignees: '' +--- + + + +# Bug report + +## Describe the bug + +Add a description of the bug. Detail the expected behaviour in contrast with the behaviour you're observing. + +## Additional information + +- used Hardware: + - ESP32 or ESP8266 + - EspHoMaTriXv2 version: [ eg. 2023.5.0 ] + +## To Reproduce + +Steps to reproduce the behavior: + +## Expected behavior + +A clear and concise description of what you expected to happen. + +## Configuration + +```text +(optional) The YAML you used in epshome without any password +``` + +## Screenshots + +If applicable, add screenshots to help explain your problem. + +## Logs + +```text +(optional) Add relevant logs which could help tackle the problem. +``` + +## Services calls + +```text +(optional) The YAML of your service calls +``` \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..381ff74 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,27 @@ +--- +name: Feature request +about: Suggest an idea for this EspHoMaTriXv2 +title: "[FEATURE REQUEST]" +labels: feature request +assignees: '' +--- + + + +# Feature Request + +### Is your feature request related to a problem? + +If so, then add a clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +### Describe the solution / feature you'd like + +A clear and concise description of what you want to happen. Add scribbles to explain your wish. + +### Describe alternatives you've considered + +A clear and concise description of any alternative solutions or features you've considered. + +### Additional context + +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..da09395 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,29 @@ +--- +name: Question +about: Open an issue to ask something +title: "[QUESTION]" +labels: question +assignees: '' +--- + + + +# Question + +Add here your question. + +## Additional information + +- used Hardware: + - ESP32 or ESP8266 + - EspHoMaTriXv2 version: [ eg. 2023.5.0 ] + +## Logs + +```text +(optional) Add relevant logs which could help tackle the problem. +``` + +## Additional context + +Add any other context about the problem here. diff --git a/.gitignore b/.gitignore index cb9cd4d..7449912 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,7 @@ servicetest .DS_Store components/ehmtxv2/animation.py downloadawtrixicons.ps1 +ltr1.png +ltr2.png +ltr3.png +8x32 iMAGE.xcf diff --git a/8x32 iMAGE.xcf b/8x32 iMAGE.xcf index 2b8861657a2fb03212f111d9f9f17b19f0c8ed55..aafe1322440990ef5db6b2482249f6bb7ba9f33f 100644 GIT binary patch delta 1879 zcmbVNO=uHA6rO!eo5aQ@+f6rrZJLH^q#(8yifFN5i5F4OqV*&q;-QKG=~0LWp`ZxD zpx(TARj3UfJP2M?EF$)%Cl#fncoI=+)4G21v)TNq*dZ_P&3p6Sd^_LU+47!i2X7uQ zt~{Kyjp8DcqwSH>9b-xdN=kQ*D&3V;I(%Dc>$=kM6G|tQVySn^=zFd7z;hj_RRK(d z7>w~-ks)44-sk7dFwqNs*-R3B;um{tq6(ikUv3Smg{=L;?4?ouwQEo;FY0aGs=fu+ zg3drhmJcG7h9V~!{EHZdZ&_)^CK)-M%yA+Rg1yQdCVvt3Ov8vuzwy%^Q$b+_351|GXZ}|6lcD00N(m&lI2A99!`ZJnI zvyn-&iOEP4lWvm7WExBkqn}iJxbbRx{IRIVq?=P$vn*>$Ce0=$QM7?cAgyN-MJ4+l zlK`3%MK>HqqLX`SyEw{z=q{EmY>8FX_T3?t)}i}2EKV~AseScET-JU{)~4JOS2{Rf zGj~%pYr$77VsHgNyZ*!afMboU#hO^Nn^<#`yk{5$Yvb(yi+YFBvSwM1Ss-Vrg~vD4eTqig+ne(;4TFjWr65 z@g=hOe7m1Q$6(qNnklW&0#P_!jfD5gNcdQ3sr?R-`GwB}lF4qrOAT}s(xv9z{iVBs zm9{Z^OHF(y>^MZzZEtT8gUjAudJ?kQC^1#tJW-IFC+2uZir56OKb?yH27K4$ A?f?J) delta 729 zcmeBjdtoubi7{xSvlwIKE(S1QSqY)pWFa({5QOHt3!w$tA+%5tgcb>g&|)4CTFL-I z!$|3p$%4|tlkK?QF){50Gvg%LnV4<@nPN;#A2%oQY+_#&K z2h$+^Kr8{o zP~ALhC(DV6aq=7m$pOLS^WyEBkBGH0G4bDmyN3T8*fj!tlj|j0CZAnjr)SkOE;K5Zp1DNA~DsW+~Chery_(-!iWe41&nONa1q0Ey9z* zwg|7@tSP;gkx4WPY_w<@Oev5?GFr56GmoqcGn2%c$yy3hQW7VSl&J#QG7!GRgUN9U z5zO^W9h3Je1cGT%MFoaCMow;Gads+@4+~QUHYmFuNGpQa_6(CBFq=-!k>ZJf#T?K`1_2<3TB!zP@&GY1 l07Wz?nm|gCfD9;YDF89Z4Ny55A5hrw$)o^ Date: Mon, 8 May 2023 17:02:48 +0200 Subject: [PATCH 5/6] =?UTF-8?q?Message=20malformed:=20Unable=20to=20determ?= =?UTF-8?q?ine=20action=20@=20data[=E2=80=98action=E2=80=99][0]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +-- copy2esphome/EHMTX_easy_state.yaml | 53 +++++++++++++++++------------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 607cf10..3c07f29 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ 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. diff --git a/copy2esphome/EHMTX_easy_state.yaml b/copy2esphome/EHMTX_easy_state.yaml index bd2dd05..a275865 100644 --- a/copy2esphome/EHMTX_easy_state.yaml +++ b/copy2esphome/EHMTX_easy_state.yaml @@ -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 From b96392f43c9300604e115f5c1cb8d076753b031e Mon Sep 17 00:00:00 2001 From: LuBeDa Date: Mon, 8 May 2023 19:31:13 +0200 Subject: [PATCH 6/6] fixed blueprints --- copy2esphome/EHMTX_easy_delete.yaml | 33 ++++++++++------------------- copy2esphome/EHMTX_easy_hide.yaml | 17 ++++++++------- copy2esphome/EHMTX_easy_show.yaml | 30 ++++++++++++++------------ 3 files changed, 37 insertions(+), 43 deletions(-) diff --git a/copy2esphome/EHMTX_easy_delete.yaml b/copy2esphome/EHMTX_easy_delete.yaml index 0fcdedf..e33872f 100644 --- a/copy2esphome/EHMTX_easy_delete.yaml +++ b/copy2esphome/EHMTX_easy_delete.yaml @@ -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 diff --git a/copy2esphome/EHMTX_easy_hide.yaml b/copy2esphome/EHMTX_easy_hide.yaml index 370ae1e..586bcd5 100644 --- a/copy2esphome/EHMTX_easy_hide.yaml +++ b/copy2esphome/EHMTX_easy_hide.yaml @@ -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}} diff --git a/copy2esphome/EHMTX_easy_show.yaml b/copy2esphome/EHMTX_easy_show.yaml index 7df0cd4..92b8108 100644 --- a/copy2esphome/EHMTX_easy_show.yaml +++ b/copy2esphome/EHMTX_easy_show.yaml @@ -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 }} \ No newline at end of file