Compile Error - ESPHome on Windows

I installed ESPHome on a Windows 11 PC. The install went reasonably well. I’m able to edit, compile and install most code copied from an Home Assistant Blue computer. I have however run into problems with two files. Both throw errors during the compile process. I thought using the clean files command would solve the problem. Not! The same errors appear when running that command.

Here are the results from one of the files;

INFO ESPHome 2024.8.0
INFO Reading configuration C:\Users\rcbla\OneDrive\Home_Assistant\ESPHome\Config\esp32-s3box-3.yaml...
INFO Updating https://github.com/gnumpi/esphome_audio@dev-next
INFO Detected timezone 'America/New_York'
ERROR Unexpected exception while reading configuration:
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Scripts\esphome.exe\__main__.py", line 7, in <module>
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\__main__.py", line 1014, in main
    return run_esphome(sys.argv)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\__main__.py", line 992, in run_esphome
    config = read_config(dict(args.substitution) if args.substitution else {})
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\config.py", line 1091, in read_config
    res = load_config(command_line_substitutions)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\config.py", line 945, in load_config
    return _load_config(command_line_substitutions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\config.py", line 935, in _load_config
    return validate_config(config, command_line_substitutions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\config.py", line 859, in validate_config
    result.run_validation_steps()
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\config.py", line 142, in run_validation_steps
    task.step.run(self)
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\config.py", line 562, in run
    validated = schema(self.conf)
                ^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\voluptuous_schema.py", line 35, in __call__
    res = super().__call__(data)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 281, in __call__
    return self._compiled([], data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\validators.py", line 251, in _run
    return self._exec(self._compiled, value, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\validators.py", line 379, in _exec
    v = func(path, v)
        ^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 855, in validate_callable
    return schema(data)
           ^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\voluptuous_schema.py", line 35, in __call__
    res = super().__call__(data)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 281, in __call__
    return self._compiled([], data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 625, in validate_dict
    return base_validate(path, data.items(), out)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\voluptuous_schema.py", line 149, in validate_mapping
    cval = cvalue(key_path, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\validators.py", line 251, in _run
    return self._exec(self._compiled, value, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\validators.py", line 379, in _exec
    v = func(path, v)
        ^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 855, in validate_callable
    return schema(data)
           ^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\components\font\__init__.py", line 308, in _file_schema
    return validate_file_shorthand(value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\components\font\__init__.py", line 273, in validate_file_shorthand
    return FILE_SCHEMA(
           ^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\validators.py", line 254, in __call__
    return self._exec((Schema(val) for val in self.validators), v)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\validators.py", line 377, in _exec
    v = func(v)
        ^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 281, in __call__
    return self._compiled([], data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 855, in validate_callable
    return schema(data)
           ^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\components\font\__init__.py", line 309, in _file_schema
    return TYPED_FILE_SCHEMA(value)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\config_validation.py", line 1621, in validator
    value = Schema(schemas[key_v])(value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\voluptuous_schema.py", line 35, in __call__
    res = super().__call__(data)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 281, in __call__
    return self._compiled([], data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\validators.py", line 251, in _run
    return self._exec(self._compiled, value, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\validators.py", line 379, in _exec
    v = func(path, v)
        ^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\voluptuous\schema_builder.py", line 855, in validate_callable
    return schema(data)
           ^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\components\font\__init__.py", line 221, in download_web_font
    external_files.download_content(url, path)
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\site-packages\esphome\external_files.py", line 105, in download_content
    path.write_bytes(req.content)
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\pathlib.py", line 1036, in write_bytes
    with self.open(mode='wb') as f:
         ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\rcbla\AppData\Local\Programs\Python\Python312\Lib\pathlib.py", line 1013, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: 'C:\\Users\\rcbla\\OneDrive\\Home_Assistant\\ESPHome\\Config\\.esphome\\font\\c9ee33c7\\font.ttf'

Try as I may, I’m not able to decipher what this message is telling me.

The other device is the RATGDO. Here are the results from that file;

INFO ESPHome 2024.8.0
INFO Reading configuration C:\Users\rcbla\OneDrive\Home_Assistant\ESPHome\Config\garage-door-opener.yaml...
Failed config

packages: [source C:\Users\rcbla\OneDrive\Home_Assistant\ESPHome\Config\garage-door-opener.yaml:5]
  
  not a valid value.
  ratgdo.esphome: github://ratgdo/esphome-ratgdo/v25iboard.yaml@main

Both files were copied from the HA Blue pc. Both compile without a problem on that computer.

Any insight you can offer would be appreciated.

I’m having the same issue. Were you able to get past the it?

I wonder if the error is because the font path has too many backslashes in the file path. Maybe windows can’t handle this. But how to you get around it?

…\\Config\\.esphome\\font\\c9ee33c7\\font.ttf

Not on a Windows WSL install! I suspect it was due to configuration of the VM. Despite several configuration attempts, the VM constantly lost access to the internet.

In the end, I purchased a BeeLink S2 mini then installed ESPHome in an LXC. This configuration works great!

Thanks for answering. I was able to get past this by downloading the font file directly and updating the YAML file with the local file path.

ORIGINAL

font:
  - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
    id: my_font
    size: 14
    glyphs:
      '${font_glyphs}'

NEW

font:
  - file: ".esphome/font/c9ee33c7/font.ttf"
    id: my_font
    size: 14
    glyphs:
      '${font_glyphs}'

I’m now able compile this ESP Home project in the windows command line.

1 Like