Giter VIP home page Giter VIP logo

Comments (20)

lubeda avatar lubeda commented on September 3, 2024 2

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

from esphomatrixv2.

trip5 avatar trip5 commented on September 3, 2024

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

from esphomatrixv2.

lubeda avatar lubeda commented on September 3, 2024

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

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

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.

from esphomatrixv2.

trip5 avatar trip5 commented on September 3, 2024

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.

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

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

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

Versuch mal chmod 0777 *.bdf in 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?

from esphomatrixv2.

trip5 avatar trip5 commented on September 3, 2024

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

from esphomatrixv2.

lubeda avatar lubeda commented on September 3, 2024

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

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

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.

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

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

from esphomatrixv2.

trip5 avatar trip5 commented on September 3, 2024

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

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

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.

from esphomatrixv2.

trip5 avatar trip5 commented on September 3, 2024

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.

from esphomatrixv2.

lubeda avatar lubeda commented on September 3, 2024

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.

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

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

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

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.

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

esphome/issues#4853

from esphomatrixv2.

trip5 avatar trip5 commented on September 3, 2024

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

from esphomatrixv2.

CM000n avatar CM000n commented on September 3, 2024

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

from esphomatrixv2.

Related Issues (20)

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.