Giter VIP home page Giter VIP logo

esphomatrix's Introduction

Important news

Take a look at the new version of the improved EspHoMaTriXv2!!!

This version is read-only!!!!

EspHoMaTriX (ehmtx)

Breaking changes in esphome 2023.7.0

Since the update ehmtx only compiles if you add some code to your yaml. See here: lubeda/EspHoMaTriXv2#62 (comment)

Important information

If you like my work, please donate me a star on GitHub and consider sponsoring me!!

Introduction

A simple DIY status display, built with a flexible 8x32 RGB LED panel implemented with esphome.io sample image

There are some “RGB-matrix” status displays/clocks out there, the commercial one from LaMetric and some excellent DIY-alternatives.

  • LaMetric commercial ~ €199
  • Ulanzi TC001 commercial ~ €50
  • Awtrix (project has been discontinued after more than 4 years now in August 2022)
  • PixelIt (project is under active development)
  • Awtrix-Light From the developer of Awtrix, optimized for the Ulanzi TC001 Hardware The other DIY  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. The main reason, for me, is the Home Assistant integration! There is a little hype around the Ulanzi TC001 pixel clock. This hardware can be used with EspHoMaTriX (with some limitations). You can connect the device and flash it via USB-C. As a starting point, you can use the UlanziTC001.yaml. Yet, the LDR and battery sensor are not perfectly supported. For another use of the hardware, see PixelIT_Ulanzi or AWTRIX-LIGHT firmware.

ehmtx in the media

See this German tutorial video with information on setting up your display RGB-LED Status Display für Home Assistant mit ESPHome | ESPHoMaTrix. Another german tutorial video focused at the Ulanzi Smarte Pixel Clock über Home Assistant steuern - Entitäten / Icons und mehr in der Ulanzi See this nice article about EsphoMaTrix on an Ulanzi TC001 from blakadder. Short video on Instagram @blak_adder https://www.instagram.com/reel/CpYVByRIaSI See these English discussions: Share your projects ESPHOME Or in German: Showroom

State

It is a working solution with core functionality coded. Advanced features, like automatic brightness control, can be done with esphome actions and automations. The possibilities are endless.

Features

Based on a 8x32 RGB flexible matrix, it displays a clock, the date and up to 24 other 'screens' provided by Home Assistant. Each screen (value/text) can be associated with a 8x8 bit RGB icon or GIF animation (see installation). The values/text can be updated or deleted from the display queue. Each screen has a lifetime, if not refreshed in its lifetime, it will disappear. When a screen is active, it is displayed so that the text can scroll twice (scroll_count) or even longer for screen_time seconds. You can use the fullfeature.yaml as a sample for an ESP8266. As mentioned, you have to edit to your needs. So check font, icons, board and the GPIO pins for your display. The file ulanziTC001.yaml uses the functions ehmtx provides, optimized for the Ulanzi Hardware. See it in action on YouTube (no sound but subtitles).

Installation

EsphoMaTrix custom component

EsphoMaTrix 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.

local use

If you download the components-folder from the repo and install it in your esphome you have a stable installation. But if there are new features, you won't see them. If needed, customize the YAML to your folder structure.

external_components:
   - source:
       type: local
       path: components # e.g. /config/esphome/components

use from repo

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.

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EsphoMaTrix
      ref: main # optional select a special branch or tag

Addressable_light component

The EsphoMaTrix component requires a 8x32 pixel addressable_light, it is referenced by the ID matrix_component. See the default options There are some different matrices-types on the market, to adapt them to EspHoMaTriX you have to find the proper pixel mapper. If there is garbage on your display, try the other pixel_mapper. Here are the most common types for flexible 8x32 matrices:

Type 1

under the display tag, specify this pixel mapper:

display:
  - platform: addressable_light
    .....
    pixel_mapper: |-
      if (x % 2 == 0) {
        return (x * 8) + y;
      }
      return (x * 8) + (7 - y);
    .....

Type 2 (e.g., Ulanzi TC001)

Under the display tag, specify this pixel mapper:

display:
  - platform: addressable_light
    .....
    pixel_mapper: |-
      if (y % 2 == 0) {
        return (y * 32) + x;
      }
      return (y * 32) + (31 - x);
    .....

You have to configure this lambda under the display: section to use the EsphoMaTrix component

display:
  - platform: addressable_light
    id: ehmtx_display
    .....
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

Light component

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 lambdason_turn_on and on_turn_off to the light component.

Sample

light:
  - platform: neopixelbus
    id: ehmtx_light
    ....
    on_turn_on:
      lambda: |-
         id(rgb8x32)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(rgb8x32)->set_enabled(true);

To hide the light component from home assistant use: internal: true

light:
  - platform: neopixelbus
    id: ehmtx_light
    internal: true
    ...

Time component

Since it is a clock, you need a time component, e.g., homeassistant. It is referenced by its ID under time_component: The display shows !t! until the time source is synchronized and valid.

Font

Download a small “pixel” TTF-font, I use "monobit.ttf". You can modify this font with FontForge and add on base of a E and so on. Due to copyright, I can't provide my modified version :-(. Not all fonts are suitable for this minimalistic display. There are public domain fonts which work well on the display, e.g., DMDSmall, details on alternative fonts are here. DarkPoet78 is providing special fonts for 8x32 matrices in his repo

font:
  - file: monobit.ttf
    id: EHMTX_font
    size: 16
    glyphs:  |
      !"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz€@

Icons and Animations

Download and install all needed icons (.jpg/.png) and animations (.gif) under the ehmtx: key. All icons have to be 8x8 or 8x32 pixels in size. If necessary, scale them with gimp, check “as animation” for GIFs. You can also specify a 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. There are maximum 90 icons possible.

Sample

emhtx:
  icons:
    - id: boot
      file: icons/rocket.gif
      duration: 75    
    - id: temp
      file: temperature.png
    - id: yoga
      file: icons/yoga-bridge.gif
      pingpong: true
    - id: garage
      file: garage.gif
      duration: 100
    - id: homeassistant
      url: https://github.com/home-assistant/assets/raw/master/logo/logo-small.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 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. 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

Configuration

ehmtx component

This component is highly customizable. Example

ehmtx:
  id: rgb8x32
  time_component: ehmtx_time
  matrix_component: ehmtx_display
  clock_time: 5    # seconds
  screen_time: 8   # seconds
  font_id: ehmtx_font
  show_dow: true   # day of week
  show_date: true  # also show the date
  icons2html: false # generate html with con overview
  brightness: 80 # percent
  time_format: "%H:%M"
  date_format: "%d.%m."
  week_start_monday: true # false equals sunday
  xoffset: 1
  yoffset: 2
  scroll_count: 2 # scroll long text at least two times
  scroll_interval: 80 # milliseconds
  frame_interval: 192 # milliseconds

Parameters

id (required, ID): Manually specify the ID used for code generation and in service definitions. clock_interval (optional, seconds): show the clock at least each x seconds, (default=60) clock_time (optional, seconds): duration to display the clock after this time, the date is displayed until next "show_screen". If show_date is false and clock_time > 0 the clock will be display as long as a normal screen! Setting clock_time to 0 will not show the clock or date. If there are no screens ind the queue, the display will be blank until the next screen is sent. timing 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 date_format (optional, string): formats the date display with strftime syntax, 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)) time_format (optional, string): formats the date display with strftime syntax, defaults "%H:%M" (use "%I:%M%p" for the US) yoffset (optional, pixel): yoffset the text is aligned BASELINE_LEFT, the baseline defaults to 6 xoffset (optional, pixel): xoffset the text is aligned BASELINE_LEFT, the left defaults to 1 matrix_component (required, ID): ID of the addressable display show_dow (optional, bool): draw the day of week indicator on the bottom of the clock screen. Disable, e.g., if you want larger fonts, defaults to true. show_date (optional, bool): if true, show the date for screen_time - clock_time seconds, otherwise only shows the clock for screen_time seconds, defaults to true. time_component (required, ID): ID of the time component. The display shows !t! until the time source is valid. font (required, ID): ID of the font component 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 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. It can be overwritten per icon/gif, see icons parameter frame_duration icons2html (optional, boolean): If true, generate the HTML (filename.html) file to show all included icons.  (default = false) Example output: icon preview

icons

Parameters See icon details

  • 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
  • lameid (Exclusive, number): the ID from the LaMetric icon database

Compile errors animation.h is missing

Error:
In file included from src/esphome.h:25,
                 from src/esphome/components/ehmtx/EHMTX.cpp:1:
src/esphome/components/ehmtx/EHMTX.h:6:10: fatal error: esphome/components/animation/animation.h: No such file or directory
 #include "esphome/components/animation/animation.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
... 

Solution

Add in your given YAML this Code at the end:

animation:
  - id: animation_black
    file: "black.gif"

image:
  - id: image_black
    file: "black.gif"

and copy furthermore the black.gif Picture to your esphome Folder (most under /config/esphome/) You will find this picture in the image Folder in this git.


Control your display

Plenty of the features are accessible with actions, you can use in your YAML

Local actions/lambdas

Show all icons on your matrix

This code shows all icons once on boot up, depending on the amount of your icons it can take a while to see them all.

esphome:
  ....
  on_boot:
    priority: -100
    # ...
    then:
      - lambda: !lambda |-
          id(rgb8x32)->show_all_icons();

Add screen to your display queue

You can add screens locally and display data directly from any local sensor. See this sample:

Lambda

Take care that the char text[30]; has enough space to store the formatted text.

sensor:
  - platform: bh1750
    id: sensorlx
    ...
    on_value:
      then:
        lambda: |-
          char text[30];
          sprintf(text,"Light: %2.1f lx", id(sensorlx).state);
          // 5 Minutes,each time at least 11 seconds,no alarm
           id(rgb8x32)->add_screen("sun", text, 5,11, false);
Action
sensor:
  - platform: bh1750
    id: sensorlx
    ...
    on_value:
      then:
        - ehtmx.add.screen
          id: rgb8x32
          icon_name: "sun"
          text: "new data from lux sensor"
          lifetime: 5 # minutes optional
          screen_time: 35 # seconds optional
          alarm: true # optional

Parameters

  • id (required, ID): ID of the ehmtx component
  • text (required, string): the text to display
  • icon_name (required, string): the name of the icon to display
  • lifetime (optional, int): the lifetime of the screen in minutes (default=5)
  • screen_time (optional, int): the display time of a screen per loop in seconds (default=10)
  • alarm (optional, bool): if alarm set true (default = false)

Set (alarm/clock/gauge/text/today/weekday) color action

Sets the color of the selected element

Lambda set text color
  lamda:
    id(rgb8x32)->set_text_color(200,45,12);
Action for set text color

You have to use the ID of your ehmtx component, e.g., rgb8x32

     - ehmtx.***.color:
        id: rgb8x32
        red: !lambda return r;
        green: !lambda return g;
        blue: !lambda return b;

valid elements:

  • ehmtx.alarm.color:
  • ehmtx.clock.color:
  • ehmtx.gauge.color:
  • ehmtx.text.color:
  • ehmtx.today.color:
  • ehmtx.weekday.color:
  • red, green, blue: the color components (0..255) (default = 80)

Set screen color action

Sets the color of the active screen in the queue, so it's best to use it directly after add_screen.

Lambda for set_screen
  lamda:
    id(rgb8x32)->set_screen_color("sun",200,45,12);

 

Action for set_screen

  You have to use the ID of your ehmtx component, e.g., rgb8x32  

     - ehmtx.screen.color:
        id: rgb8x32
        icon_name: sun
        red: !lambda return r;
        green: !lambda return g;
        blue: !lambda return b;

 

  • icon_name: name of the actual icon/screen
  • red, green, blue: the color components (0..255) (default = 80)  

 

Show date

  You can dynamically enable or disable the display of the date, see parameter show_date.  

    - ehmtx.show.date:
        id: rgb8x32
        flag: !lambda return true;

 

Show day of week

  You can dynamically enable or disable the display of the day of week, see parameter day_of_week.  

    - ehmtx.show.dayofweek:
        id: rgb8x32
        flag: !lambda return true;

 

Force screen

  Force the selected 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.  

    - ehmtx.force.screen:
        id: rgb8x32
        icon_name: !lambda return icon_name;

 

Change configuration during runtime

  Configuration variables/functions:   Experienced programmers can use these public methods:  

    void draw_day_of_week();
    void show_all_icons();
    void get_status();
    void skip_screen();
    void hold_screen();
    void set_screen_time(uint16_t t);
    void set_clock_time(uint16_t t);
    void set_hold_time(uint16_t t);
    void set_clock_interval(uint16_t t);
    void set_show_day_of_week(bool b);
    void set_show_seconds(bool b);
    void set_show_date(bool b);
    void set_brightness(int b); // int because of register_service!
    uint8_t get_brightness();
    void add_screen(std::string icon_name, std::string text, int lifetime, int show_time, bool alarm);
    void set_screen_color(std::string icon_name,int r, int g, int b);
    void del_screen(std::string icon_name);
    void set_frame_interval(uint16_t interval);
    void set_scroll_interval(uint16_t interval);
    void set_scroll_count(uint8_t count);
    void set_duration(uint8_t d);
    void set_indicator_off();
    void set_indicator_on(int r, int g, int b);
    void set_gauge_off();
    void set_gauge_value(int v); // valid: 0 - 100 int because of register_service
    void set_gauge_color(int r, int g, int b);
    void set_text_color(int r, int g, int b);
    void set_clock_color(int r, int g, int b);
    void set_today_color(int r, int g, int b);
    void set_weekday_color(int r, int g, int b);
    void set_alarm_color(int r, int g, int b);
    void draw_clock();
    void draw_gauge();
    void set_display_on();
    void set_display_off();

  Sample   You can set values during runtime, e.g., for a night mode  

# sample for ulanzi tc001
binary_sensor:
  - platform: gpio
    pin:
      number: $left_button_pin
      inverted: true
    on_press:
      - logger.log: "Clock on"
      - lambda:
          id(rgb8x32)->set_clock_time(6);
    name: "clock on"
  - platform: gpio
    pin:
      number: $right_button_pin
      inverted: true
   name: "Clock off"
    on_press:
      - logger.log: "clock off"
      - lambda:
          id(rgb8x32)->set_clock_time(0);

 

Local trigger

  To use the display without home assistant automations, you may use the advanced functionality with triggers. The triggers can be fired by sensors, time or by the ehmtx component.  

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:   x (Name of the icon, std::string): value to use in lambda   y (displayed text, std::string): value to use in lambda   See the examples:  

Write information to esphome log

 

ehmtx:
  ....
  on_next_screen:
    lambda: |-
        ESP_LOGD("TriggerTest","Iconname: %s",x.c_str());
        ESP_LOGI("TriggerTest","Text: %s",y.c_str());

 

Change the text color like crazy

 

ehmtx:
  ....
  on_next_screen:
    lambda: |-
      id(rgb8x32)->set_text_color(rand() % 255, rand() % 255, rand() % 255);

 

Send an event to Home Assistant

  To send data back to home assistant, you can use events.  

ehmtx:
  ....
  on_next_screen:
    - homeassistant.event:
        event: esphome.next_screen
        data_template:
          iconname: !lambda "return x.c_str();"
          text: !lambda "return y.c_str();"

  Result   events  

on_next_clock

The trigger on_next_clock is triggered every time a new clock display circle starts. See the examples:  

Change Clock colors like crazy for each clock circle

 

ehmtx:
  ....
  on_next_clock:
    lambda: |-
      id(rgb8x32)->set_clock_color(rand() % 255, rand() % 255, rand() % 255);
      id(rgb8x32)->set_weekday_color(rand() % 255, rand() % 255, rand() % 255);
      id(rgb8x32)->set_today_color(rand() % 255, rand() % 255, rand() % 255);

  Example  

api:
  services:
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->add_screen(icon_name, text, 7,20, true); // 7 minutes lifetime/screen time 20 sec/alarm=true

  (D) Service brightness   Sets the overall brightness of the display (0..255)   parameters:  

  • brightness: from dark to bright (0..255) (default = 80) as set in the light component by color_correct: [30%, 30%, 30%]   There's an easier way, by using a number component:  
number:
  - platform: template
    name: "LED brightness"
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

  Service screen (defined in YAML)   Queues a screen with an icon/animation and a text. There can only be one text per icon ID. If you need to show, e.g., an indoor and an outdoor temperature, you have to use different icon ID's!   You can update the text on the fly. If the screen is displayed, and you change the text for the icon, it will start a new lifetime (see lifetime) with the new text.   parameters:  

  • icon_name: The number of the predefined icons (see installation)
  • text: The text to be displayed   definition:
api:
  services:
    - service: screen
      variables:
        icon_name: string
        text: string
      then:
        - lambda: |-
            id(rgb8x32)->add_screen(icon_name,text,5,10,false);

  Service alarm (defined in YAML)   The alarm is like a regular screen, but it is displayed two minutes longer and has a red text color and a red marker in the upper-right corner.   parameters:  

  • icon_name: The name of the predefined icon ID (see installation)
  • text: The text to be displayed   definition:
api:
  services:
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        - lambda: |-
            id(rgb8x32)->add_screen(icon_name,text,10,30,true);
            id(rgb8x32)->force_screen(icon_name);

  (D) Service del_screen   Removes a screen from the display by icon name. If this screen is actually displayed while sending this command, the screen will be displayed until its "show_screen"-time has ended.   optionally, you can suffix a "" to the icon name to perform a wildcard delete, which will delete all screens beginning with the icon_name specified.   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:  

  • icon_name: Icon id defined in the YAML (see installation)   (D) Service indicator_on / indicator_off   Turns indicator on/off   Display a colored corner on all screens and the clock. You can define the color by parameter.   parameters:  
  • r red in 0..255
  • g green in 0..255
  • b blue in 0..255   (D) Service alarm_color / clock_color / gauge_color / text_color / today_color / weekday_color   Set the color of the named text-type   parameters:  
  • r red in 0..255
  • g green in 0..255
  • b blue in 0..255   (D) Service display_on / display_off   Turns the display on or off   There's an easier way in using a switch component:   Sample  
switch:
  - platform: template
    name: "$devicename Display"
    icon: "mdi:power"
    restore_mode: ALWAYS_ON
    lambda: |-
      return id(rgb8x32)->show_display;
    turn_on_action:
      lambda: |-
        id(rgb8x32)->set_display_on();
    turn_off_action:
      lambda: |-
        id(rgb8x32)->set_display_off();

  Service skip_screen   If there is more than one screen in the queue, skip to the next screen.   e.g., on the Ulanzi TC001  

binary_sensor:
  - platform: gpio
    pin:
      number: $left_button_pin
      inverted: true
    on_press:
      lambda:
        id(rgb8x32)->skip_screen();

  Service hold_screen   Displays the current screen for a configured amount (see hold_time) (default=20) seconds longer.   e.g., on the Ulanzi TC001  

binary_sensor:
  - platform: gpio
    pin:
      number: $right_button_pin
      inverted: true
    on_press:
      lambda:
        id(rgb8x32)->hold_screen();

  (D) Service status   This service displays the running queue and a list of icons in the logs  

[13:10:10][I][EHMTX:175]: status status: 1  as: 1
[13:10:10][I][EHMTX:176]: status screen count: 3
[13:10:10][I][EHMTX:181]: status slot: 0 icon: 36  text: 47.9°C end: 400
[13:10:10][I][EHMTX:181]: status slot: 1 icon: 23  text: Supa langer Text end: 310
[13:10:10][I][EHMTX:181]: status slot: 2 icon: 1  text: 10.3°C end: 363
[13:10:10][I][EHMTX:186]: status icon: 0 name: boot
[13:10:10][I][EHMTX:186]: status icon: 1 name: temp
[13:10:10][I][EHMTX:186]: status icon: 2 name: garage
[13:10:10][I][EHMTX:186]: status icon: 3 name: wind
[13:10:10][I][EHMTX:186]: status icon: 4 name: rain

  (D) Service show_all_icons   Display all of your icons sequentially by ID.   Service gauge_value / gauge_off   (D) Turns gauge on/off Displays a colored gauge on the left side of the display. You can define the color by parameter.   parameters:  

  • percent gauge percentage  

Integration in Home Assistant

  To control your display, it has to be integrated in Home Assistant. Then it provides several services, all prefixed with the configured devicename e.g., "ehmtx". See the default services marked as (D) above, but you can add your own (see alarm and screen).  

Services

  All communication with Home Assistant use the home asistant 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).  

Overview of default services

  These services are the same as the local services, so you can adapt the documentation there     |name|parameter|   |----|----|   |get_status|none|   |set_display_on|none|   |set_display_off|none|   |show_all_icons|none|   |hold_screen|none|   |set_indicator_on| {"r", "g", "b"}|   |set_indicator_off|none|   |set_gauge_value| {"percent"}|   |set_gauge_off|none|   |set_alarm_color| {"r", "g", "b"}|   |set_text_color | {"r", "g", "b"}|   |set_clock_color| {"r", "g", "b"}|   |set_today_color| {"r", "g", "b"}|   |set_gauge_color| {"r", "g", "b"}|   |set_weekday_color |{"r", "g", "b"}|   |set_screen_color |{"icon_name","r", "g", "b"}|   |add_screen  |{"icon_name", "text", "lifetime","screen_time", "alarm"}|   |force_screen| {"icon_name"}|   |del_screen| {"icon_name"}|   |set_brightness| {"value"}|  

Use in Home Assistant automations

  The easiest way to use ehmtx as a status display is to use the icon names as trigger ID. In my example, I have an icon named “wind” when the sensor.wind_speed has a new state, this automation sends the new data to the screen with the icon named “wind” and so on.  

alias: EHMTX 8266 Test
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.wind_speed
    id: wind
  - platform: state
    entity_id: sensor.actual_temperature
    id: temp
  - platform: state
    entity_id: sensor.wg_cover_device
    id: cover
condition: []
action:
  - service: esphome.ehmtx8266_screen
    data:
      icon_name: '{{trigger.id}}'
      text: >-
        {{trigger.to_state.state}}{{trigger.to_state.attributes.unit_of_measurement}}
mode: queued
max: 10

 

How to update

  Since version 2023.4.0 was a massive cleanup, you may have to check your YAML and your automations for all breaking changes.  

repairs

  sample repair   mostly, you have to check your automations if the service definitions have changed.   compile_error  

old name new name
display8x32 matrix_component
show_clock clock_time
show_screen screen_time
time time_component
html icons2html
 

  icon_error  

old name new name
duration frame_duration
 

  Old functions in YAML old_add_screen   old function style  

api:
  services:
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        - lambda: |-
            id(rgb8x32)->add_screen(icon_name,text,7,true);
        - ehmtx.force.screen:
            icon_name: !lambda return icon_name;

the old add_screen function had 4 parameters, the new one has got 5.   correct code  

# Enable Home Assistant API
api: #!include ehmtx_service.yaml
  services:
    .....
      then:
        - lambda: |-
            id(rgb8x32)->add_screen(icon_name,text,7,30,true);
    .....   

old options

duration and select   Remove these entries.    

Display precision after home assistant 2023.3.0

  See templating for possibilities to optimize the output e.g. {{ states(sensor.solarpower, rounded=True) }} kWh  

Specific icons per condition

  Add an icon per weather condition to the ehmtx component  

  - id: weather_clear_night
      lameid: 52163
    - id: weather_cloudy
      lameid: 25991
    - id: weather_fog
      lameid: 52167
    ......

  Sample automation to show the weather with local temperature  

alias: EHMTX weather
description: weather with icon per condition
trigger:
  - platform: state
    entity_id: weather.metno
action:
  - service: esphome.ulanzi_del_screen
    data:
      icon_name: weather_*
  - service: esphome.ulanzi_screen
    data:
      icon_name: weather_{{ trigger.to_state.state }}
      text: >-
        {{ states("sensor.external_actual_temperature") }}°C

  or another sample automation for the trashcan type  

alias: "EHMTX Müllanzeige"
description: Anzeige welche Tonne raus muss. iconnamen gekürzt
trigger:
  - platform: time
    at:
      - "06:30"
      - "08:30"
      - "10:30"
      - "15:00"
      - "17:00"
      - "19:00"
condition:
  - condition: numeric_state
    entity_id: sensor.mulltrigger
    below: "3"
action:
  - service: esphome.ulanzi_del_screen
    data:
      icon_name: trash_*
  - data:
      icon_name: >-
        trash_{{ states("sensor.mulldetails") | replace("Biotonne",   "brow")|
        replace("Papiertonne","blue")| replace("Restmüll",   "grey")|
        replace("gelbe Tonne","yell|") | truncate(4,true,"")  }}    
      text: >-
        {{ states("sensor.mulldetails")|replace(" in","")|replace(" days","
        Tagen") | replace ("0 Tagen","heute") | replace ("1 Tagen","morgen")}}
      duration: 120
    service: esphome.ulanzi_screen
mode: single

  Prerequisites: This works since 2023.3.1 thanx to @andrew-codechimp for the new del_screen  

Integrate in Home Assistant UI

  Add entities to the Home Assistant UI for interactive control of your display  

Brightness

 

number:
  - platform: template
    name: "$devicename brightness"
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

 

Display switch

 

switch:
  - platform: template
    name: "$devicename Display"
    icon: "mdi:power"
    restore_mode: ALWAYS_ON
    lambda: |-
      return id(rgb8x32)->show_display;
    turn_on_action:
      lambda: |-
        id(rgb8x32)->set_display_on();
    turn_off_action:
      lambda: |-
        id(rgb8x32)->set_display_off();

Buzzer, sound, buttons, and automatic brightness

  Awtrix and PixelIt have hard-coded functionality. EHMTX is also capable of building something like that by lambdas. But this is all your freedom.   Example: automatic brightness control with a bh1570 sensor  

sensor:
  - platform: bh1570
    # ...
    on_value:
      then:
         lambda: |- 
            if (x > 200)
            {
               id(rgb8x32)->set_brightness(50);
            } else {
               id(rgb8x32)->set_brightness(250);
            }

Notifier Custom Component

There is an optional notifier custom component you can install with HACS. It is comparable to the _screen service, but more streamlined.

Breaking changes

  • 2022.6.1 removed image types only rgb565 is valid!
  • 2023.2.0 removed awtrix icon awtrixid support
  • 2023.3.5 removed automatic scaling of images and animations
  • 2023.3.5 added status, display_on, display_off as default service => remove these from your YAML
  • 2023.3.5 added indicator_on/off as default services => remove these from your YAML
  • 2023.3.5 added *_color as default services => remove these from your YAML
  • 2023.3.5 added show_all_icons, gauge_percent/gauge_off as default services => remove these from your YAML
  • 2023.4.0 cleaner naming, please check all automations and YAML for change naming!!!
  • 2023.4.0 removed the select component

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.

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", use at your own risk!

Thanks

  • blakadder for his contribution (cleanup README.md, fixed sample)
  • andrew-codechimp for his contribution (display on/off & del_screen "*" & show_clock with 0)
  • jd1 for his contributions
  • aptonline for his work on the ulanzi hardware
  • wsbtak for the work on the ulanzi hardware
  • ofirsnb for his contributions
  • darkpoet78 for his work on optimized fonts
  • dennisse Auto-brightness for the Ulanzi
  • everbody that found bugs/issues and reported them!

Special thanks to all sponsors

esphomatrix's People

Contributors

alkorin avatar andrew-codechimp avatar blakadder avatar dennisse avatar fiiti avatar foorschtbar avatar frittes avatar jd1 avatar lubeda avatar popy2k14 avatar pplucky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esphomatrix's Issues

Text not displayed completely

Hello Ludger,

I have the following setup of screens.

[19:53:27][I][EHMTX:287]: status time: 23.3.2023 19:53
[19:53:27][I][EHMTX:290]: status brightness: 80 (0..255)
[19:53:27][I][EHMTX:291]: status default duration: 10
[19:53:27][I][EHMTX:292]: status date format: %d.%m.
[19:53:27][I][EHMTX:293]: status time format: %H:%M
[19:53:27][I][EHMTX:294]: status text_color: RGB(40,128,248)
[19:53:27][I][EHMTX:295]: status alarm_color: RGB(248,48,24)
[19:53:27][I][EHMTX:302]: status indicator off
[19:53:27][I][EHMTX:306]: status display on
[19:53:27][I][EHMTX:141]: status active slot: 8
[19:53:27][I][EHMTX:142]: status screen count: 12 of 24
[19:53:27][I][EHMTX:149]: status slot 0 icon 22 text: 19:53 alarm: 0 dd: 8 sec end: 573 sec
[19:53:27][I][EHMTX:149]: status slot 1 icon 3 text: WOHNZIMMER alarm: 0 dd: 14 sec end: 393 sec
[19:53:27][I][EHMTX:149]: status slot 2 icon 0 text: 22.2 alarm: 0 dd: 7 sec end: 398 sec
[19:53:27][I][EHMTX:149]: status slot 3 icon 2 text: 50% alarm: 0 dd: 7 sec end: 403 sec
[19:53:27][I][EHMTX:149]: status slot 4 icon 1 text: 1088 alarm: 0 dd: 8 sec end: 408 sec
[19:53:27][I][EHMTX:149]: status slot 5 icon 7 text: SCHLAFZIMMER alarm: 0 dd: 16 sec end: 408 sec
[19:53:27][I][EHMTX:149]: status slot 6 icon 4 text: 20.7 alarm: 0 dd: 7 sec end: 413 sec
[19:53:27][I][EHMTX:149]: status slot 7 icon 6 text: 53% alarm: 0 dd: 7 sec end: 418 sec
[19:53:27][I][EHMTX:149]: status slot 8 icon 5 text: 970 alarm: 0 dd: 7 sec end: 423 sec
[19:53:27][I][EHMTX:149]: status slot 9 icon 17 text: DRAUSSEN alarm: 0 dd: 12 sec end: 423 sec
[19:53:27][I][EHMTX:149]: status slot 10 icon 16 text: 13.2 alarm: 0 dd: 7 sec end: 428 sec
[19:53:27][I][EHMTX:149]: status slot 11 icon 23 text: Dies ist ein langer Text. 12345678910111213141516171819202122232425 alarm: 0 dd: 12 sec end: 548 sec

The last screen shall display a longer text. It is send via the HA screen service.
But it is not shown completely - the first loop is interrupted at "Dies ist ein lan", the 2nd repetition is interrupted at "Dies ist ein".

It did not check if the issue occurs only in combination with the other screens, or if this is a general topic.

I expect somehow a limitation of the text length, but this seems to be an unexpected behavior.

gif inanimate

hello my matrix is ​​perfectly functional, however the gifs are fixed, it does not move. THANKS

Ulanzi support…Yay!

Great to see you have added Ulanzi support to EspHoMaTrix, I’ll look forward to flashing and giving it a go.

I see you have referenced the use of the pinouts from my PixelIt Ulanzi repository in the code (which is great) and also included me in a ‘Thanks’ in the README, it’s appreciated. Could I ask however that you add @wsbtak to the thanks for all their hard work (and head scratching) to get Pixelit working on the Ulanzi? If it wasn’t for them we wouldn’t be where we are today 😀.

Thanks again and keep up the good work.

Time / date switching does not work

Time / date switching does not work after updating ESPhome. I tried to add:

  show_date: true
  date_format: "%d.%m."

That didn't help. Only the time is still displayed.

Gauge scaling seems wrong

The gauge seems to always start with 2 pixels even at 1% which is a loss of detail in my opinion.
It would be nice to have 12.5% per pixel (assuming 8 pixel height) or a way to configure the steps.

Update error

The component cannot be updated after updating ESPhome. I haven't changed anything in the configuration and everything works, but it can't be updated.

src/main.cpp:76:10: error: 'SetAlarmColor' in namespace 'esphome' does not name a template type; did you mean 'SetClockColor'?
   76 | esphome::SetAlarmColor<> *esphome_setalarmcolor;
      |          ^~~~~~~~~~~~~
      |          SetClockColor
/config/esphome/led-8x32.yaml: In function 'void setup()':
/config/esphome/led-8x32.yaml:42:3: error: 'esphome_setalarmcolor' was not declared in this scope; did you mean 'esphome_setclockcolor'?
   42 |           id: rgb8x32
      |   ^       ~~~~~~~~~~~  
      |   esphome_setclockcolor
/config/esphome/led-8x32.yaml:42:40: error: 'SetAlarmColor' in namespace 'esphome' does not name a template type; did you mean 'SetClockColor'?
   42 |           id: rgb8x32
      |                                        ^            
      |                                        SetClockColor
/config/esphome/led-8x32.yaml:42:54: error: expected primary-expression before '>' token
   42 |           id: rgb8x32
      |                                                      ^
/config/esphome/led-8x32.yaml:47:143: error: cannot convert '<brace-enclosed initializer list>' to 'const std::vector<esphome::Action<>*, std::allocator<esphome::Action<>*> >&'
   47 | esp8266:
      |                                                                                                                                               ^
In file included from src/esphome/components/display/display_buffer.h:5,
                 from src/esphome/components/addressable_light/addressable_light_display.h:5,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/core/automation.h:237:56: note:   initializing argument 1 of 'void esphome::Automation<Ts>::add_actions(const std::vector<esphome::Action<Ts ...>*>&) [with Ts = {}]'
  237 |   void add_actions(const std::vector<Action<Ts...> *> &actions) { this->actions_.add_actions(actions); }
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
*** [/data/led-8x32/.pioenvs/led-8x32/src/main.cpp.o] Error 1
========================= [FAILED] Took 28.66 seconds =========================
========== [ERROR] /config/esphome/led-8x32.yaml ==========

Force screen doesn't reset the timer

Hi,

When I use the force screen feature, the timer is not reset. Depending on when the service is called, the message can sometimes be barely visible. Would it be possible to force the reset of the timer?

Thanks in advance.

Clock showing __ __ under, even if only time is set to be displayed

Hello.

Just got my Ulanzi clock yesterday and managed to get EsphoMaTrix working on it. Great work, thanks in advance.

In "other" clock applications I used (awtrix, for instance), these __ __ only appeared in case more than 1 information was to be shown (date, day of week, etc).

As per my personal settings, I usually only display the clock, so I wonder if removing the __ __ appearing below the clock is feasible, in case only time is set to be displayed.

Thanks in advance.

Reference screen by name/id instead of icon

I would like to propose an API change: I would like to use a screen name or id as a reference to add, update or delete a screen instead of using the name of an icon.

void add_screen(std::string screen_name, std::string icon, std::string text, uint16_t duration, bool alarm);
void del_screen(std::string screen_name);

This brings two advantages:

  • You can change the icon of an existing screen
  • You can use the same icon for multiple screens

My main use case is a weather screen: With the current implementation, I have to remove a screen and add a new one everytime when the weather condition changes. If I could call the API with a screen name, the update is much simpler.

I implemented this change I while ago(https://github.com/jd1/EsphoMaTrix/tree/id), but never polished to code to create a PR. I had this code running for a while and used it without problems, but I'm currently not using my LED display, therefore the code is outdated and has probably some merge conflicts now :)

For most usecases there is not much that you have to change, but I see one risk: I implemented the name/id of a screen as std::string which could consume too much memory. I hope that there is a better solution for this.

On my reference branch I duplicated the add_screen and del_screen methods to keep the API stable, but I would prefer a clean solution with only two methods.

I am happy to receive feedback on my proposal.
If we can agree how to proceed, I'm happy to adapt my code and create a PR.

add sensors from HA in loop as time

hello I congratulate you for a great job, I added this sensor:

sensor:

  • platform: homeassistant
    id: istantaneo_w
    entity_id: sensor.energia_assorbita
    internal: true`

but I can't put it in loop at the date and time, could you tell me how to insert it? bearing in mind that I am using the sample code

thank you very much if anyone replies

Gifs are static

Hi,

since the removal of the awtrixid feature I've changed the icons to url mode. Sadly the GIF icons don't move at all and are static.
What do I have to do to get moving icons?

Cheers
Marco

Home Assistant and Ulanzi communication speed

On testing the sample Ulanzi .yaml file I noticed the speed of communication between Home Assistant and Ulanzi to be quite slow. There was a number of seconds between changes.

Appreciate this is still in early stages of development but just wanted to flag 😀.

Ulanzi TC001: Mnimal Brightness

I found out, that the minimal Brightness for Ulanzi TC001 can be set to 30. Lower than that it turns completely off. However to sleep nearby it is still too bright then for my Taste.

Is there a Possibility to come around?

How to center text?

Hi, I have the Ulanzi clock and so far so good! One question: how do I center the text? For example if I want to display the temperature, 40°, it shows it left aligned next to icon. I'd rather it centered. Thoughts?

Instant alert screen?

Hi, is it possible to have a new method to have an instant alert screen? I have tried to add a screen, and force that screen but it didn't work immediately. I'm looking for something that will stop the current loop, display the alert, then go back to the loop.

Issue: GIF not working Only static image is displayed

GIF is not working on my setup. it is just showing a static image.

below is my yaml file

substitutions:
  devicename: ehmtx8266
  mypin: GPIO02
   #  GPIO04

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EsphoMaTrix
      ref: date-time
    refresh: 120s 
    components: [ ehmtx ]   
      #type: local
      #path: components/components

esphome:
  name: $devicename
  on_boot:
      priority: -100
      then: 
        - ehmtx.text.color:
            id: rgb8x32
            red: !lambda return 200;
            green: !lambda return 200;
            blue: !lambda return 200;            
        - ehmtx.today.color:
            id: rgb8x32
            red: !lambda return 255;
            green: !lambda return 165;
            blue: !lambda return 0;
        - ehmtx.clock.color:
            id: rgb8x32
            red: !lambda return 255;
            green: !lambda return 165;
            blue: !lambda return 0;
        - ehmtx.weekday.color:
            id: rgb8x32
            red: !lambda return 0;
            green: !lambda return 128;
            blue: !lambda return 128;
        - lambda: !lambda |-
            id(rgb8x32)->show_all_icons();

esp8266:
  board: nodemcuv2

font:
  - file: monobit.ttf
    id: ehmtx_font
    size: 16
    glyphs:  |
      !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz€@<>/

binary_sensor:
  - platform: status
    name: "$devicename Status"

logger:

# Enable Home Assistant API
api:
  services:
    - service: show_all_icons
      then:
        lambda: |-
          id(rgb8x32)->show_all_icons();

    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->add_screen(icon_name,text,7 ,true);
          id(rgb8x32)->force_screen(icon_name);

    - service: screen
      variables:
        icon_name: string
        text: string
      then:
        - ehmtx.add.screen:
            id: rgb8x32
            text: !lambda return text;
            icon_name: !lambda return icon_name;
            duration: 1440
            alarm: false
            

    - service: brightness
      variables:
        brightness: int
      then:
        lambda: |-
          id(rgb8x32)->set_brightness(brightness);

    - service: status
      then:
        lambda: |-
          id(rgb8x32)->get_status();
    - service: del_screen
      variables:
        icon_name: string
      then:
        - ehmtx.delete.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;

    - service: indicator_on
      variables:
        r: int
        g: int
        b: int
      then:
        - ehmtx.indicator.on:
            id: rgb8x32
            red: !lambda return r;
            green: !lambda return g;
            blue: !lambda return b;

    - service: force_screen
      variables:
        icon_name: string
      then:
        - ehmtx.force.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;

    - service: text_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_text_color(r,g,b);

    - service: alarm_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_alarm_color(r,g,b);

    - service: indicator_off
      then:
        - ehmtx.indicator.off:
            id: rgb8x32

    - service: clock_text_color
      variables:
        r: int
        g: int
        b: int
      then: 
        lambda: |-
          id(rgb8x32)->set_clock_color(r,g,b);
          id(rgb8x32)->set_today_color(r,g,b);

number:
  - platform: template
    name: "$devicename brightness"
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    variant: WS2812
    pin: $mypin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      lambda: |-
         id(ehmtx_display)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(ehmtx_display)->set_enabled(true);
time:
  - platform: homeassistant
    id: ehmtx_time
    timezone: "Asia/Manila"

display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (x % 2 == 0) {
        return (x * 8) + y;
      }
      return (x * 8) + (7 - y);
    rotation: 0°
    update_interval: 100ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

ehmtx:
  id: rgb8x32
#  show_clock: 5
  show_screen: 5
  display8x32: ehmtx_display
  time: ehmtx_time
  time_format: "%I:%M"
  date_format: "%m.%d"
  week_start_monday: true
  duration: 7
  font_id: ehmtx_font
  icons: 
    - file: _icons/1918.gif #https://awtrix.blueforcer.de/icons/1918
      duration: 200
      pingpong: true
      id: heart
    - url: https://awtrix.blueforcer.de/icons/175
      id: phflag
    - url: https://awtrix.blueforcer.de/icons/1286
      duration: 10000
      id: weather
    - file: _icons/warning.gif #https://awtrix.blueforcer.de/icons/1901
      duration: 100
      id: warning
    - url: https://awtrix.blueforcer.de/icons/766
      id: smiley

Matrix type

Hi ,
my 8*32 matrix connected to an esp8266 shows only "random" pixels.
The screen seems to switch between two states, probably date and time, but it is not readable.
When i use awtrix i also had to select matriy type 2 or so. does this option exist here too?

best regards

No Configration after successful Installation possible

I had everything running nice and smooth for nearly a day :-) But now ESPHome is criticising the YAML which I copied 1:1 from the example and changed nothing. If I try to validate I get this:


INFO Reading configuration /config/esphome/pixelclock.yaml...
INFO Updating https://github.com/lubeda/EsphoMaTrix@None
WARNING 
WARNING If you are upgrading EsphoMaTrix from a version before 2023.4.0,
WARNING you should read the section https://github.com/lubeda/EsphoMaTrix/#how-to-update for tipps.
WARNING 
WARNING GPIO15 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Detected timezone 'Europe/Berlin'
INFO Detected timezone 'Europe/Berlin'
Failed config

ehmtx: [source /config/esphome/pixelclock.yaml:47]
  
  'matrix_component' is a required option for [ehmtx].
  id: rgb8x32
  
  [display8x32] is an invalid option for [ehmtx]. Please check the indentation.
  display8x32: ehmtx_display
  
  [html] is an invalid option for [ehmtx]. Please check the indentation.
  html: True
  
  [show_clock] is an invalid option for [ehmtx]. Did you mean [show_dow], [show_seconds], [on_next_clock]?
  show_clock: 5
  clock_interval: 60
  
  [show_screen] is an invalid option for [ehmtx]. Did you mean [show_seconds], [on_next_screen], [show_date]?
  show_screen: 6
  
  [duration] is an invalid option for [ehmtx]. Please check the indentation.
  duration: 5
  date_format: %d.%m
  time_format: %H:%M
  
  [dayofweek] is an invalid option for [ehmtx]. Please check the indentation.
  dayofweek: False
  show_date: True
  week_start_monday: True
  yoffset: 8
  xoffset: 1
  
  [scroll_intervall] is an invalid option for [ehmtx]. Did you mean [scroll_interval], [clock_interval], [frame_interval]?
  scroll_intervall: 80
  
  [anim_intervall] is an invalid option for [ehmtx]. Did you mean [frame_interval], [clock_interval], [scroll_interval]?
  anim_intervall: 192
  
  [time] is an invalid option for [ehmtx]. Did you mean [hold_time]?
  time: ehmtx_time
  font_id: ehmtx_font
  icons: 
    - id: ha
      lameid: 7956
    - id: tempc
      lameid: 2422
    - id: plug
      lameid: 403
    - id: humidity
      lameid: 51764
    - id: co2
      lameid: 30662
required key not provided

My YAML is this:

substitutions:
  devicename: pixelclock1
  matrix_pin: GPIO32 
  buzzer_pin: GPIO15
  battery_pin: GPIO34 
  ldr_pin: GPIO35 
  left_button_pin: GPIO26 
  mid_button_pin: GPIO27 
  right_button_pin: GPIO14 
  scl_pin: GPIO22 
  sda_pin: GPIO21 

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EsphoMaTrix
    refresh: 60s 
    components: [ ehmtx ]   

esphome:
  comment: "Pixeluhr1"
  name: $devicename 
  on_boot:
    then:
      - ds1307.read_time:
  
esp32:
  board: esp32dev

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

web_server:

font: 
  # adapt the filename to your local settings
  - file: Calcium.ttf
    id: ehmtx_font
    size: 16
    glyphs:  |
      !?"%‰()+*=,-_.:°µ²³0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz€$@<>/

ehmtx:
  id: rgb8x32
  display8x32: ehmtx_display
  html: true
  show_clock: 5           # duration to display the clock after this time the date is display until next "show_screen"
  clock_interval: 60      # show the clock at least each x seconds
  show_screen: 6          # duration to display a screen or a clock/date sequence
  duration: 5             # lifetime of a screen in minutes
  date_format: "%d.%m"    # defaults "%d.%m." (use "%m.%d." for the US)
  time_format: "%H:%M"    # defaults "%H:%M" (use "%I:%M%p" for the US)
  dayofweek: false        # draw the day indicator on the bottom of the screen, defaults to true
  show_date: true         # show the date for show_screen - show_clock seconds otherwise only shows the clock for show_screen seconds, defaults to true
  week_start_monday: true # default monday is first day of week, false = sunday
  yoffset: 8              # the text is aligned BASELINE_LEFT, the baseline defaults to 6
  xoffset: 1              # the text is aligned BASELINE_LEFT, the left defaults to 1
  scroll_intervall: 80    # the interval in ms to scroll the text (default=80), should be a multiple of the update_interval from the display (default: 16ms)
  anim_intervall: 192     # the interval in ms to display the next anim frame (default=192), should be a multiple of the update_interval from the display (default: 16ms)
  time: ehmtx_time
  font_id: ehmtx_font
  icons: 
    - id: ha
      lameid: 7956
    - id: tempc
      lameid: 2422
    - id: plug
      lameid: 403
    - id: humidity
      lameid: 51764
    - id: co2
      lameid: 30662
      

binary_sensor:
  - platform: status
    name: "$devicename Status"
  - platform: gpio
    pin:
      number: $left_button_pin
      inverted: true
    name: "$devicename left button"
    on_press:
      then:
        - number.decrement: screen_brightness
  - platform: gpio
    pin: 
      inverted: true
      number: $mid_button_pin
      mode: INPUT_PULLUP
    name: "$devicename middle button"
    on_press:
      then:
        - switch.toggle: displaycontrol
  - platform: gpio
    pin: 
      number: $right_button_pin
      inverted: true
    name: "$devicename right button"
    on_press:
      then:
        - number.increment: screen_brightness
# example to switch to next screen
#        lambda: |-
#          id(rgb8x32)->skip_screen();
logger:
  level: INFO

# Enable Home Assistant API
api:
  services:
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->add_screen(icon_name,text,7,true);
          id(rgb8x32)->force_screen(icon_name);
    - service: brightness
      variables:
        brightness: int
      then:
        lambda: |-
          id(rgb8x32)->set_brightness(brightness);
    - service: icons
      then:
        lambda: |-
          id(rgb8x32)->show_all_icons();
    - service: skip_screen
      then:
        lambda: |-
          id(rgb8x32)->skip_screen();
    - service: tuneplay
      variables:
        tune: string
      then:
        - rtttl.play:
            rtttl: !lambda 'return tune;'

number:
  - platform: template
    name: "$devicename brightness"
    id: screen_brightness
    min_value: 0
    max_value: 255
    update_interval: 1s
    step: 25
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

switch:
  - platform: template
    name: "$devicename Display"
    id: displaycontrol
    icon: "mdi:power"
    restore_mode: ALWAYS_ON
    lambda: |-
      return id(rgb8x32)->show_display;
    turn_on_action:
      lambda: |-
        id(rgb8x32)->set_display_on();
    turn_off_action:
      lambda: |-
        id(rgb8x32)->set_display_off();

sensor:
  - platform: sht3xd
    temperature:
      name: "$devicename Temperature"
    humidity:
      name: "$devicename Humidity"
    update_interval: 60s
  - platform: adc
    pin: $battery_pin
    name: "$devicename Battery"
    id: battery_voltage
    update_interval: 10s
    device_class: battery
    accuracy_decimals: 0
    attenuation: auto
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15
          send_first_at: 1
      - multiply: 1.6
      - lambda: |-
          return ((x - 3) / 0.69 * 100.00);
    unit_of_measurement: '%'
  - platform: adc
    id: light_sensor
    name: "$devicename Illuminance"
    pin: $ldr_pin
    update_interval: 10s
    attenuation: auto
    unit_of_measurement: lx
    accuracy_decimals: 0
    filters:
      - lambda: |-
          return (x / 10000.0) * 2000000.0 - 15 ;
    
output:
  - platform: ledc
    pin: $buzzer_pin
    id: rtttl_out

rtttl:
  output: rtttl_out

i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    variant: WS2812
    pin: $matrix_pin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      lambda: |-
         id(ehmtx_display)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(ehmtx_display)->set_enabled(true);

time:
  - platform: homeassistant
    on_time_sync:
      then:
        ds1307.write_time:
  - platform: ds1307
    update_interval: never
    id: ehmtx_time
  
display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (y % 2 == 0) {
        return (y * 32) + x;
      }
      return (y * 32) + (31 - x);
    rotation: 0°
    update_interval: 16ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

any ideas what to do?

del_screen change icon to the first icon

hello,

when I push the del_screen service from homeassistant to the display, it only change the icon to the first icon in my list and i have to send it again with this icon to really delete the screen.

Feature Requests: Allow setting text color as rainbow / set text a number of times

Hello.

Recently bought an Ulanzi clock and glad to have EsphoMaTrix working on it.

While using awtrix, there are 2 things which I REALLY miss in EsphoMaTrix (and which I think that fits in its different purpose compared to awtrix), which is to:

  • allow to set text color as a rainbow, to allow the color to be set random and changing while the text is being displayed
  • allow to set a text to show on display only a specified number of times.

Would this be something potentially implementable in the future?

Thanks in advance.

No skip_screen function

I tried implementing skip_screen function on left button or as a service but got compiler errors. readme refers to it but the code doesn't have the function

Problem Compiling

Using latest Home Assistant Version & ESPHome with a D1 Mini I get a compile error:

INFO Reading configuration /config/esphome/matrix.yaml...
INFO Detected timezone 'Europe/Berlin'
INFO Generating C++ source...
Traceback (most recent call last):
File "/usr/local/bin/esphome", line 33, in
sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')())
File "/esphome/esphome/main.py", line 825, in main
return run_esphome(sys.argv)
File "/esphome/esphome/main.py", line 812, in run_esphome
rc = POST_CONFIG_ACTIONS[args.command](args, config)
File "/esphome/esphome/main.py", line 326, in command_compile
exit_code = write_cpp(config)
File "/esphome/esphome/main.py", line 159, in write_cpp
generate_cpp_contents(config)
File "/esphome/esphome/main.py", line 171, in generate_cpp_contents
CORE.flush_tasks()
File "/esphome/esphome/core/init.py", line 613, in flush_tasks
self.event_loop.flush_tasks()
File "/esphome/esphome/coroutine.py", line 245, in flush_tasks
next(task.iterator)
File "/esphome/esphome/main.py", line 151, in wrapped
await coro(conf)
File "/config/esphome/.esphome/external_components/66a08d7e/components/ehmtx/init.py", line 560, in to_code
espImage.IMAGE_TYPE["RGB565"],
KeyError: 'RGB565'

Any hints for me? I used one single Icon in the yaml, tried different file formats (gif, png) but as far as I understand this should not be the issue here. I tried to replace the Key RGB585 with RGB24, which throws another error. (I have to admit I have no clue what I am doing there ;) )

If I replace the Key with RGB24 in the code, this error is thrown:

INFO Reading configuration /config/esphome/matrix.yaml...
INFO Detected timezone 'Europe/Berlin'
INFO Generating C++ source...
INFO Compiling app...
Processing matrix (board: d1_mini; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)

HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- 1.0
|-- 1.2
|-- 2.6.9
| |-- 1.0
Compiling /data/matrix/.pioenvs/matrix/src/esphome/components/ehmtx/EHMTX_icons.cpp.o
Compiling /data/matrix/.pioenvs/matrix/lib67b/ESP8266WiFi/ESP8266WiFiGratuitous.cpp.o
Compiling /data/matrix/.pioenvs/matrix/lib67b/ESP8266WiFi/ESP8266WiFiMulti.cpp.o
Compiling /data/matrix/.pioenvs/matrix/lib67b/ESP8266WiFi/ESP8266WiFiSTA-WPS.cpp.o
Compiling /data/matrix/.pioenvs/matrix/lib67b/ESP8266WiFi/ESP8266WiFiSTA.cpp.o
Compiling /data/matrix/.pioenvs/matrix/lib67b/ESP8266WiFi/ESP8266WiFiScan.cpp.o
Compiling /data/matrix/.pioenvs/matrix/lib67b/ESP8266WiFi/WiFiClient.cpp.o
src/esphome/components/ehmtx/EHMTX_icons.cpp: In member function 'void esphome::EHMTX_Icon::next_frame()':
src/esphome/components/ehmtx/EHMTX_icons.cpp:33:20: error: 'prev_frame' is not a member of 'esphome::display::Animation'
33 | Animation::prev_frame();
| ^~~~~~~~~~
Compiling /data/matrix/.pioenvs/matrix/lib67b/ESP8266WiFi/WiFiClientSecureBearSSL.cpp.o
*** [/data/matrix/.pioenvs/matrix/src/esphome/components/ehmtx/EHMTX_icons.cpp.o] Error 1
========================= [FAILED] Took 15.85 seconds =========================

I would be happy for anything pointing me into the right direction. Thank you! :)

No Connection to ESP

Hi all together.
I am trying to do a Esphomatrix Panel but I have Problems to get it running.
Home Assistant detects the ESPHome Device automaticly, so it is already in my WiFi.
But when i try to configure it, ist gives me an Error:

image

Here is my YAML file:

substitutions:
  devicename: esphomatrix-01
  mypin: D3
  board: d1_mini
  
external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EsphoMaTrix

esphome:
  name: $devicename
  on_boot:
    priority: -100
    then: 
      - ehmtx.text.color:
          id: rgb8x32
          red: !lambda return 200;
          blue: !lambda return 170;
      - ehmtx.today.color:
          id: rgb8x32
          red: !lambda return 10;
          green: !lambda return 250;
      - ehmtx.clock.color:
          id: rgb8x32
          red: !lambda return 50;
          green: !lambda return 150;
          blue: !lambda return 230;
      - ehmtx.alarm.color:
          id: rgb8x32
          red: !lambda return 250;
          green: !lambda return 50;
          blue: !lambda return 30;
      - ehmtx.weekday.color:
          id: rgb8x32
          red: !lambda return 250;
          green: !lambda return 50;
          blue: !lambda return 30;


esp8266:
  board: $board

font:
  - file: _fonts/monobit.ttf
    id: ehmtx_font
    size: 16
    glyphs:  |
      !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz€@<>/

logger:

binary_sensor:
  - platform: status
    name: "$devicename Status"

# Enable Home Assistant API
api:
  encryption:
    key: "MYKEYMYKEYMYKEYMYKEYMYKEYMYKEYMYKEYMYKEY"
  services:
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->add_screen(icon_name,text,7,true);
          id(rgb8x32)->force_screen(icon_name);
    - service: screen
      variables:
        icon_name: string
        text: string
      then:
        - ehmtx.add.screen:
            id: rgb8x32
            text: !lambda return text;
            icon_name: !lambda return icon_name;
            alarm: false
    - service: brightness
      variables:
        brightness: int
      then:
        lambda: |-
          id(rgb8x32)->set_brightness(brightness);
    - service: status
      then:
        lambda: |-
          id(rgb8x32)->get_status();
    - service: del_screen
      variables:
        icon_name: string
      then:
        - ehmtx.delete.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;
    - service: indicator_on
      variables:
        r: int
        g: int
        b: int
      then:
        - ehmtx.indicator.on:
            id: rgb8x32
            red: !lambda return r;
            green: !lambda return g;
            blue: !lambda return b;
    - service: force_screen
      variables:
        icon_name: string
      then:
        - ehmtx.force.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;
    - service: text_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_text_color(r,g,b);
    - service: clock_color
      variables:
        r: int
        g: int
        b: int
      then:
        - ehmtx.clock.color:
            id: rgb8x32
            red: !lambda return r;
            green: !lambda return g;
            blue: !lambda return b;
    - service: alarm_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_alarm_color(r,g,b);
    - service: indicator_off
      then:
        - ehmtx.indicator.off:
            id: rgb8x32

ota:
  password: "myOtaPassword"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: $devicename
    password: "InM2TlqVfJe4"

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    variant: WS2812
    pin: $mypin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      lambda: |-
         id(ehmtx_display)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(ehmtx_display)->set_enabled(true);

number:
  - platform: template
    name: "LED brightness"
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

time:
  - platform: homeassistant
    id: ehmtx_time

display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (x % 2 == 0) {
        return (x * 8) + y;
      }
      return (x * 8) + (7 - y);
    rotation: 0°
    update_interval: 16ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

ehmtx:
  id: rgb8x32
  show_clock: 4
  show_screen: 6
  display8x32: ehmtx_display
  time: ehmtx_time
  duration: 7
  font_id: ehmtx_font
  on_next_screen:
    - homeassistant.event:
        event: esphome.next_screen
        data_template:
            iconname: !lambda "return x.c_str();"
            text: !lambda "return y.c_str();"
  icons: 
    - awtrixid: 1851
      id: heart

I have rearly no Idea what could be wrong.
Maybe someone here with some Ideas?

THX @ all

David

compilation problem

Traceback (most recent call last):
File "/usr/local/bin/esphome", line 33, in
sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')())
File "/esphome/esphome/main.py", line 825, in main
return run_esphome(sys.argv)
File "/esphome/esphome/main.py", line 812, in run_esphome
rc = POST_CONFIG_ACTIONS[args.command](args, config)
File "/esphome/esphome/main.py", line 366, in command_run
exit_code = write_cpp(config)
File "/esphome/esphome/main.py", line 159, in write_cpp
generate_cpp_contents(config)
File "/esphome/esphome/main.py", line 171, in generate_cpp_contents
CORE.flush_tasks()
File "/esphome/esphome/core/init.py", line 613, in flush_tasks
self.event_loop.flush_tasks()
File "/esphome/esphome/coroutine.py", line 245, in flush_tasks
next(task.iterator)
File "/esphome/esphome/main.py", line 151, in wrapped
await coro(conf)
File "/config/esphome/.esphome/external_components/66a08d7e/components/ehmtx/init.py", line 560, in to_code
espImage.IMAGE_TYPE["RGB565"],
KeyError: 'RGB565'

can I use this for a 44x11 pixel matrix

I bought the higher resolution matrix and I thought it would just be a matter of changing the width and height in the code but when I do that it just crashes the whole thing. Am I doing this wrong?

2023.03.05 & brightness

Hi,
After updating to 2023.03.05, brightness service and this code to show and adjust brightness are no longer working: no matter what interger value you user with "brightness" service, or how much you move the brightness slider, return brightness value is always 0.
But real brightness is not 0 as figures and icons are visible in the screen.
Please advise.

`number:

  • platform: template
    name: "$devicename Brightness"
    id: brightness_value
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
    return id(rgb8x32)->get_brightness();
    set_action:
    lambda: |-
    id(rgb8x32)->set_brightness(x);`

not work gif icons

hello i started today with your nice project everyone i run into 1 big problem with all icons with gif don't work i can't see any movement what am i doing wrong see configuration?

substitutions:
  devicename: esphomatrix
  mypin: GPIO4
  board: nodemcuv2
  
external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EsphoMaTrix

esphome:
  name: $devicename
  on_boot:
    priority: -100
    then: 
      - ehmtx.text.color:
          id: rgb8x32
          red: !lambda return 200;
          blue: !lambda return 170;
      - ehmtx.today.color:
          id: rgb8x32
          red: !lambda return 10;
          green: !lambda return 250;
      - ehmtx.clock.color:
          id: rgb8x32
          red: !lambda return 50;
          green: !lambda return 150;
          blue: !lambda return 230;
      - ehmtx.alarm.color:
          id: rgb8x32
          red: !lambda return 250;
          green: !lambda return 50;
          blue: !lambda return 30;
      - ehmtx.weekday.color:
          id: rgb8x32
          red: !lambda return 250;
          green: !lambda return 50;
          blue: !lambda return 30;


esp8266:
  board: $board

font:
  - file: _fonts/monobit.ttf
    id: ehmtx_font
    size: 16
    glyphs:  |
      !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz€@<>/

logger:

binary_sensor:
  - platform: status
    name: "$devicename Status"

# Enable Home Assistant API
api:
  services:
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->add_screen(icon_name,text,7,true);
          id(rgb8x32)->force_screen(icon_name);
    - service: screen
      variables:
        icon_name: string
        text: string
      then:
        - ehmtx.add.screen:
            id: rgb8x32
            text: !lambda return text;
            icon_name: !lambda return icon_name;
            alarm: false
    - service: brightness
      variables:
        brightness: int
      then:
        lambda: |-
          id(rgb8x32)->set_brightness(brightness);
    - service: status
      then:
        lambda: |-
          id(rgb8x32)->get_status();
    - service: del_screen
      variables:
        icon_name: string
      then:
        - ehmtx.delete.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;
    - service: indicator_on
      variables:
        r: int
        g: int
        b: int
      then:
        - ehmtx.indicator.on:
            id: rgb8x32
            red: !lambda return r;
            green: !lambda return g;
            blue: !lambda return b;
    - service: force_screen
      variables:
        icon_name: string
      then:
        - ehmtx.force.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;
    - service: text_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_text_color(r,g,b);
    - service: clock_color
      variables:
        r: int
        g: int
        b: int
      then:
        - ehmtx.clock.color:
            id: rgb8x32
            red: !lambda return r;
            green: !lambda return g;
            blue: !lambda return b;
    - service: alarm_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_alarm_color(r,g,b);
    - service: indicator_off
      then:
        - ehmtx.indicator.off:
            id: rgb8x32

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: $devicename
    password: "InM2TlqVfJe4"

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    variant: WS2812
    pin: $mypin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      lambda: |-
         id(ehmtx_display)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(ehmtx_display)->set_enabled(true);

number:
  - platform: template
    name: "LED brightness"
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

time:
  - platform: homeassistant
    id: ehmtx_time

display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (x % 2 == 0) {
        return (x * 8) + y;
      }
      return (x * 8) + (7 - y);
    rotation: 
    update_interval: 16ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

ehmtx:
  id: rgb8x32
  show_clock: 4
  show_screen: 6
  display8x32: ehmtx_display
  time: ehmtx_time
  duration: 7
  html: true
  font_id: ehmtx_font
  on_next_screen:
    - homeassistant.event:
        event: esphome.next_screen
        data_template:
            iconname: !lambda "return x.c_str();"
            text: !lambda "return y.c_str();"
  icons: 
    - file: _icons/home.gif
      id: thuis
    - file: _icons/thuis-komst.gif
      id: thuis_komst
    - file: _icons/not-home.gif
      id: weg
    - file: _icons/weg-gaan.gif
      id: weg_gaan
    - file: _icons/deur-open.gif
      id: deur_open
    - file: _icons/door-gesloten.gif
      id: deur_gesloten
    - file: _icons/raam-open.gif
      id: raam_open
    - file: _icons/raam-gesloten.gif
      id: raam_gesloten
    - file: _icons/geen-post.png
      id: geen_post
    - file: _icons/wel-post.png
      id: wel_post
    - file: _icons/bewolk.png
      id: bewolkt
    - file: _icons/bliksem.gif
      id: bliksem
    - file: _icons/zon-met-regen.gif
      id: zon_met_regen
    - file: _icons/regen.gif
      id: regen
    - file: _icons/sneeuw-val.gif
      id: sneeuw
    - file: _icons/wind.gif
      id: wind
    - file: _icons/sun.gif
      id: zon
    - file: _icons/maan.png
      id: maan
    - file: _icons/hartje.gif
      id: hartje
    - file: _icons/i-love-you.gif
      id: i_love_you
    - file: _icons/loveman.png
      id: loveman
    - file: _icons/kushartje.png
      id: kushartje
    - file: _icons/i-love.png
      id: i_love
    - file: _icons/restafval.png
      id: restafval
    - file: _icons/pmd.png
      id: pmd
    - file: _icons/papier.png
      id: papier
    - file: _icons/geen-afval.png
      id: geen_afval
    - file: _icons/wel-afval.png
      id: wel_afval
    - file: _icons/Home-Assistant.png
      id: home_assistant
    - file: _icons/HomeAssistantgif.gif
      id: home_assistant_gif
    - file: _icons/instagram.png
      id: instagram
    - file: _icons/kerstboom_sneew.gif
      id: kerstboom_sneew
    - file: _icons/temperature.png
      id: temperature
    - file: _icons/calender.png
      id: agenda

Issue: Light goes on every now and then when there's no screen showing

For some reason whenever i dont have a screen displayed and just the clock and date are showing, the lights goes on and then boot loop so the workaround i did was to automate it in home assistant so that when the light goes on, it will turn it off.

substitutions:
  devicename: ehmtx8266
  mypin: GPIO02
   #  GPIO04

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EsphoMaTrix
      ref: date-time
    refresh: 120s 
    components: [ ehmtx ]   
      #type: local
      #path: components/components

esphome:
  name: $devicename
  on_boot:
      priority: -100
      then: 
        - ehmtx.text.color:
            id: rgb8x32
            red: !lambda return 200;
            green: !lambda return 200;
            blue: !lambda return 200;            
        - ehmtx.today.color:
            id: rgb8x32
            red: !lambda return 255;
            green: !lambda return 165;
            blue: !lambda return 0;
        - ehmtx.clock.color:
            id: rgb8x32
            red: !lambda return 255;
            green: !lambda return 165;
            blue: !lambda return 0;
        - ehmtx.weekday.color:
            id: rgb8x32
            red: !lambda return 0;
            green: !lambda return 128;
            blue: !lambda return 128;
        - lambda: !lambda |-
            id(rgb8x32)->show_all_icons();

esp8266:
  board: nodemcuv2

font:
  - file: monobit.ttf
    id: ehmtx_font
    size: 16
    glyphs:  |
      !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz€@<>/

binary_sensor:
  - platform: status
    name: "$devicename Status"

logger:

# Enable Home Assistant API
api:
  services:
    - service: show_all_icons
      then:
        lambda: |-
          id(rgb8x32)->show_all_icons();

    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->add_screen(icon_name,text,7 ,true);
          id(rgb8x32)->force_screen(icon_name);

    - service: screen
      variables:
        icon_name: string
        text: string
      then:
        - ehmtx.add.screen:
            id: rgb8x32
            text: !lambda return text;
            icon_name: !lambda return icon_name;
            duration: 1440
            alarm: false
            

    - service: brightness
      variables:
        brightness: int
      then:
        lambda: |-
          id(rgb8x32)->set_brightness(brightness);

    - service: status
      then:
        lambda: |-
          id(rgb8x32)->get_status();
    - service: del_screen
      variables:
        icon_name: string
      then:
        - ehmtx.delete.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;

    - service: indicator_on
      variables:
        r: int
        g: int
        b: int
      then:
        - ehmtx.indicator.on:
            id: rgb8x32
            red: !lambda return r;
            green: !lambda return g;
            blue: !lambda return b;

    - service: force_screen
      variables:
        icon_name: string
      then:
        - ehmtx.force.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;

    - service: text_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_text_color(r,g,b);

    - service: alarm_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_alarm_color(r,g,b);

    - service: indicator_off
      then:
        - ehmtx.indicator.off:
            id: rgb8x32

    - service: clock_text_color
      variables:
        r: int
        g: int
        b: int
      then: 
        lambda: |-
          id(rgb8x32)->set_clock_color(r,g,b);
          id(rgb8x32)->set_today_color(r,g,b);

number:
  - platform: template
    name: "$devicename brightness"
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    variant: WS2812
    pin: $mypin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      lambda: |-
         id(ehmtx_display)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(ehmtx_display)->set_enabled(true);
time:
  - platform: homeassistant
    id: ehmtx_time
    timezone: "Asia/Manila"

display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (x % 2 == 0) {
        return (x * 8) + y;
      }
      return (x * 8) + (7 - y);
    rotation: 0°
    update_interval: 100ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

ehmtx:
  id: rgb8x32
#  show_clock: 5
  show_screen: 5
  display8x32: ehmtx_display
  time: ehmtx_time
  time_format: "%I:%M"
  date_format: "%m.%d"
  week_start_monday: true
  duration: 7
  font_id: ehmtx_font
  icons: 
    - file: _icons/1918.gif #https://awtrix.blueforcer.de/icons/1918
      duration: 200
      pingpong: true
      id: heart
    - url: https://awtrix.blueforcer.de/icons/175
      id: phflag
    - url: https://awtrix.blueforcer.de/icons/1286
      duration: 10000
      id: weather
    - file: _icons/warning.gif #https://awtrix.blueforcer.de/icons/1901
      duration: 100
      id: warning
    - url: https://awtrix.blueforcer.de/icons/766
      id: smiley

screen brightness

hello is it possible to set the startup screen brightness to your own set brightness ? so that it doesn't have to be done every time?

awtrixid bitmaps

Hello I get an error when I want to send the code to my esp32
Error:
`INFO Reading configuration /config/esphome/esphomatrix.yaml...
INFO Detected timezone 'Europe/Paris'
INFO Generating C++ source...
/usr/lib/python3/dist-packages/PIL/Image.py:962: UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images
warnings.warn(
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/esphome", line 33, in
sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')())
File "/esphome/esphome/main.py", line 963, in main
return run_esphome(sys.argv)
File "/esphome/esphome/main.py", line 950, in run_esphome
rc = POST_CONFIG_ACTIONS[args.command](args, config)
File "/esphome/esphome/main.py", line 395, in command_run
exit_code = write_cpp(config)
File "/esphome/esphome/main.py", line 176, in write_cpp
generate_cpp_contents(config)
File "/esphome/esphome/main.py", line 188, in generate_cpp_contents
CORE.flush_tasks()
File "/esphome/esphome/core/init.py", line 619, in flush_tasks
self.event_loop.flush_tasks()
File "/esphome/esphome/coroutine.py", line 246, in flush_tasks
next(task.iterator)
File "/esphome/esphome/main.py", line 168, in wrapped
await coro(conf)
File "/config/esphome/.esphome/external_components/66a08d7e/components/ehmtx/init.py", line 438, in to_code
awtrixdata = r.json()
File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
`

My code:
`display:

  • platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
    if (y % 2 == 0) {
    return x + ( y * 32);
    }
    else
    {
    return (31 - x) + ( y * 32);
    }
    rotation: 0°
    update_interval: 16ms
    auto_clear_enabled: true
    lambda: |-
    id(rgb8x32)->tick();
    id(rgb8x32)->draw();
    ehmtx:
    ehmtxselect: ehmtx_screens
    id: rgb8x32
    show_clock: 4
    show_screen: 6
    display8x32: ehmtx_display
    time: ehmtx_time
    duration: 60
    font_id: ehmtx_font
    on_next_screen:
    lambda: |-
    ESP_LOGD("Trigger","Ole it works");
    icons:
    • file: icons/SUN_5807.gif
      id: boot
    • awtrixid: 662
      id: temp
    • file: icons/alert.png
      id: alert
    • awtrixid: 417
      id: door`

Setup loop behavior

Hello,

So far I've been using awtrix, but I'm very enthusiastic about your project with the connection to HA.
With awtrix, I always have a lot of text stutters, so I'm just trying a comparable setup with your project.

But I somehow fail to set up a fixed loop behavior. I do not want to compare both projects in detail, but I think its somehow useful also for other beginners with your project.

I use the display to regularly display some room information, such as temperature and humidity.
This should simply be repeated at regular intervals.

clock (300s) -> room 1 (room name, temp, hum, co2) one time -> room 2 (room name, temp, hum, co2) one time -> room 3 (room name, temp, hum, co2) one time -> back to beginning with clock: clock for 300s.

Well, for the standard loop I have created a HA automation; in a sequence the screens are created. I have used a sequence, because there seems to be no other chance to specify a specific order of the messages/icons.

But I am not able to setup the described behavior above.
The room information is repeated all the time (room 1, room 2, room 3, room 1) and I think when the clock_interval is reached, the display jumps back to the clock from any position in the loop.

Its possible to setup this scenario?
If not yet, from your point of view, does an implementation make sense?

Additionally some other messages pop up, e.g. garage open - these messages shall be placed at the end of the standard loop and should not influence it. There could be a message with standard priority, which can be added at the end of the loop; but there could also be a prio message which should be shown directly.

Do you plan an implementation like this?
When I actually add a new screen with the HA service, its located "somewhere" in the sequence, but not at the end of the existing loop.

I have now written a lot of text, I would be happy about a feedback or discussion.

Allow to set distinct text_color per screen

Seeing show_time as new parameter for add_screen service starting from 2023.4.0, has reminded of an issue/limitation that might be solved in a similar way.

Allowing a text_color to be set differently for each screen, rather than using the last set text_color for each active screen. The text_color as of today could be used as a global screen default, optionally changeable per screen and valid for that screen only.

Right now if I have an active screen with a color and I start a new simultaneous screen with a different color, text for both screens will be displayed using the new color.

Would this be something possibly/easily implementable?

Thanks in advance for all the great work you've been doing in this custom component.

Question: How to better include turn off animation/light effect

In my awtrix matrix, there is a turn off animation whenever the display is turned off, which I think it is nice.

I built an Addressable Lambda Effect in esphome to mimic the same animation on my Ulanzi EsphoMaTrix, assigned it to the light component and it works fine if I trigger the effect manually.

Probably there are simpler ways to achieve this, but here it is for reference, if anyone wants to use it also:

addressable_lambda:
  name: "ZZZ"
  update_interval: 100ms
  lambda: |-
    static int x = 0;
    if (initial_run) {
      x = 1;
      it.all() = Color(0,0,0);
    }
    // it.range() seems to include initial LED # but excludes last LED #
    switch (x) {
      case 1:
        // Line 8 - right to left (from 224)
        it.range(231, 236) = Color(255,255,255);
        x += 1;
        break;
      case 2:
        // Line 7 - left to right (from 192)
        it.range(210, 215) = Color(255,255,255);
        // Line 8 - right to left (from 224)
        it.range(231, 236) = Color(0,0,0);
        it[233] = Color(255,255,255);
        x += 1;
        break;
      case 3:
        // Line 6 - right to left (from 160)
        it.range(172, 177) = Color(255,255,255);
        // Line 7 - left to right (from 192)
        it.range(210, 215) = Color(0,0,0);
        it[211] = Color(255,255,255);
        // Line 8 - right to left (from 224)
        it[233] = Color(0,0,0);
        it[237] = Color(255,255,255);
        x += 1;
        break;
      case 4:
        // Line 5 - left to right (from 128)
        it.range(141, 146) = Color(255,255,255);
        // Line 6 - right to left (from 160)
        it.range(172, 177) = Color(0,0,0);
        it[174] = Color(255,255,255);
        // Line 7 - left to right (from 192)
        it[211] = Color(0,0,0);
        it[208] = Color(255,255,255);
        // Line 8 - right to left (from 224)
        it[237] = Color(0,0,0);
        it[240] = Color(255,255,255);
        x += 1;
        break;
      case 5:
        // Line 4 - right to left (from 96)
        it.range(111, 116) = Color(255,255,255);
        // Line 5 - left to right (from 128)
        it.range(141, 146) = Color(0,0,0);
        it[144] = Color(255,255,255);
        // Line 6 - right to left (from 160)
        it[174] = Color(0,0,0);
        it[176] = Color(255,255,255);
        // Line 7 - left to right (from 192)
        it[208] = Color(0,0,0);
        it[206] = Color(255,255,255);
        // Line 8 - right to left (from 224)
        it[240] = Color(0,0,0);
        it[242] = Color(255,255,255);
        x += 1;
        break;
      case 6:
        // Line 3 - left to right (from 64)
        it.range(75, 80) = Color(255,255,255);
        // Line 4 - right to left (from 96)
        it.range(111, 116) = Color(0,0,0);
        it[112] = Color(255,255,255);
        // Line 5 - left to right (from 128)
        it[144] = Color(0,0,0);
        it[142] = Color(255,255,255);
        // Line 6 - right to left (from 160)
        it[176] = Color(0,0,0);
        it[178] = Color(255,255,255);
        // Line 7 - left to right (from 192)
        it[206] = Color(0,0,0);
        it[204] = Color(255,255,255);
        // Line 8 - right to left (from 224)
        it[242] = Color(0,0,0);
        it[244] = Color(255,255,255);
        x += 1;
        break;
      case 7:
        // Line 2 - right to left (from 32)
        it.range(49, 54) = Color(255,255,255);
        // Line 3 - left to right (from 64)
        it.range(75, 80) = Color(0,0,0);
        it[78] = Color(255,255,255);        
        // Line 4 - right to left (from 96)
        it[112] = Color(0,0,0);
        it[114] = Color(255,255,255);
        // Line 5 - left to right (from 128)
        it[142] = Color(0,0,0);
        it[140] = Color(255,255,255);
        // Line 6 - right to left (from 160)
        it[178] = Color(0,0,0);
        it[180] = Color(255,255,255);
        // Line 7 - left to right (from 192)
        it[204] = Color(0,0,0);
        it[202] = Color(255,255,255);
        // Line 8 - right to left (from 224)
        it[244] = Color(0,0,0);
        it.range(241, 246) = Color(255,255,255);
        x += 1;
        break;
      case 8:
        // Line 1 - left to right (from 0)
        it.range(8, 13) = Color(255,255,255);
        // Line 2 - right to left (from 32)
        it.range(49, 54) = Color(0,0,0);
        it[51] = Color(255,255,255);
        // Line 3 - left to right (from 64)
        it[78] = Color(0,0,0);
        it[75] = Color(255,255,255);
        // Line 4 - right to left (from 96)
        it[114] = Color(0,0,0);
        it[117] = Color(255,255,255);
        // Line 5 - left to right (from 128)
        it[140] = Color(0,0,0);
        it[137] = Color(255,255,255);
        // Line 6 - right to left (from 160)
        it[180] = Color(0,0,0);
        it[183] = Color(255,255,255);
        // Line 7 - left to right (from 192)
        it[202] = Color(0,0,0);
        it.range(200, 206) = Color(255,255,255);
        // Line 8 - right to left (from 224)
        it.range(241, 246) = Color(0,0,0);
        x += 1;
        break;
      case 9:
        // Line 1 - left to right (from 0)
        it.range(8, 13) = Color(0,0,0);
        it[13] = Color(255,255,255);
        // Line 6 - right to left (from 160)
        it[183] = Color(0,0,0);
        it.range(178, 183) = Color(255,255,255);
        // Line 7 - left to right (from 192)
        it.range(200, 206) = Color(0,0,0);
        x += 1;
        break;
      case 10:
        // Line 5 - left to right (from 128)
        it[137] = Color(0,0,0);
        it.range(138, 143) = Color(255,255,255);
        // Line 6 - right to left (from 160)
        it.range(178, 183) = Color(0,0,0);
        x += 1;
        break;
      case 11:
        // Line 4 - right to left (from 96)
        it[117] = Color(0,0,0);
        it.range(112, 117) = Color(255,255,255);
        // Line 5 - left to right (from 128)
        it.range(138, 143) = Color(0,0,0);
        x += 1;
        break;
      case 12:
        // Line 3 - left to right (from 64)
        it[75] = Color(0,0,0);
        it.range(76, 81) = Color(255,255,255);
        // Line 4 - right to left (from 96)
        it.range(112, 117) = Color(0,0,0);
        x += 1;
        break;
      case 13:
        // Line 2 - right to left (from 32)
        it[51] = Color(0,0,0);
        it.range(46, 51) = Color(255,255,255);
        // Line 3 - left to right (from 64)
        it.range(76, 81) = Color(0,0,0);
        x += 1;
        break;
      case 14:
        // Line 1 - left to right (from 0)
        it[13] = Color(0,0,0);
        it.range(14, 19) = Color(255,255,255);
        // Line 2 - right to left (from 32)
        it.range(46, 51) = Color(0,0,0);
        x += 1;
        break;
      case 15:
        it.all() = Color(0,0,0);
        break;
    }

If I turn on the light with the effect, it switches from the clock to the animation.
The "problem" is that to stop the animation, I either need:

  • to apply an effect 'None' (which actually turns on all the LEDs in the matrix, same as turning light on without any effect) or;
  • directly turn off the light (which actually "reactivates the clock" - which makes sense but not when turning off the display).

So my question here is: how would you guys better include this to behave as a turn off animation? Going from clock or whatever is on the display to the animation and then display off.

Thanks for any suggestions.

Alarm color compilation error

If I use your example, everything works fine.

esphome:
  name: $devicename
  on_boot:
    priority: -100
    then: 
      - ehmtx.text.color:
          id: rgb8x32
          red: !lambda return 200;
          blue: !lambda return 170;
      - ehmtx.today.color:
          id: rgb8x32
          red: !lambda return 10;
          green: !lambda return 250;
      - ehmtx.clock.color:
          id: rgb8x32
          red: !lambda return 50;
          green: !lambda return 150;
          blue: !lambda return 230;
      - ehmtx.weekday.color:
          id: rgb8x32
          red: !lambda return 250;
          green: !lambda return 50;
          blue: !lambda return 30;

If I add an alarm color, the compilation will fail

      - ehmtx.alarm.color:
          id: rgb8x32
          red: !lambda return 250;
          green: !lambda return 50;
          blue: !lambda return 30;
src/main.cpp:76:10: error: 'SetAlarmColor' in namespace 'esphome' does not name a template type; did you mean 'SetClockColor'?
   76 | esphome::SetAlarmColor<> *esphome_setalarmcolor;
      |          ^~~~~~~~~~~~~
      |          SetClockColor
/config/esphome/led-8x32.yaml: In function 'void setup()':
/config/esphome/led-8x32.yaml:42:3: error: 'esphome_setalarmcolor' was not declared in this scope; did you mean 'esphome_setclockcolor'?
   42 |           id: rgb8x32
      |   ^       ~~~~~~~~~~~  
      |   esphome_setclockcolor
/config/esphome/led-8x32.yaml:42:40: error: 'SetAlarmColor' in namespace 'esphome' does not name a template type; did you mean 'SetClockColor'?
   42 |           id: rgb8x32
      |                                        ^            
      |                                        SetClockColor
/config/esphome/led-8x32.yaml:42:54: error: expected primary-expression before '>' token
   42 |           id: rgb8x32
      |                                                      ^
/config/esphome/led-8x32.yaml:47:143: error: cannot convert '<brace-enclosed initializer list>' to 'const std::vector<esphome::Action<>*, std::allocator<esphome::Action<>*> >&'
   47 | esp8266:
      |                                                                                                                                               ^
In file included from src/esphome/components/display/display_buffer.h:5,
                 from src/esphome/components/addressable_light/addressable_light_display.h:5,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/core/automation.h:237:56: note:   initializing argument 1 of 'void esphome::Automation<Ts>::add_actions(const std::vector<esphome::Action<Ts ...>*>&) [with Ts = {}]'
  237 |   void add_actions(const std::vector<Action<Ts...> *> &actions) { this->actions_.add_actions(actions); }
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
*** [/data/led-8x32/.pioenvs/led-8x32/src/main.cpp.o] Error 1

Any possible way for showing a timer

I was wondering if it is possible to display a timer using EsphoMaTrix. E.g. a service is called in Home Assistant, which leads to an timer of specified duration (e.g. 5 minutes) being displayed on the matrix display.
Or are there any workarounds that would enable such functionality.

P.S. Thank you for developing this project.

leds is not in the right place

Hello, I have a flexible 32x8 led matrix, I sent your scirpt to my esp, but the lighting of the leds is not in the right place, and I can't understand what to modify , and I did not find other examples on the internet, on PixelIT I must set to Row major. Can you help me please; thanks in advance

Porting it for an 16x16 led matrix?

Hey, I've started to have a look if it's possible to port this to a simple WS2812B 16x16 led matrix.
The concept is to have 2 rows (8x16 + 8x16), like:

  • icons / hours on the top
  • text / minutes on the bottom

Also to have background color settings (but I'm not sure if that's already implemented)
Do you think it's possible using this setup?

Thanks, awesome job btw :)

Ulanzi Temperature and Humidity sensors?

I noticed when EsphoMaTrix is connected to home assistant that it’s reporting temperature and humidity but from our investigations the Ulanzi doesn’t appear to have such sensors. Is this an omission from the provided sample or have we missed seeing these sensors 🤣.

time format and date format

Hi,

First of all, thank you for this awesome project of yours! Im using it at the moment and it is fantastic! If i may request, is it possible to have as a setting the hour and date formats. Say 12 hour format for the hours or the inclusion of seconds and for the dates, the inclusion of year and changing to different locale.

Thanks!

Feature Request: Update screen immediately on force screen

It would be nice if the screen would update immediately when you call force screen.
E.g. I would like to show the current caller on my landline phone and it is annoying if I have to wait until the screen moves to the next to see the caller.

If you would like to keep the current behaviour, you could also split it up in two methods:

  • Set next screen: This is the current behaviour of force screen
  • Force screen: This updates the current screen immediately

It's been over half a year since I had a deeper look at the code, so I'm not sure how much effort this is. This is just an idea for an improvement, no show stopper :)

Where to start if LED won't work

Hi.
Sorry for garbled issue, accidentally hit Enter while typing.

Don't hesitate to tell me if I'm asking something wrong, but I'm not sure where to start debugging.
I use 30-pin WROOM 32 for this project, want to build an informer from a 8x32 LED panel, I'm using standart GPIO16(D2) for data and VIN/GDN for LED power.
ESP32 was tested with WLED project so I know it works fine, power supply is USB charger 5V/3A.
For testing purposes I removed icons from ESPHome code and changed font file with bitmap Cozette (https://github.com/slavfox/Cozette, font size 13px), everything else left untouched.

On your video switching power makes matrix display "01.01", but my stays unlit blank, what could I miss?

Again, feel free to move issue if I'm not supposed to ask such things here.

Thank you advance.

ulanzi TC001

hello I just wanted to install your new esphomatrix version for the ulanzi TC001 but I get an error that it does not find it? see code

error:

INFO Reading configuration /config/esphome/ulanzi.yaml...
ERROR Error while reading config: Invalid YAML syntax:

Error reading file /config/esphome/ehmtx_font.yaml: [Errno 2] No such file or directory: '/config/esphome/ehmtx_font.yaml'

code yaml :

substitutions:
  devicename: ulanzi
  ledpin: GPIO32 
  buzzerpin: GPIO15

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EsphoMaTrix
    refresh: 60s 
    components: [ ehmtx ]   

esphome:
  comment: "Ulanzi Work in Progress"
  name: $devicename 
  on_boot:
    then:
      - ds1307.read_time:
  
esp32:
  board: esp32dev

font: !include ehmtx_font.yaml

binary_sensor:
  - platform: status
    name: "$devicename Status"
  - platform: gpio
    pin:
      number: $left_button_pin
      inverted: true
    name: "$devicename left button"
  - platform: gpio
    pin: 
      inverted: true
      number: $mid_button_pin
      mode: INPUT_PULLUP
    name: "$devicename middle button"
  - platform: gpio
    pin: 
      number: $right_button_pin
      inverted: true
    name: "$devicename right button"

logger:
  level: INFO

# Enable Home Assistant API
api:
  services:
    - service: gauge
      variables:
        val: int
      then:
        lambda: |-
          id(rgb8x32).set_gauge_value(val);
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->add_screen(icon_name,text,7,true);
          id(rgb8x32)->force_screen(icon_name);
    - service: screen
      variables:
        icon_name: string
        text: string
      then:
        - ehmtx.add.screen:
            id: rgb8x32
            text: !lambda return text;
            icon_name: !lambda return icon_name;
            alarm: false
    - service: brightness
      variables:
        brightness: int
      then:
        lambda: |-
          id(rgb8x32)->set_brightness(brightness);
    - service: status
      then:
        lambda: |-
          id(rgb8x32)->get_status();
    - service: del_screen
      variables:
        icon_name: string
      then:
        - ehmtx.delete.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;
    - service: indicator_on
      variables:
        r: int
        g: int
        b: int
      then:
        - ehmtx.indicator.on:
            id: rgb8x32
            red: !lambda return r;
            green: !lambda return g;
            blue: !lambda return b;
    - service: force_screen
      variables:
        icon_name: string
      then:
        - ehmtx.force.screen:
            id: rgb8x32
            icon_name: !lambda return icon_name;
    - service: text_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_text_color(r,g,b);
    - service: alarm_color
      variables:
        r: int
        g: int
        b: int
      then:
        lambda: |-
          id(rgb8x32)->set_alarm_color(r,g,b);
    - service: indicator_off
      then:
        - ehmtx.indicator.off:
            id: rgb8x32
  encryption:
    key: "iEvQjMi6GHXTS94Qmda/VlFQZOAo+Qo+T6mvphuaNOU="

number:
  - platform: template
    name: "$devicename brightness"
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

sensor:
  - platform: sht3xd
    temperature:
      name: "$devicename Temperature"
    humidity:
      name: "$devicename Relative Humidity"
    update_interval: 60s
  - platform: adc
    pin: 36
    # not really working
    name: "$devicename Battery"
    update_interval: 60s

  - platform: adc
    id: source_sensor
    # not really working
    name: "$devicename LDR"
    pin: A7

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

web_server:

output:
  - platform: ledc
    pin: $buzzerpin
    id: rtttl_out

rtttl:
  output: rtttl_out

i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    variant: WS2812
    pin: $ledpin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      lambda: |-
         id(ehmtx_display)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(ehmtx_display)->set_enabled(true);

time:
  - platform: homeassistant
    on_time_sync:
      then:
        ds1307.write_time:
  - platform: ds1307
    update_interval: never
    id: ehmtx_time
  
display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (y % 2 == 0) {
        return (y * 32) + x;
      }
      return (y * 32) + (31 - x);
    rotation: 
    update_interval: 16ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

ehmtx:
  id: rgb8x32
  show_clock: 6
  show_screen: 6
  html: true
  display8x32: ehmtx_display
  time: ehmtx_time
  duration: 7
  font_id: ehmtx_font
  icons: !include ehmtx_icons.yaml

FEATURE REQUEST: Enable Separate Control of Clock, Dates and Others Display

Is it possible to have a separate control of how long the clock, date and other details will be displayed. i am trying to figure out a way to display the date a little bit longer as i think it is displaying just about a second or even less and i cant figure out for the life of me. haha. i may just be missing some documentation but i would appreciate it if you can point me to it. thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.