diff --git a/.gitignore b/.gitignore index 838d2d9..cb9cd4d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ svganimtest.html servicetest .DS_Store components/ehmtxv2/animation.py +downloadawtrixicons.ps1 diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index ca39ff5..41e4595 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -36,11 +36,11 @@ namespace esphome this->date_fmt = s; } - void EHMTX::show_indicator(int r, int g, int b, int s) + void EHMTX::show_indicator(int r, int g, int b, int size) { this->indicator_color = Color((uint8_t)r & 248, (uint8_t)g & 252, (uint8_t)b & 248); - this->display_indicator = s; - ESP_LOGD(TAG, "show indicator size:%d r: %d g: %d b: %d", s, r, g, b); + this->display_indicator = size; + ESP_LOGD(TAG, "show indicator size: %d r: %d g: %d b: %d", size, r, g, b); } void EHMTX::hide_indicator() @@ -157,8 +157,8 @@ namespace esphome register_service(&EHMTX::hide_gauge, "hide_gauge"); register_service(&EHMTX::hide_alarm, "hide_alarm"); register_service(&EHMTX::show_gauge, "show_gauge", {"percent", "r", "g", "b"}); - register_service(&EHMTX::show_alarm, "show_alarm", {"r", "g", "b", "s"}); - register_service(&EHMTX::show_indicator, "show_indicator", {"r", "g", "b", "s"}); + register_service(&EHMTX::show_alarm, "show_alarm", {"r", "g", "b", "size"}); + register_service(&EHMTX::show_indicator, "show_indicator", {"r", "g", "b", "size"}); register_service(&EHMTX::set_clock_color, "clock_color", {"r", "g", "b"}); register_service(&EHMTX::set_today_color, "today_color", {"r", "g", "b"}); @@ -181,11 +181,11 @@ namespace esphome ESP_LOGD(TAG, "Setup and running!"); } - void EHMTX::show_alarm(int r, int g, int b, int s) + void EHMTX::show_alarm(int r, int g, int b, int size) { this->alarm_color = Color((uint8_t)r & 248, (uint8_t)g & 252, (uint8_t)b & 248); - this->display_alarm = s; - ESP_LOGD(TAG, "show alarm color(%d) r: %d g: %d b: %d", s, r, g, b); + this->display_alarm = size; + ESP_LOGD(TAG, "show alarm size: %d color r: %d g: %d b: %d", size, r, g, b); } void EHMTX::hide_alarm() diff --git a/copy2esphome/EHMTX_easy_delete.yaml b/copy2esphome/EHMTX_easy_delete.yaml index d993df2..d41bcb0 100644 --- a/copy2esphome/EHMTX_easy_delete.yaml +++ b/copy2esphome/EHMTX_easy_delete.yaml @@ -38,6 +38,8 @@ blueprint: value: "7" - label: MODE_RAINBOW_TEXT value: "8" + - label: MODE_RAINBOW_CLOCK + value: "9" default: "5" icon_name: name: the icon diff --git a/copy2esphome/EHMTX_easy_show.yaml b/copy2esphome/EHMTX_easy_show.yaml index 372fcb9..0ae01dd 100644 --- a/copy2esphome/EHMTX_easy_show.yaml +++ b/copy2esphome/EHMTX_easy_show.yaml @@ -11,7 +11,7 @@ blueprint: integration: esphome trigger_sensor: name: which state to show - description: This sensor state will be displayed + description: what triggers this automation? selector: entity: domain: sensor @@ -37,29 +37,54 @@ blueprint: min: 0 max: 100 default: 50 + size_value: + name: size of the alarm or indicator + selector: + number: + mode: slider + min: 1 + max: 3 + default: 2 element_color: name: The color for the element description: the color selector: color_rgb: default: [240, 40, 40] - variables: display: !input ehmtx_device element_color: !input element_color myservice: !input element value: !input gauge_value - + size: !input size_value trigger: - platform: state entity_id: !input trigger_sensor - action: - - service: esphome.{{ device_attr(display, "name") }}_{{ myservice }} - data: - r: |- - {{ element_color[0] }} - g: |- - {{ element_color[1] }} - b: |- - {{ element_color[2] }} \ No newline at end of file + - if: + - condition: template + value_template: |- + {{ myservice != "show_gauge" }} + then: + - service: esphome.{{ device_attr(display, "name") }}_{{ myservice }} + data: + r: |- + {{ element_color[0] }} + g: |- + {{ element_color[1] }} + b: |- + {{ element_color[2] }} + size: |- + {{ size }} + else: + - service: esphome.{{ device_attr(display, "name") }}_{{ myservice }} + data: + r: |- + {{ element_color[0] }} + g: |- + {{ element_color[1] }} + b: |- + {{ element_color[2] }} + percent: |- + {{ element_color[2] }} + \ No newline at end of file diff --git a/copy2esphome/EHMTX_easy_state.yaml b/copy2esphome/EHMTX_easy_state.yaml index 6e35eb4..b6b6258 100644 --- a/copy2esphome/EHMTX_easy_state.yaml +++ b/copy2esphome/EHMTX_easy_state.yaml @@ -45,6 +45,11 @@ blueprint: options: ["error","home_assistant","temperature","lightbulb","music","phone","car","sleep8x32",] default: home_assistant + use_friendly: + name: use the triggers friendly name in display + selector: + boolean: + default: true default_font: name: true uses the default, false the special font selector: @@ -54,7 +59,7 @@ blueprint: name: Use colors based on state values selector: boolean: - default: true + default: false low_value: name: below this vaule is a special color selector: @@ -87,6 +92,7 @@ blueprint: variables: display: !input ehmtx_device + bfriendly: !input use_friendly def_color: !input default_color lo_color: !input low_color hi_color: !input high_color @@ -105,7 +111,12 @@ action: icon_name: !input icon_name screen_time: !input screen_time lifetime: !input lifetime - text: "{{trigger.to_state.attributes.friendly_name}}: {{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}" + text: |- + {% if bfriendly %} + {{trigger.to_state.attributes.friendly_name}}: {{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}} + {% else %} + {{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}} + {% endif %} default_font: !input default_font r: |- {{ def_color[0] }} diff --git a/copy2esphome/Ulanzi-simple.yaml b/copy2esphome/Ulanzi-simple.yaml index e42a450..f12e264 100644 --- a/copy2esphome/Ulanzi-simple.yaml +++ b/copy2esphome/Ulanzi-simple.yaml @@ -61,25 +61,9 @@ binary_sensor: name: "Right button" logger: - level: DEBUG + level: WARN api: - services: - - service: alarm - variables: - icon_name: string - text: string - then: - lambda: |- - id(rgb8x32)->icon_screen(icon_name,text, 5, 30, true, 200, 50, 50); - id(rgb8x32)->force_screen(icon_name); - - service: screen - variables: - icon_name: string - text: string - then: - lambda: |- - id(rgb8x32)->icon_screen(icon_name,text); - service: tune variables: tune: string @@ -204,7 +188,7 @@ display: id(rgb8x32)->tick(); id(rgb8x32)->draw(); -ehmtx: +ehmtxv2: id: rgb8x32 clock_time: 10 screen_time: 10 @@ -235,6 +219,8 @@ ehmtx: lameid: 2819 - id: sleep8x32 url: https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif + - id: sleep8x32 + url: https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif on_next_screen: - homeassistant.event: event: ehmtxv2.new_screen