Component not found: font

My code that I copied from my old computer is showing this error “Component not found: font.”, in this part of the code. In this sense, I have already installed the fonts in homeassistant and still the error persists.

font:
  - file: "esphome/stocky.ttf"
    id: my_font
    size: 14
  - file: "esphome/arial.ttf"
    id: my_font2
    size: 13

display:
  - platform: ssd1306_i2c
    id: oled
    setup_priority: -100
    model: "SSD1306 128x64"
    address: 0x3C
    pages:
      - id: page1
        lambda: |-
          it.printf(3, 20, id(my_font), "Acqua Callidus");
      - id: page2
        lambda: |-
          it.printf(0, 20, id(my_font2), "Humidity: %.2f%%", id(office_humidity).state);
      - id: page3
        lambda: |-
          it.printf(0, 20, id(my_font2), "Pressure: %.2fhPa", id(outside_pressure).state);    
      - id: page4
        lambda: |-
          it.printf(0, 20, id(my_font2), "Temperature: %.2f°C", id(office_temperature).state);

Your config suggests that the font files are in /config/esphome/esphome -

file (Required ): The path (relative to where the .yaml file is) of the font file.

This is the correct way, but it doesn’t work either
font:

  • file: “/homeassistant/esphome/stocky.ttf”
    id: my_font
    size: 14
  • file: “/homeassistant/esphome/arial.ttf”
    id: my_font2
    size: 13

Relative to where the yaml files are placed. relative

The files are in the esphome folder, before it was working normally

Try following the docs. I am no way sure what your error is, but following the docs is the best plan.

If I read the error correctly, it is not the font files that are missing, but it does not understand font: itself. What version of esphome are you using? Also, the docs state you need additional packages. If you use the ESPHome addon you should already have it, if you have a different install you may not.

I am having this error. Could you please described how you solved it?

Yaml and logs please.

I have Esphome installed in a Windows environment. I can compile other devices. For some reason when I include the font component I get the error below. If I remove the font component it compiles and uploads the code without errors.

text_sensor:
  
  - platform: homeassistant
    name: "HA Message"
    id: home_assistant_message
    entity_id: input_text.venner_text
    internal: true
    
  - platform: homeassistant
    name: "HA Brightness"
    id: home_assistant_brightness
    entity_id: input_number.venner_brightness
    internal: true

font:

This is the error:

INFO ESPHome 2024.10.2
INFO Reading configuration clock.yaml...
INFO Detected timezone 'America/New_York'
Failed config

font: [source clock.yaml:99]

  Please update your pillow installation to 10.2.0. (pip install "pillow==10.2.0").
  - {}

If I run the pip install “pillow==10.2.0” command I get the following error:

Collecting pillow==10.2.0
  Using cached pillow-10.2.0.tar.gz (46.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "C:\Users\Xavier\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
          ~~~~^^
        File "C:\Users\Xavier\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Xavier\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\Xavier\AppData\Local\Temp\pip-build-env-9rhntcnm\overlay\Lib\site-packages\setuptools\build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Xavier\AppData\Local\Temp\pip-build-env-9rhntcnm\overlay\Lib\site-packages\setuptools\build_meta.py", line 303, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "C:\Users\Xavier\AppData\Local\Temp\pip-build-env-9rhntcnm\overlay\Lib\site-packages\setuptools\build_meta.py", line 319, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 31, in <module>
        File "<string>", line 28, in get_version
      KeyError: '__version__'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I don’t think it’s the same problem then. Please start a new thread.