mmakaay / esphome-xiaomi_bslamp2

ESPHome integration for the Xiaomi Mijia Bedside Lamp v2.
Other
204 stars 49 forks source link

[BUG] Could not find package with espressif/toolchain-riscv32-esp #116

Closed TheFes closed 1 year ago

TheFes commented 1 year ago

Describe the bug When I try to update from 2023.4.1 to 2023.4.3 I get the following error as soon as it starts installing the newly compiled firmware:

Tool Manager: Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2
INFO Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2
Error: Could not find the package with 'espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2' requirements for your system 'linux_x86_64'

To Reproduce Steps to reproduce the behavior:

  1. Press the update button, and wait until compiling is completed

Expected behavior Installation of the firmware :)

mmakaay commented 1 year ago

That is.. well ... Interesting, given that the lamp isn't RISC-V. I will take a look at it.

mmakaay commented 1 year ago

I tried compiling the firmware using esphome 2023.4.3 and 2023.4.4 from the command line install. I could compile and upload without any issues, so the issue is not a general core issue. Investigating further.

TheFes commented 1 year ago

To be sure it's not because of changes made to the config files (I changed the button behaviour a bit) I tried again with the code from example.yaml. I cleaned the build files first (also to be sure to have a clean start) and then tried a manual download with modern format, ant this is what I get then:

INFO Reading configuration /config/esphome/bedside-lamp.yaml...
INFO Updating https://github.com/mmakaay/esphome-xiaomi_bslamp2@dev
WARNING The selected ESP-IDF framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.
WARNING The selected ESP-IDF framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.
INFO Generating C++ source...
INFO Compiling app...
Processing bedside-lamp (board: esp32doit-devkit-v1; framework: espidf; platform: platformio/espressif32 @ 3.5.0)
--------------------------------------------------------------------------------
Tool Manager: Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2
INFO Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2
Error: Could not find the package with 'espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2' requirements for your system 'linux_x86_64'

I'm using the latest stable version of the ESPHome Add-on with ESPHome version 2023.4.4

amohoste commented 1 year ago

Not sure why the RISC-V package is being included either, but the issue seems to be due to Espressif updating the esp32 toolchains and older versions of the package being removed. I managed to fix the issue by adding a newer version of the package, which is still available to my config:

esphome:
  platformio_options:
    platform_packages:
      - "toolchain-riscv32-esp @8.4.0+2021r2-patch5"
TheFes commented 1 year ago

Nice, it indeed works like that!

mmakaay commented 1 year ago

The weird thing is that there is no need at all for the risc32-esp toolchain, since this is an ESP32 device. But I noticed that things work fine when using the current ESPHome default ESP-IDF framework version 4.4.4 for compiling. The lamp firmware had the version forced to 4.3.x to prevent a bricking issue, but for that bricking issue I wrote a PR for ESPHome to work around that. Since that PR has been merged a while ago, I can now safely use 4.4.4 for compiling and everything is peachy :-) Tried it on my dev lamp and it's up and running now.

Note that using 4.4.4, the build output doesn't mention riscv32 at all:

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.40404.0 (4.4.4)
 - tool-cmake @ 3.16.4
 - tool-ninja @ 1.9.0
 - toolchain-esp32ulp @ 2.35.0-20220830
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5

An additional issue that could occur, is that the file esp_mac.h could not be found on systems for which the riscv32 toolchain could be found. Really feels like some stuff was backported into the 4.3.x ESP-IDF framework in PlatformIO. But that issue was also fixed by moving to 4.4.4.

I will create a new release that fixes this issue.

mmakaay commented 1 year ago

I crafted a new 2023.4.0 release, which should fix the compile issues.

https://github.com/mmakaay/esphome-xiaomi_bslamp2/releases/tag/2023.4.0

mmakaay commented 1 year ago

Things look good for me with this release. I'll close the issue now. If there are remaining issues with it, then let me know and I'll reopen the issue.