diff --git a/README.md b/README.md index 9272f32..419419d 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,9 @@ There are some "RGB-matrix" status displays/clocks out there, the commercial one - [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) - [PixelIt](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 +- [lamatrix](https://github.com/noahwilliamsson/lamatrix/tree/master) micropython based an around 5 years old 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 poolthermometer or as mediaplayer. All done by the magical power of esphome. @@ -29,7 +31,6 @@ Another german tutorial video focused at the Ulanzi [Smarte Pixel Clock über Ho See this [nice article](https://blakadder.com/esphome-pixel-clock/) about EsphoMaTrix on a Ulanzi TC001 from [blakadder](https://github.com/blakadder). Short video on Instagram [@blak_adder](https://www.instagram.com/reel/CpYVByRIaSI) -https://www.instagram.com/reel/CpYVByRIaSI See this english discussions: [Share your projects](https://community.home-assistant.io/t/esphomatrix-a-simple-clock-status-display/425325) @@ -82,7 +83,7 @@ The device should boot ![boot](images/booting.png) -and after a while (~30 seconds) it should display the correct time +and after a while (~30 seconds) it should display the correct time ![clock screen](images/clock_screen.png). @@ -97,7 +98,7 @@ This is for the more advanced users. If you unterstand the concept of esphome yo You can add screens to a queue and all this screens are displayed one after another. ![timing](./images/timingv2.png) Each screen can display different informations or is of a different kind. 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](#elements). -You can add screens from home assistant with services or from esphome via yaml. +You can add screens from home assistant with services or from esphome via yaml. #### Screen types @@ -137,7 +138,7 @@ void icon_screen(std::string icon, std::string text, int lifetime=D_LIFETIME, in For 8x32 icons or animations -Fullscreen +![fullscreen](./images/fullscreen.png) ###### service @@ -149,7 +150,6 @@ For 8x32 icons or animations void EHMTX::fullscreen(std::string iconname, int lifetime, int screen_time) ``` - #### Installation ##### **EspHoMaTriXv2** custom component @@ -303,6 +303,8 @@ Download and install all needed icons (.jpg/.png) and animations (.gif) under th You can also specify an URL to directly download the image file. The URLs will only be downloaded once at compile time, so there is no additional traffic on the hosting website. +The [icons](awtrix.blueforcer.de/icons) and [animations](https://awtrix.blueforcer.de/animations) from the awtrix and atrix-light could be used, but have to be scaled down to 8x32 or 8x8 pixels. Check the licence befor using them! + There are maximum 90 icons possible. ***Sample*** @@ -375,19 +377,19 @@ ehmtx: **screen_time** (optional, seconds): default duration to display a screen or a clock/date sequence, a long text will be scrolled at least `scroll_count` times (default: 10 seconds). This may be overwritten by the add_screen service. -**hold_time** (optional, seconds): extends the display time of the current screen in seconds (default=20). Used in services or automations, see `hold_screen` +**hold_time** (optional, seconds): extends the display time of the current screen in seconds (default=20). Used in services or automations, see `hold_screen` **date_format** (optional, string): formats the date display with [strftime syntax](https://esphome.io/components/time.html?highlight=strftime), defaults `"%d.%m."` (use `"%m.%d."` for the US) -**show_seconds** (optional, boolean): toggle an indicator for seconds while the clock is displayed (default: false)) +**show_seconds** (optional, boolean): toggle an indicator for seconds while the clock is displayed (default: false)) **time_format** (optional, string): formats the date display with [strftime syntax](https://esphome.io/components/time.html?highlight=strftime), defaults `"%H:%M"` (use `"%I:%M%p"` for the US) -**default_font_yoffset** (optional, pixel): yoffset the text is aligned BASELINE_LEFT, the baseline defaults to `6` +**default_font_yoffset** (optional, pixel): yoffset the text is aligned BASELINE_LEFT, the baseline defaults to `6` **default_font_xoffset** (optional, pixel): xoffset the text is aligned BASELINE_LEFT, the left defaults to `1` -**special_font_yoffset** (optional, pixel): yoffset the text is aligned BASELINE_LEFT, the baseline defaults to `6` +**special_font_yoffset** (optional, pixel): yoffset the text is aligned BASELINE_LEFT, the baseline defaults to `6` **special_font_xoffset** (optional, pixel): xoffset the text is aligned BASELINE_LEFT, the left defaults to `1` @@ -403,11 +405,11 @@ ehmtx: **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``` from 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``` from the [display](https://esphome.io/components/display/addressable_light.html). Can be overwritten per icon/gif see [icons](#icons-and-animations) parameter `frame_duration` -**icons2html** (optional, boolean): If true, generate the html (_filename_.html) file to show all included icons. (default = `false`) +**icons2html** (optional, boolean): If true, generate the html (*filename*.html) file to show all included icons. (default = `false`) ***Example output:*** ![icon preview](./images/icons_preview.png) @@ -436,7 +438,7 @@ You can add screens locally and display data directly from any local sensor. See ##### Lambda -Take care that the ```char text[30];``` has enough space to store the formated text. +Take care that the ```char text[30];``` has enough space to store the formated text. ```yaml sensor: @@ -452,7 +454,6 @@ sensor: id(rgb8x32)->icon_screen("sun", text); // uses default values for color etc. ``` - #### Set (alarm/clock/gauge/text/today/weekday) color action Sets the default color of the selected element @@ -474,7 +475,7 @@ Force the selected [icon_screen](#icon-screen) ```icon_name``` to be displayed n ##### Change configuration during runtime -_Configuration variables/functions:_ +*Configuration variables/functions:* Experienced programmers can use this public methods: @@ -544,7 +545,7 @@ ehmtx: Sets the overall brightness of the display (`0..255`) -_parameters:_ +*parameters:* - ```brightness```: from dark to bright (`0..255`) (default = `80`) as set in the light component by ```color_correct: [30%, 30%, 30%]``` @@ -564,7 +565,6 @@ number: id(rgb8x32)->set_brightness(x); ``` - **(D)** Service **del_screen** Removes a screen from the display by icon name. If this screen is actually display while sending this command the screen will be displayed until its "show_screen"-time has ended. @@ -573,7 +573,7 @@ optionally you can suffix a * to the icon name to perform a wildcard delete whic For example if you have multiple icons named weather_sunny, weather_rain & weather_cloudy, you can issue a del_screen weather_* to remove whichever screen is currently in a slot and replace it with a new weather screen. -_parameters:_ +*parameters:* - ```icon_name```: Icon `id` defined in the yaml (see installation) - ```mode```: The mode is for internal purposes use 5 for icon_screen @@ -584,7 +584,7 @@ Turns indicator on/off Display a colored corner on all screens and the clock. You can define the color by parameter. -_parameters:_ +*parameters:* - ```r``` red in 0..255 - ```g``` green in 0..255 @@ -637,7 +637,7 @@ Displays the current screen for configured ammount (see **hold_time**) (default= e.g. on the Ulanzi TC001 -``` +```yaml binary_sensor: - platform: gpio pin: @@ -670,7 +670,7 @@ Service **show_gauge** / **del_gauge_off** **(D)** Turns gauge on/off Displays a colored gauge at the left side of the display. You can define the color by parameter. -_parameters:_ +*parameters:* - ```percent``` gauge percentage @@ -877,7 +877,6 @@ sensor: ## Breaking changes - ## Usage The integration works with the Home Assistant api so, after boot of the device, it takes a few seconds until the service calls start working. If you see a growing green rectangle after boot you have to wait a bit until the api is connected etc. @@ -897,6 +896,7 @@ THE SOFTWARE IS PROVIDED "AS IS", use at your own risk! - **[wsbtak](https://github.com/wsbtak)** for the work on the ulanzi hardware - **[ofirsnb](https://github.com/ofirsnb)** for his contributions - **[darkpoet78](https://github.com/darkpoet78/MatrixClockFonts)** for his work on optimized fonts +- **[pplucky](https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif)** for his 8x32 gif animation - ** everbody that found bugs/issues and reported them! ## Special thanks to all sponsors diff --git a/components/ehmtx/EHMTX_queue.cpp b/components/ehmtx/EHMTX_queue.cpp index ab358fc..23eb957 100644 --- a/components/ehmtx/EHMTX_queue.cpp +++ b/components/ehmtx/EHMTX_queue.cpp @@ -25,7 +25,7 @@ namespace esphome ESP_LOGD(TAG, "queue: empty slot"); break; case MODE_BLANK: - ESP_LOGD(TAG, "queue: show empty screen"); + ESP_LOGD(TAG, "queue: show blank screen"); break; case MODE_CLOCK: ESP_LOGD(TAG, "queue: show clock for %d sec", this->screen_time); diff --git a/components/ehmtx/BP del_screen.yaml b/copy2esphome/EHMTX_easy_delete.yaml similarity index 64% rename from components/ehmtx/BP del_screen.yaml rename to copy2esphome/EHMTX_easy_delete.yaml index a33e600..44f53dc 100644 --- a/components/ehmtx/BP del_screen.yaml +++ b/copy2esphome/EHMTX_easy_delete.yaml @@ -1,6 +1,6 @@ blueprint: name: |- - ehmtxv2':' delete screen from 8x32 RGB-display + 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 domain: automation input: @@ -35,87 +35,8 @@ blueprint: select: mode: dropdown options: - [ - "*", - "error", - "github", - "precipitation", - "nina", - "waschmaschine", - "car", - "lamp", - "sonos", - "print3d", - "internet", - "speaker", - "alien", - "temp", - "garage", - "door", - "wind", - "rain", - "shop", - "phone", - "fire", - "alexa", - "tv", - "frost", - "muell", - "cookit", - "nature", - "work", - "bike", - "school", - "amazon", - "post", - "money", - "power", - "solar", - "yoga", - "startrek", - "energy", - "sun", - "diesel", - "benzine10", - "vacuum", - "rainprecip", - "iss", - "thunder", - "nina_warning", - "birthday", - "firework", - "coffee", - "lightning", - "xmastree", - "sauna", - "trash_grey", - "trash_blue", - "trash_yell", - "trash_brow", - "weather_clear_night", - "weather_cloudy", - "weather_fog", - "weather_lightingrainy", - "weather_partlycloudy", - "weather_pouring", - "weather_rainy", - "weather_snowy", - "weather_snowy_rainy", - "weather_sunny", - "f_mario", - "f_onair", - "f_bat", - "f_matrix", - "f_invaders", - "f_amongus", - "theodor", - "f_sleeping", - "mops", - "girl", - "timer", - "lasticon", - ] - default: homeassistant + ["*","error","home_assistant","temperature","lightbulb","music","phone","car","sleep8x32",] + default: home_assistant low_value: name: below this vaule is a special color selector: diff --git a/copy2esphome/EHMTX_easy_hide.yaml b/copy2esphome/EHMTX_easy_hide.yaml new file mode 100644 index 0000000..ff5f882 --- /dev/null +++ b/copy2esphome/EHMTX_easy_hide.yaml @@ -0,0 +1,52 @@ +blueprint: + name: |- + ehmtxv2: hide screen elements to 8x32 RGB-display + description: removes the gauge,indicator or alarm element from your display + domain: automation + input: + ehmtx_device: + name: which device to display at + selector: + device: + integration: esphome + element: + name: the element + selector: + select: + custom_value: true + mode: dropdown + options: + - label: alarm + value: hide_alarm + - label: gauge + value: hide_gauge + - label: indicator + value: hide_indicator + default: hide_indicator + 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 + sercice: !input element + value: !input gauge_value + +trigger: + - platform: state + entity_id: !input trigger_sensor + +action: + - service: esphome.{{ device_attr(display, "name") }}_{{service}} + data: + value: {{ value }} + r: |- + {{ element_color[0] }} + g: |- + {{ element_color[1] }} + b: |- + {{ element_color[2] }} \ No newline at end of file diff --git a/copy2esphome/EHMTX_easy_show.yaml b/copy2esphome/EHMTX_easy_show.yaml new file mode 100644 index 0000000..bb23bba --- /dev/null +++ b/copy2esphome/EHMTX_easy_show.yaml @@ -0,0 +1,58 @@ +blueprint: + name: |- + ehmtxv2: show screen elements to 8x32 RGB-display + description: add a gauge,indicator or alarm element to your display + domain: automation + input: + ehmtx_device: + name: which device to display at + selector: + device: + integration: esphome + element: + name: the element + selector: + select: + custom_value: true + mode: dropdown + options: + - label: alarm + value: show_alarm + - label: gauge + value: show_gauge + - label: indicator + value: show_indicator + default: show_indicator + gauge_value: + name: the value on the gauge + selector: + number: + mode: slider + min: 0 + max: 100 + 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 + sercice: !input element + value: !input gauge_value + +trigger: + - platform: state + entity_id: !input trigger_sensor + +action: + - service: esphome.{{ device_attr(display, "name") }}_{{service}} + data: + r: |- + {{ element_color[0] }} + g: |- + {{ element_color[1] }} + b: |- + {{ element_color[2] }} \ No newline at end of file diff --git a/components/ehmtx/BP colored state.yaml b/copy2esphome/EHMTX_easy_state.yaml similarity index 72% rename from components/ehmtx/BP colored state.yaml rename to copy2esphome/EHMTX_easy_state.yaml index af98fb7..9c0d7ab 100644 --- a/components/ehmtx/BP colored state.yaml +++ b/copy2esphome/EHMTX_easy_state.yaml @@ -43,81 +43,8 @@ blueprint: select: mode: dropdown options: - [ - "error", - "lamp", - "sonos", - "print3d", - "internet", - "speaker", - "alien", - "temp", - "garage", - "door", - "wind", - "rain", - "shop", - "phone", - "fire", - "alexa", - "tv", - "frost", - "muell", - "cookit", - "nature", - "work", - "bike", - "school", - "amazon", - "post", - "money", - "power", - "solar", - "yoga", - "startrek", - "energy", - "sun", - "diesel", - "benzine10", - "vacuum", - "rainprecip", - "iss", - "thunder", - "nina_warning", - "birthday", - "firework", - "coffee", - "lightning", - "xmastree", - "sauna", - "trash_grey", - "trash_blue", - "trash_yell", - "trash_brow", - "weather_clear_night", - "weather_cloudy", - "weather_fog", - "weather_lightingrainy", - "weather_partlycloudy", - "weather_pouring", - "weather_rainy", - "weather_snowy", - "weather_snowy_rainy", - "weather_sunny", - "f_mario", - "f_onair", - "f_bat", - "f_matrix", - "f_invaders", - "f_amongus", - "theodor", - "f_sleeping", - "mops", - "girl", - "timer", - "lasticon", - ] - default: homeassistant + ["error","home_assistant","temperature","lightbulb","music","phone","car","sleep8x32",] + default: home_assistant use_colors: name: Use colors based on state values selector: diff --git a/EHMTXv2.ttf b/copy2esphome/EHMTXv2.ttf similarity index 100% rename from EHMTXv2.ttf rename to copy2esphome/EHMTXv2.ttf diff --git a/Ulanzi-simple.yaml b/copy2esphome/Ulanzi-simple.yaml similarity index 74% rename from Ulanzi-simple.yaml rename to copy2esphome/Ulanzi-simple.yaml index b7866d7..7ff2cf5 100644 --- a/Ulanzi-simple.yaml +++ b/copy2esphome/Ulanzi-simple.yaml @@ -18,7 +18,8 @@ substitutions: external_components: - source: type: git - url: https://github.com/lubeda/EsphoMaTrix + url: https://github.com/lubeda/EspHoMaTriXv2 + ref: release refresh: 60s components: [ ehmtx ] @@ -33,13 +34,11 @@ esp32: board: esp32dev font: - - file: MatrixClock-Chunky8.bdf + - file: EHMTXv2.ttf id: default_font glyphs: | - !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz@<>ß§/ - - file: MatrixClock-Chunky6.bdf - id: special_font - + !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz@<>ß§€/ + binary_sensor: - platform: status name: "$devicename Status" @@ -61,9 +60,8 @@ binary_sensor: name: "Right button" logger: - level: WARNING + level: DEBUG -# Enable Home Assistant API api: services: - service: alarm @@ -72,14 +70,15 @@ api: text: string then: lambda: |- - id(rgb8x32)->add_icon_screen(icon_name,text, 5, 30, true, true, 200, 50, 50); - id(rgb8x32)->force_icon_screen(icon_name); + 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: - id(rgb8x32)->add_icon_screen(icon_name,text, 5, 20, false, true, 240, 240, 240); + lambda: |- + id(rgb8x32)->icon_screen(icon_name,text); - service: tune variables: tune: string @@ -127,6 +126,19 @@ sensor: filters: - lambda: |- return (x / 10000.0) * 2000000.0 - 15 ; + on_value_range: + - below: 100.0 + then: + lambda: |- + id(rgb8x32)->set_brightness(20); + - below: 250.0 + then: + lambda: |- + id(rgb8x32)->set_brightness(40); + - above: 250.0 + then: + lambda: |- + id(rgb8x32)->set_brightness(80); ota: password: !secret ota_password @@ -160,7 +172,7 @@ light: pin: $ledpin num_leds: 256 color_correct: [30%, 30%, 30%] - gamma_correction: 1.0 + gamma_correct: 2.0 name: "$devicename Light" restore_mode: ALWAYS_OFF @@ -179,7 +191,6 @@ display: addressable_light_id: ehmtx_light width: 32 height: 8 - internal: true pixel_mapper: |- if (y % 2 == 0) { return (y * 32) + x; @@ -194,14 +205,32 @@ display: ehmtx: id: rgb8x32 - clock_time: 8 + clock_time: 10 screen_time: 10 - hold_time: 27 + hold_time: 30 icons2html: true - yoffset: 7 + default_font_yoffset: 6 matrix_component: ehmtx_display time_component: ehmtx_time time_format: "%H:%M" + date_format: "%d.%m." show_seconds: false - font_id: special_font - icons: !include ehmtx_icons.yaml + default_font_id: default_font + special_font_id: default_font # for starters yust one font + icons: + - id: error + lameid: 40530 + - id: home_assistant + lameid: 47693 + - id: temperature + lameid: 2056 + - id: lightbulb + lameid: 1762 + - id: music + lameid: 45625 + - id: phone + lameid: 1232 + - id: car + lameid: 2819 + - id: sleep8x32 + url: https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif