olicooper / esphome-nspanel-lovelace-native

Custom ESPHome component for NSPanel utilising the TFT firmware of the project 'joBr99/nspanel-lovelace-ui'
Other
34 stars 6 forks source link

fix: build time error possibly caused by esphome 2024.6 #15

Closed kiddyfurby closed 2 months ago

olicooper commented 2 months ago

Are you able to provide more context? I can't seem to reproduce it on esphome v2024.6.1.. Are you on Windows or Unix-based system? It's possible the path is incorrect for the platform and needs transforming? i.e. using from pathlib import Path? I am looking in the esphome repo now but I haven't spotted any recent changes related to build paths yet?

kiddyfurby commented 2 months ago

Of course. I used docker so that should eliminate most of the platform inconsistencies. Compiling the basic example would yield the following error.

root@orangepi:~/docker/esphome/config# docker run --rm -v "${PWD}":/config -it ghcr.io/esphome/esphome compile basic-example.yaml
INFO ESPHome 2024.6.6
INFO Reading configuration basic-example.yaml...
INFO Cloning https://github.com/olicooper/esphome-nspanel-lovelace-native@dev
INFO Fetching dev
INFO Generating C++ source...
Traceback (most recent call last):
  File "/usr/local/bin/esphome", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/esphome/esphome/__main__.py", line 1079, in main
    return run_esphome(sys.argv)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 1066, in run_esphome
    rc = POST_CONFIG_ACTIONS[args.command](args, config)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 433, in command_compile
    exit_code = write_cpp(config)
                ^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 193, in write_cpp
    generate_cpp_contents(config)
  File "/esphome/esphome/__main__.py", line 205, in generate_cpp_contents
    CORE.flush_tasks()
  File "/esphome/esphome/core/__init__.py", line 681, 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 185, in wrapped
    await coro(conf)
  File "/config/.esphome/external_components/e1292338/components/nspanel_lovelace/__init__.py", line 655, in to_code
    navleft_icon_value = r'u8"\u{0}"'.format(get_icon_hex("arrow-left-bold"))
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/.esphome/external_components/e1292338/components/nspanel_lovelace/__init__.py", line 142, in get_icon_hex
    load_icons()
  File "/config/.esphome/external_components/e1292338/components/nspanel_lovelace/__init__.py", line 115, in load_icons
    os.mkdir(core.CORE.build_path)
FileNotFoundError: [Errno 2] No such file or directory: '.esphome/./.build/nspanel-basic'
olicooper commented 2 months ago

Thanks for the additional details, I was able to reproduce and I think your solution is better as it avoids duplication of the icons file. Thanks!