lubeda / EspHoMaTriXv2

A simple DIY status display with a 8x32 RGB LED matrix, implemented with esphome.io and Home Assistant.
MIT License
298 stars 29 forks source link

Installation with ESPHome 2023.8.2 and default fonts from ulanzi-easy.xaml not possible #78

Closed CM000n closed 1 year ago

CM000n commented 1 year ago

Bug report

Describe the bug

When I try to install the config from the current ulanzi-easy.yaml file with ESPHome 2023.8.2, the installations aborts with the following error message when trying to convert the MatrixClock-Light8.bdf and MatrixClock-Chunky6.bdf fonts to Pillow format

INFO Generating C++ source...
Traceback (most recent call last):
  File "/usr/local/bin/esphome", line 33, in <module>
    sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')())
  File "/esphome/esphome/__main__.py", line 1023, in main
    return run_esphome(sys.argv)
  File "/esphome/esphome/__main__.py", line 1010, in run_esphome
    rc = POST_CONFIG_ACTIONS[args.command](args, config)
  File "/esphome/esphome/__main__.py", line 441, in command_run
    exit_code = write_cpp(config)
  File "/esphome/esphome/__main__.py", line 185, in write_cpp
    generate_cpp_contents(config)
  File "/esphome/esphome/__main__.py", line 197, in generate_cpp_contents
    CORE.flush_tasks()
  File "/esphome/esphome/core/__init__.py", line 626, 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 177, in wrapped
    await coro(conf)
  File "/esphome/esphome/components/font/__init__.py", line 360, in to_code
    font = load_bitmap_font(CORE.relative_config_path(conf[CONF_PATH]))
  File "/esphome/esphome/components/font/__init__.py", line 334, in load_bitmap_font
    pil_font_path = convert_bitmap_to_pillow_font(filepath)
  File "/esphome/esphome/components/font/__init__.py", line 327, in convert_bitmap_to_pillow_font
    return cv.file_(local_pil_font_file)
  File "/esphome/esphome/config_validation.py", line 1397, in file_
    raise Invalid(
voluptuous.error.Invalid: Could not find file 'config/config/.esphome/font/31010cf8/MatrixClock-Light8.pil'. Please make sure it exists (full path: /config/config/config/.esphome/font/31010cf8/MatrixClock-Light8.pil).

Additional information

To Reproduce

Steps to reproduce the behavior: Try to install current ulanzi-easy.yaml Config with ESPHome 2023.8.2

Expected behavior

ESPHome sould install without any error

Configuration

# https://github.com/lubeda/EspHoMaTriXv2
substitutions:
  devicename: "ulanzi-led-matrix"
  friendly_name: "Ulanzi LED Matrix"
  # Pin definition from https://github.com/aptonline/PixelIt_Ulanzi 
  battery_pin: GPIO34 
  buzzer_pin: GPIO15 
  ldr_pin: GPIO35 
  matrix_pin: GPIO32 
  left_button_pin: GPIO26 
  mid_button_pin: GPIO27 
  right_button_pin: GPIO14 
  scl_pin: GPIO22 
  sda_pin: GPIO21 

esphome:
  name: ${devicename}
  platform: ESP32
  board: esp32dev
  comment: "Ulanzi LED Matrix"
  project:
    name: "Ulanzi.EHMTXv2"
    version: "2.0.0"
  on_boot:
    then:
      - ds1307.read_time:

logger:
  level: WARN

api:
  encryption:
    key: !secret api_key
  reboot_timeout: 8hours
  services:
    - service: tune
      variables:
        tune: string
      then:
        - rtttl.play:
            rtttl: !lambda 'return tune;'

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  reboot_timeout: 8hours
  ap:
    ssid: "${devicename}"
    password: !secret fallback_password
  manual_ip:
    static_ip: 192.168.178.209
    gateway: 192.168.178.1
    subnet: 255.255.255.0
  use_address: 192.168.178.209

web_server:
  port: 80
  auth:
    username: admin
    password: !secret web_server_password

time:
  - platform: homeassistant
    timezone: "Europe/Berlin"
    id: homeassistant_time
    on_time_sync:
      then:
        ds1307.write_time:
  - platform: ds1307
    update_interval: never
    id: ehmtx_time

captive_portal:

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

rtttl:
  output: rtttl_out

switch:
  - platform: template
    name: "Auto-Adjust Brightness"
    id: switch_autobrightness
    icon: mdi:brightness-auto
    restore_mode: RESTORE_DEFAULT_ON
    lambda: |-
      if (id(aab_enable)) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      lambda: |-
        id(aab_enable) = true;
    turn_off_action:
      lambda: |-
        id(aab_enable) = false;

globals:
  # aab = auto-adjustable brightness
  - id: aab_enable
    type: "bool"
    restore_value: true
    initial_value: "true"
  - id: aab_add
    type: int
    initial_value: '10'
  - id: aab_max
    type: int
    initial_value: '220'
  - id: aab_min
    type: int
    initial_value: '20'

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EspHoMaTriXv2
      ref: main
    refresh: 60s 
    components: [ ehmtxv2 ]  

font:
  # Matrix Clock Fonts
  # Grab these from https://github.com/trip5/MatrixClockFonts
  # See https://github.com/lubeda/EspHoMaTriXv2#font
  # Store in a "fonts" subfolder of your ESPHome config folder or change paths below
  - file: fonts/MatrixClock-Light8.bdf
    id: default_font
    glyphs:  |
      ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°
  - file: fonts/MatrixClock-Chunky6.bdf
    id: special_font
    glyphs:  |
      ! "#$%&'()*+,-./0123456789:APMTapmt

#animation:
#  - id: animation_black
#    file: "1pixel.gif"

#image:
#  - id: image_black
#    file: "1pixel.gif"

binary_sensor:
  - platform: status
    name: "$devicename Status"
  - platform: gpio
    pin:
      number: $left_button_pin
      inverted: true
    name: "Left button"
  - platform: gpio
    pin: 
      inverted: true
      number: $mid_button_pin
      mode: INPUT_PULLUP
    name: "Middle button"
  - platform: gpio
    pin: 
      number: $right_button_pin
      inverted: true
    name: "Right button"

sensor:
  - platform: wifi_signal
    name: "${devicename} WiFi Signal"
    device_class: signal_strength
    update_interval: 60s
  - platform: uptime
    name: "${devicename} Uptime"
    device_class: duration

  - platform: sht3xd
    temperature:
      name: "${devicename} Temperature"
      filters:
        - offset: -10.0
    humidity:
      name: "$devicename Relative 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: |-
          auto r = ((x - 3) / 0.69 * 100.00);
          if (r >= 100) return 100;
          if (r > 0) return r;
          if (r <= 0) return 1;
          return 0;
    unit_of_measurement: '%'
  - platform: adc
    id: light_sensor
    name: "$devicename Illuminance"
    pin: $ldr_pin
    update_interval: 10s
    attenuation: auto
    unit_of_measurement: lx
    device_class: illuminance
    accuracy_decimals: 0
    filters:
      - lambda: |-
          return (x / 10000.0) * 2000000.0 - 15 ;
    on_value:
      then:
        - lambda: |-
            if ( id(aab_enable) ) {
              int n = x / 4 + id(aab_add); // new_value
              if (n > id(aab_max)) n = id(aab_max);
              if (n < id(aab_min)) n = id(aab_min);
              int c = id(rgb8x32)->get_brightness(); // current value
              c = c>0?c:1 ; 
              int d = (n - c) * 100 / c; // diff in %
              if ( abs(d) > 2 ) id(rgb8x32)->set_brightness(n);
            }

i2c:
  sda: $sda_pin
  scl: $scl_pin
  scan: true
  id: i2cbus

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    internal: true
    variant: WS2812
    pin: $matrix_pin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    gamma_correct: 2.0
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF

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();

ehmtxv2:
  id: rgb8x32
  icons2html: true
  matrix_component: ehmtx_display
  time_component: ehmtx_time
  time_format: "%H:%M"
  date_format: "%d.%m."
  show_seconds: false
  show_dow: false
  # Uncomment below if using the mateine font
  # default_font_id: default_font
  # special_font_id: default_font
  # Comment out below if using mateine font
  default_font_id: default_font
  default_font_yoffset: 8
  special_font_id: special_font
  special_font_yoffset: 6
  # until here
  boot_logo: "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,63519,63519,63519,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,0,0,0,0,2016,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,63488,0,63488,0,0,0,63519,0,0,0,0,2016,2016,0,0,0,65514,0,65514,0,0,0,31,0,0,0,64512,0,0,64512,0,63488,63488,0,63488,63488,0,0,63519,63519,63519,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,31,31,31,0,0,0,64512,64512,0,0,63488,63488,63488,63488,63488,0,0,63519,0,0,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,31,0,0,0,0,64512,64512,0,0,0,63488,63488,63488,0,0,0,63519,63519,63519,63519,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,0,31,31,0,64512,0,0,64512,0,0,0,63488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
  icons: 
    - id: error
      lameid: 40530
    - id: home_assistant
      lameid: 47693
    - id: temperature
      lameid: 2355
    - id: lightbulb
      lameid: 1762
    - id: music
      lameid: 45625
    - id: phone
      lameid: 1232
    - id: car
      lameid: 2819
    - id: weather_clear_night
      lameid: 52163
    - id: weather_cloudy
      lameid: 25991
    - id: weather_fog
      lameid: 52167
    - id: weather_sunny
      lameid: 52156
    - id: sleep8x32
      url: https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif 
  on_next_screen:
    - homeassistant.event:
        event: esphome.new_screen
        data_template:
          iconname: !lambda "return icon.c_str();"
          text: !lambda "return text.c_str();"

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "${devicename} IP Address"
    ssid:
      name: "${devicename} SSID"
    bssid:
      name: "${devicename} BSSID"
    mac_address:
      name: "${devicename} Mac Address"
trip5 commented 1 year ago

There's a clue in your error message. Did you put the BDF font files on the same machine that is running ESPHome? They should be in a folder called 'fonts'.

lubeda commented 1 year ago

Normaly a missing font or wrong font path raises an other error. can you try to "clean build files" before recompiling?

CM000n commented 1 year ago

There's a clue in your error message. Did you put the BDF font files on the same machine that is running ESPHome? They should be in a folder called 'fonts'.

ESPHome runs as a Docker container and I have created a fonts/ directory with the fonts inside the ESPHome config directory that is linked to the Docker image.

Screenshot 2023-09-03 214502

Normaly a missing font or wrong font path raises an other error. can you try to "clean build files" before recompiling?

I have already tried that. Unfortunately without success.

trip5 commented 1 year ago

If your ESPHome yaml files are all in esphome/config then that's a genuine error... but if your yaml files are in the esphome folder, you need to change the path under the font: section.

lubeda commented 1 year ago

Versuch mal chmod 0777 *.bdfin dem Verzeichnis. Bei der Konstellation kann ich nicht sagen wie die rechte sein müssen.

CM000n commented 1 year ago

If your ESPHome yaml files are all in esphome/config then that's a genuine error... but if your yaml files are in the esphome folder, you need to change the path under the font: section.

Sorry, I don't understand @trip5. ESPHome knows the path and it exists. If I tried to enter a path that does not exist, the error message would be the following:

Failed config

font: [source config/ulanzi-led-matrix.yaml:134]
  - 
    Could not find file 'config/nonexistentpath/MatrixClock-Light8.bdf'. Please make sure it exists (full path: /config/config/nonexistentpath/MatrixClock-Light8.bdf).
    file: nonexistentpath/MatrixClock-Light8.bdf
    id: default_font
    glyphs: |-
      ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°
  - 
    Could not find file 'config/nonexistentpath/MatrixClock-Chunky6.bdf'. Please make sure it exists (full path: /config/config/nonexistentpath/MatrixClock-Chunky6.bdf).
    file: nonexistentpath/MatrixClock-Chunky6.bdf
    id: special_font
    glyphs: ! "#$%&'()*+,-./0123456789:APMTapmt
CM000n commented 1 year ago

Versuch mal chmod 0777 *.bdfin dem Verzeichnis. Bei der Konstellation kann ich nicht sagen wie die rechte sein müssen.

No, extended file permissions do not change anything. Shall we continue the conversation in German? Maybe English would be better, in case someone with the same problem comes across this issue thread?

trip5 commented 1 year ago

I think lubeda is on the right track with permissions. Have you got Portainer? Sometimes I use it to get a shell inside the container and run tests like copying and deleting files. If the container shell has issues, ESPHome probably will too.

Sometimes, I just throw my hands up and run the container with --privileged and hope that works and try to fix permissions later.

Edit: looks like I actually am running the ESPHome container like that. Probably not the best solution but... sigh, linux...

lubeda commented 1 year ago

OK, so your error is either a local problem or a bug in esphome. I assume it's a local problem.

CM000n commented 1 year ago

I think lubeda is on the right track with permissions. Have you got Portainer? Sometimes I use it to get a shell inside the container and run tests like copying and deleting files. If the container shell has issues, ESPHome probably will too.

Sometimes, I just throw my hands up and run the container with --privileged and hope that works and try to fix permissions later.

Edit: looks like I actually am running the ESPHome container like that. Probably not the best solution but... sigh, linux...

No need for portainer ;-)

docker exec -it esphome bash

I can't find a permission problem within the container either. The owners and group rights of the folders and files are set correctly, even recursively. So it must be something else.

CM000n commented 1 year ago

Interesting. Esphome seems to have created the correct files for MatrixClock-Light8.bdf. So the problem really seems to be more with the MatrixClock-Chunky6.bdf font.

root@esphome:/config/config/.esphome/font/31010cf8# ls -a -l
total 48
drwxrwxrwx+ 1 root users   132 Sep  3 21:04 .
drwxrwxrwx+ 1 root users    16 Sep  3 21:04 ..
-rwxrwxrwx+ 1 root users 35741 Sep  3 21:04 MatrixClock-Light8.bdf
-rwxrwxrwx+ 1 root users   608 Sep  3 22:16 MatrixClock-Light8.pbm
-rwxrwxrwx+ 1 root users  5142 Sep  3 22:16 MatrixClock-Light8.pil

...:edit::.. Apparently not. When I comment out the MatrixClock-Chunky6.bdf font, it still doesn't work. :-/ So it creates the file for MatrixClock-Light8.pil in the right place, but can't find it and then stops compiling? wtf ^^

...::editedit::.. Ahh, it creates the file under /config/config/.esphome/font/31010cf8/ but tries to find it under /config/config/config/.esphome/font/31010cf8/. WTF again :-D

Please make sure it exists (full path: /config/config/config/.esphome/font/31010cf8/MatrixClock-Light8.pil
trip5 commented 1 year ago

Well I can confirm it's not the latest version of ESPHome... I just updated to official 2023.8.2 and it compiled just fine. I'm honestly lost to help you other than to paste from my own yaml which I can confirm compiles with the latest ehmtx too. Of course, this doesn't match the official yaml and I keep all my icons local so perhaps remove that before working with it.

I can say I keep the font: section much higher. Would that affect anything you think?

Sorry but I'm past my bedtime. Good luck. I'll check back later!

substitutions:
  devicename: pixelclock-bunny
  friendly_name: PixelClock-bunny
# Pin definition from https://github.com/aptonline/PixelIt_Ulanzi 
  ldr_pin: GPIO35 
  ledpin: GPIO32 
  left_button_pin: GPIO26 
  mid_button_pin: GPIO27 
  right_button_pin: GPIO14 
  battery_pin: GPIO34 
  buzzer_pin: GPIO15 
  scl_pin: GPIO22 
  sda_pin: GPIO21

esp32:
  board: esp32dev # for Ulanzi TC-001

switch:
  - platform: template
    name: "$friendly_name Auto-Adjust Brightness"
    id: switch_autobrightness
    icon: mdi:brightness-auto
    restore_mode: RESTORE_DEFAULT_ON
    lambda: |-
      if (id(aab_enable)) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      lambda: |-
        id(aab_enable) = true;
    turn_off_action:
      lambda: |-
        id(aab_enable) = false;

globals:
  # aab = auto-adjustable brightness
  - id: aab_enable
    type: "bool"
    restore_value: true # Pixel clock change both to false (unless you fix the ldr)
    initial_value: "true"
  - id: aab_add
    type: int
    initial_value: '20'
  - id: aab_max
    type: int
    initial_value: '200'
  - id: aab_min
    type: int
    initial_value: '20'

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EspHoMaTriXv2
      ref: main
    refresh: 60s
    components: [ ehmtxv2 ]
#  - source:
#      type: local
#      path: my-components/ehmtxv2-2023.7.0 # e.g. /config/esphome/components
#    components: [ ehmtxv2 ]

esphome:
  comment: "EHMTXv2 from LuBeDa"
  name: $devicename 
  project:
    name: "Ulanzi.EHMTXv2"
    version: "2.0.0"
  on_boot: # PixelClock: delete
    then:      
      - ds1307.read_time:

font:
  - file: ehmtxv2/MatrixClock-Chunky8X.bdf #
    id: special_font
    glyphs:  |
      ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°
  - file: ehmtxv2/MatrixClock-Light8X.bdf
    id: default_font
    glyphs:  |
      ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°{|}~¡¢£¤¥¦§¨©ª«¬®¯±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ

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

logger:
  level: WARN

api:
  services: # PixelClock: delete the services
    - service: tune
      variables:
        tune: string
      then:
        - rtttl.play:
            rtttl: !lambda 'return tune;'

sensor: # PixelClock: delete all sensors except Illuminance
  - platform: sht3xd
    temperature:
      name: "$friendly_name Temperature"
    humidity:
      name: "$friendly_name Relative Humidity"
    update_interval: 60s
  - platform: adc
    pin: $battery_pin
    name: "$friendly_name 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: |-
          auto r = ((x - 3) / 0.69 * 100.00);
          if (r >= 100) return 100;
          if (r > 0) return r;
          if (r <= 0) return 1;
          return 0;
    unit_of_measurement: '%'
  - platform: adc
    id: light_sensor
    name: "$friendly_name Illuminance"
    pin: $ldr_pin
    update_interval: 10s
    attenuation: auto
    unit_of_measurement: lx
    device_class: illuminance
    accuracy_decimals: 0
    filters:
      - lambda: |-
          return (x / 10000.0) * 2000000.0 - 15 ;
    on_value:
      then:
        - lambda: |-
            if ( id(aab_enable) ) {
              int n = x / 4 + id(aab_add); // new_value
              if (n > id(aab_max)) n = id(aab_max);
              if (n < id(aab_min)) n = id(aab_min);
              int c = id(rgb8x32)->get_brightness(); // current value
              int d = (n - c) * 100 / c; // diff in %
              if ( abs(d) > 2 ) id(rgb8x32)->set_brightness(n);
            }

ota:
  password: !secret ota_password

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

web_server:
  port: 80
  ota: true
  include_internal: true

captive_portal:

text_sensor:
  - platform: version
    name: "$friendly_name Version"
    hide_timestamp: true
    internal: true

button:
  - platform: restart
    name: "$friendly_name Restart"
    internal: true

output: # Pixelclock: delete
  - platform: ledc
    pin: $buzzer_pin
    id: rtttl_out

rtttl: # Pixelclock: delete
  output: rtttl_out

i2c: # Pixelclock: delete
  sda: $sda_pin
  scl: $scl_pin
  scan: true
  id: i2cbus

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    internal: true
    variant: WS2812
    pin: $ledpin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    gamma_correct: 2.0
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF

time: # Pixel clock: keep only top 3 lines and id
  - platform: homeassistant
    timezone: "Asia/Seoul"
    update_interval: 8h
    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
# Ulanzi-TC001: mapper
    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();

ehmtxv2:
  id: rgb8x32
  icons2html: false
  matrix_component: ehmtx_display
  time_component: ehmtx_time
  date_format: "%a %d" # "%b %d" = Mon DD / "%a %d" = Day DD / "%m.%d" = MM.DD
  time_format: "%l:%M%p"   # defaults "%H:%M" (use "%I:%M%p" for the US)
  show_dow: false
  show_date: true
  week_start_monday: false # false equals sunday
  show_seconds: false
  default_font_id: default_font
  default_font_yoffset: 8
  special_font_id: special_font
  special_font_yoffset: 8
  brightness: 80 # percent
  default_clock_font: false
  clock_interval: 2
  blend_steps: 16 # nice transitions

  icons: 
    - id: ha
      file: ehmtxv2/ha.gif
      pingpong: true
    - id: humidity
      file: ehmtxv2/humidity.gif
    - id: temp_heatermode
      file: ehmtxv2/temp_heatermode.gif
    - id: temp_acmode
      file: ehmtxv2/temp_acmode.gif
    - id: aqi0
      file: ehmtxv2/aqi0.gif
    - id: aqi50
      file: ehmtxv2/aqi50.gif
    - id: aqi100
      file: ehmtxv2/aqi100.gif
    - id: aqi150
      file: ehmtxv2/aqi150.gif
    - id: aqi200
      file: ehmtxv2/aqi200.gif
    - id: aqi250
      file: ehmtxv2/aqi250.gif
    - id: weather_clear_night
      file: ehmtxv2/weather_clear_night.gif
    - id: weather_cloudy
      file: ehmtxv2/weather_cloudy.gif
    - id: weather_exceptional
      file: ehmtxv2/weather_exceptional.gif
    - id: weather_fog
      file: ehmtxv2/weather_fog.gif
    - id: weather_hail
      file: ehmtxv2/weather_hail.gif
    - id: weather_lightning
      file: ehmtxv2/weather_lightning.gif
    - id: weather_lightning_rainy
      file: ehmtxv2/weather_lightning_rainy.gif
    - id: weather_partlycloudy
      file: ehmtxv2/weather_partlycloudy.gif
    - id: weather_pouring
      file: ehmtxv2/weather_pouring.gif
    - id: weather_rainy
      file: ehmtxv2/weather_rainy.gif
    - id: weather_snowy
      file: ehmtxv2/weather_snowy.gif
    - id: weather_snowy_rainy
      file: ehmtxv2/weather_snowy_rainy.gif
    - id: weather_sunny
      file: ehmtxv2/weather_sunny.gif
    - id: weather_windy
      file: ehmtxv2/weather_windy.gif
    - id: weather_windy_variant
      file: ehmtxv2/weather_windy_variant.gif
    - id: weather_cloudy_night
      file: ehmtxv2/weather_cloudy_night.gif
    - id: bitcoin
      file: ehmtxv2/bitcoin.gif
  on_next_screen:
    - homeassistant.event:
        event: esphome.new_screen
        data_template:
          iconname: !lambda "return icon.c_str();"
          text: !lambda "return text.c_str();"

image: # here because ESPHome 2023.7.0 has broken something
    - file: ehmtxv2/1pixel.gif
      id: breaking20237

animation: # here because ESPHome 2023.7.0 has broken something
    - file: ehmtxv2/1pixel.gif
      id: breaking202371
CM000n commented 1 year ago

Thank you for your yaml config @trip5. But the problem really seems to be with ESPHome or the ESPHome Docker container and the "convert_bitmap_to_pillow_font" function. It is now also time for me to go to bed. I'll take a closer look tomorrow.

trip5 commented 1 year ago

I just wanted to swing by and say I did not have a problem with the ulanzi-easy.yaml file, provided I tacked this on at the end:

image: # here because ESPHome 2023.7.0 has broken something
    - file: ehmtxv2/1pixel.gif
      id: breaking20237

animation: # here because ESPHome 2023.7.0 has broken something
    - file: ehmtxv2/1pixel.gif
      id: breaking202371

All I can think is your ESPHome container is bad.

A year or so ago ESPHome gave me some hiccups and there were a lot of leftover garbage files so I copied out my yamls, external files, and secrets file... then deleted the entire config folder, removed the container, and started fresh.

lubeda commented 1 year ago

Can you check if the bdf file is ok. You can use a text editor, the first line should be "STARTFONT 2.1" not ". perhaps your pdf file needs to be downloaded again.

CM000n commented 1 year ago

The .bdf files seems to be valid. Can you please share your compose file, if you use docker-compose @trip5 ? I started all over again. But my container behaves the same.

My compose file looks like this:

version: "3.6"
services:
  esphome:
    image: "esphome/esphome"
    container_name: "esphome"
    hostname: "esphome" 
    restart: "always"
    command: "dashboard --username ${ESPHOME_USER} --password ${ESPHOME_PASSWORD} config/"
    volumes:
      - "${DOCKER_DATA}/esphome:/config"
    environment:
      - "TZ=Europe/Berlin"
      - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      - "LANG=C.UTF-8"
      - "LC_ALL=C.UTF-8"
      - "PLATFORMIO_GLOBALLIB_DIR=/piolibs"
      - "USERNAME=${ESPHOME_USER}"
      - "PASSWORD=${ESPHOME_PASSWORD}"
      - "ESPHOME_DASHBOARD_USE_PING=true"
    networks:
      - "bridge"
    ports:
      - "6052:6052"
    dns: 
      - "192.168.178.1"
networks:
  bridge:
    driver: "bridge"

and it always creates a folder structure like this:

root in 🌐 Openmediavault in data/docker_data/esphome
❯ tree
.
└── config
    ├── ehmtxv2
    │   ├── 1pixel.gif
    │   ├── EHMTXv2.ttf
    │   ├── mateine.ttf
    │   ├── MatrixClock-Chunky6.bdf
    │   ├── MatrixClock-Light8.bdf
    │   └── ulanzi-led-matrix.html
    ├── esp-01s-stromzaehler.yaml
    ├── nodemcuv2-openv.yaml
    ├── nous-a1t-smartplug-1.yaml
    ├── nous-a1t-smartplug-2.yaml
    ├── nous-a1t-smartplug-3.yaml
    ├── nous-a1t-smartplug-4.yaml
    ├── secrets.yaml
    ├── shelly-1pm-bad-deckenlampe.yaml
    ├── shelly-1pm-bad-spiegellampe.yaml
    ├── shelly-1pm-buero-ecke.yaml
    ├── shelly-1pm-buero-tuer.yaml
    └── ulanzi-led-matrix.yaml

2 directories, 18 files
CM000n commented 1 year ago

very wierd. My docker container always creates a config folder inside the config folder that is linked as docker volume. I think I'll close this issue here and open a new one in the ESPHome repo, as it seems to be a more general problem. I'll copy the new issue here later as a reference.

CM000n commented 1 year ago

https://github.com/esphome/issues/issues/4853

trip5 commented 1 year ago

Sure. Actually I have a bad (?) habit of avoiding docker files if I can do it via command line:

sudo docker run -d --name esphome --privileged --restart=unless-stopped -e TZ=Asia/Seoul -v '/home/trip5/docker/esphome/:/config/' -v /etc/localtime:/etc/localtime:ro --network=host esphome/esphome:latest

I also have a bad habit of using the host network (almost everything unless I need to re-map ports) and running privileged containers (actually just ESPHome, Home Assistant). I don't need a password because it's behind Authentik.

I'm pretty sure ping is on by default so you don't need to add it. Also your vars for PATH, LANG, LC_ALL, and PLATFORMIO_GLOBALLIB_DIR all appear to conform to the default (I checked mine with Portainer) so why bother specifying them? Same question for the COMMAND. You also don't specify an ENTRYPOINT... the default is /entrypoint.sh by the way. I don't know if there is some side-effect of specifying one but not the other...

Another difference I see is you're using an environment variable to pass the location of the config folder... I've always explicitly specified mine. Not sure if any of this will help you. In general, though, in my experience with docker, I've sometimes had some issues when specifying things that didn't need to be specified... Here's a pretty bare-bones compose file that I probably used before working out the command-line:

version: '3'

services:
  esphome:
    container_name: esphome
    image: esphome/esphome:latest
    volumes:
      - '/home/trip5/docker/esphome/:/config/'
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host
CM000n commented 1 year ago

Sure. Actually I have a bad (?) habit of avoiding docker files if I can do it via command line...

Thank you. I like doing things explicitly rather than trusting that they will work implicitly. ;-)