esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
292 stars 36 forks source link

Resolve issue compiling esphome 2024.7.x - 2024.10.x on esp32-c6 #5938

Open ss89 opened 5 months ago

ss89 commented 5 months ago

The problem

I know the esp32-c6 is not officially supported (why actually? It's old enough and sdk is feature complete enough as well).

Still i would like to be able to compile esphome for this device.

It has worked for me for a long time, but stopped working with 2024.6.1 (didn't try 2024.6.0, as HA didn't show it to me).

Does anyone have a hint on how to make it comile again? I tried multiple esp-idf versions (5.2.0, 5.2.1, 5.2.2) and platform_versions (6.7.0, 6.6.0, 6.5.0, 6.4.0)

Which version of ESPHome has the issue?

2024.6.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2024.6.3

What platform are you using?

ESP32

Board

esp32-c6-devkitc-1

Component causing the issue

wifi

Example YAML snippet

esphome:
  name: heizung
  friendly_name: Heizung

esp32:
  board: esp32-c6-devkitc-1
  variant: esp32c6
  framework:
    type: esp-idf
    version: '5.1.1' # prior version used: 5.1.0
    platform_version: 6.5.0 #prior version used: https://github.com/stintel/platform-espressif32#esp32-c6-test

# Enable logging
logger:
  level: debug

# Enable Home Assistant API
api:
  encryption:
    key: "myApiEncryptionKey"

ota:
  password: "myOtaPassword"
  platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

one_wire:
  - pin: GPIO10
    platform: gpio

sensor:
  - platform: dallas_temp
    address: 0xetcEtcEtc
    name: 'temp'
    accuracy_decimals: 3

Anything in the logs that might be useful for us?

Compiling .pioenvs/heizung/src/esphome/components/wifi/wifi_component.o
Compiling .pioenvs/heizung/src/esphome/components/wifi/wifi_component_esp8266.o
Compiling .pioenvs/heizung/src/esphome/components/wifi/wifi_component_esp_idf.o
Compiling .pioenvs/heizung/src/esphome/components/wifi/wifi_component_libretiny.o
src/esphome/components/wifi/wifi_component.cpp:7:10: fatal error: esp_eap_client.h: No such file or directory

************************************************************************
* Looking for esp_eap_client.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp_eap_client.h"
* Web  > https://registry.platformio.org/search?q=header:esp_eap_client.h
*
************************************************************************

    7 | #include <esp_eap_client.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/heizung/src/esphome/components/wifi/wifi_component.o] Error 1

Additional information

No response

goldmann commented 5 months ago

I'm in the same boat. The problem is with this PR: https://github.com/esphome/esphome/pull/6756. The esp_eap_client.h header file is only available in IDF >= 5.2 and not 5.1.

goldmann commented 5 months ago

After I upgraded to IDF version 5.2.2 I was able to compile ESPHome (in my case) 2024.6.1.

ss89 commented 5 months ago

After I upgraded to IDF version 5.2.2 I was able to compile ESPHome (in my case) 2024.6.1.

Can you show your complete configuration? For me upping it to 5.2.2 gets me this error:

Reading CMake configuration...
-- git rev-parse returned 'fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).'
-- Building ESP-IDF components for target esp32c6
Processing 1 dependencies:
[1/1] idf (5.2.2)
-- Project sdkconfig file /data/build/heizung/sdkconfig.heizung
-- Configuring incomplete, errors occurred!
See also "/data/build/heizung/.pioenvs/heizung/CMakeFiles/CMakeOutput.log".

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Error at /data/cache/platformio/packages/framework-espidf/tools/cmake/tool_version_check.cmake:36 (message):

  Tool doesn't match supported version from list ['esp-13.2.0_20230928']:
  /data/cache/platformio/packages/toolchain-riscv32-esp@12.2.0+20230208/bin/riscv32-esp-elf-gcc

  Please try to run 'idf.py fullclean' to solve it.

Call Stack (most recent call first):
  /data/cache/platformio/packages/framework-espidf/components/esp_common/project_include.cmake:10 (check_expected_tool_version)
  /data/cache/platformio/packages/framework-espidf/tools/cmake/build.cmake:400 (include)
  /data/cache/platformio/packages/framework-espidf/tools/cmake/build.cmake:624 (__build_process_project_includes)
  /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:605 (idf_build_process)
  CMakeLists.txt:3 (project)

EDIT: I am compiling it using the esphome addon inside HA.

goldmann commented 5 months ago

Have you cleaned up build files before attempting to build it?

Here's the relevant part of my config. I had to clean it up by removing some sections.

substitutions:
  devicename: io-4

captive_portal: {}
web_server:
  port: 80
esp32:
  board: dfrobot_firebeetle2_esp32e
  variant: esp32
  framework:
    type: esp-idf
    version: 5.2.2
    platform_version: 6.7.0
esphome:
  name: $devicename
ss89 commented 5 months ago

That board looks more like it is a regular esp32, not an esp32-c6 (different processor type).

Are you also using the firebeetle2 esp32e board or are you just compiling the firmware as if it was this board and then flash it to the esp32-c6?

goldmann commented 5 months ago

Ok, I must admit I totally missed the esp32-c6 board part of the report, I apologize for this. So, no, I do use the esp32e processor on the FireBeetle 2 (https://www.dfrobot.com/product-2195.html) board.

pimdo commented 4 months ago

Seems that header file added in v5.1.2: https://github.com/espressif/esp-idf/tree/v5.1.2/components/wpa_supplicant/esp_supplicant/include

ss89 commented 4 months ago

Found a variant that at least compiles:

esp32:
  board: esp32-c6-devkitc-1
  variant: esp32c6
  framework:
    type: esp-idf
    version: 5.2.2
    platform_version: https://github.com/stintel/platform-espressif32#develop

Using this however i run into another issue: A fatal error occurred: Contents of segment at SHA256 digest offset 0xb0 are not all zero. Refusing to overwrite.

ss89 commented 4 months ago

Found a variant that at least compiles: ...

Output:

INFO ESPHome 2024.7.0
INFO Reading configuration heizung.yaml...
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 This board is unknown. Make sure the chosen chip component is correct.
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 This board is unknown. Make sure the chosen chip component is correct.
INFO Generating C++ source...
INFO Updating https://github.com/espressif/esp-protocols.git@mdns-v1.2.5
INFO Compiling app...
Processing heizung (board: esp32-c6-devkitc-1; framework: espidf; platform: https://github.com/stintel/platform-espressif32#develop)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HARDWARE: ESP32C6 160MHz, 512KB RAM, 8MB Flash
 - framework-espidf @ 3.50202.0 (5.2.2) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.9.0 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-riscv32-esp @ 13.2.0+20230928
Reading CMake configuration...
Warning! Flash memory size mismatch detected. Expected 8MB, found 2MB!
Please select a proper value in your `sdkconfig.defaults` or via the `menuconfig` target!
Dependency Graph
|-- noise-c @ 0.1.4
RAM:   [=         ]   6.6% (used 34372 bytes from 524288 bytes)
Flash: [==        ]  22.0% (used 863162 bytes from 3932160 bytes)
Building .pioenvs/heizung/firmware.bin
Creating esp32c6 image...

A fatal error occurred: Contents of segment at SHA256 digest offset 0xb0 are not all zero. Refusing to overwrite.
*** [.pioenvs/heizung/firmware.bin] Error 2
======================================================================================= [FAILED] Took 3.16 seconds =======================================================================================
Jason2866 commented 4 months ago

The issue you run now esptool.py wants to update the header info in the firmware. Since it detects a valid hash, it does not do this and stops with the message you see. You probably can solve when you setup sdkconfig correctly with the specs your board has you wanna flash. From the message the flash size is at least wrong.

Using a newer esptool.py will solve this problem too. Newer esptool.py can and do update the SHA when a header update is done. You can try my fork, which has some updates (one is an actual esptool.py ;-))

platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF52
ss89 commented 4 months ago

The issue you run now esptool.py wants to update the header info in the firmware. Since it detects a valid hash, it does not do this and stops with the message you see. You probably can solve when you setup sdkconfig correctly with the specs your board has you wanna flash. From the message the flash size is at least wrong.

Using a newer esptool.py will solve this problem too. Newer esptool.py can and do update the SHA when a header update is done. You can try my fork, which has some updates (one is an actual esptool.py ;-))

platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF52

I did not change any sdk configuration, so it should just work. As you can see in the logs: platform io assumes 8MB of flash. Is it possible that it reports lower values later on due to the partitioning of the flash? In fact i get the same result with your fork. Also i can not see where there is an esphome.py in your fork.

Jason2866 commented 4 months ago

Also i can not see where there is an esphome.py in your fork.

What is this. Such a thing does not exist in any official frameworks

Is it possible that it reports lower values later on due to the partitioning of the flash?

No, only shows a wrong incomplete config.

ss89 commented 4 months ago

What is this. Such a thing does not exist in any official frameworks

You were saying:

You can try my fork, which has some updates (one is an actual esptool.py ;-))

So i assumed that you mean that you have a patched version in your repo.

No, only shows a wrong incomplete config. This config is generated from either esphome or platformio, isn't it? When building esphome, i'm not actively executing something else but esphome compile my-device.yaml. So far (when using the esphome docker container inside HA) this has not been an issue, so i wonder how i could've setup something wrong.

This is what i'm executing to compile my esphome configuration: docker run -it --rm --entrypoint python3 -v $PWD:/work/esphome -w /work/esphome esphome/esphome:2024.7.0 /usr/local/bin/esphome compile my-device.yaml

Jason2866 commented 4 months ago

The fork you used before https://github.com/stintel/platform-espressif32#develop does not have a file esphome.py anywhere too. Don't know where it comes from. Just build a Platformio framework for esp32x MCUs with actual tools (verified working) Don't know what esphome/HA does with.

ss89 commented 4 months ago

i believe some esphome dev should look at this, when they are interested in making the esp32-c6 work.

The toolchain and framework that platform io loads during compile step should always be fine to use.

Maybe it contains a bug or the toolchain vs. platform combination is not supported, the default values however use a platform version that doesn't know the esp32-c6-devkitc-1 board.

I just figured out that using the esp-idf from tasmota seems to work fine:

esphome:
  name: heizung
  friendly_name: Heizung

esp32:
  board: esp32-c6-devkitc-1
  variant: esp32c6
  framework:
    type: esp-idf
    version: 5.1.4
    platform_version: 6.5.0
    source: https://github.com/tasmota/esp-idf/releases/download/v5.1.4.240712/esp-idf-v5.1.4.zip

# Enable logging
logger:
  level: debug

# Enable Home Assistant API
api:
  encryption:
    key: "myApiEncryptionKey"

ota:
  password: "myOtaPassword"
  platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

one_wire:
  - pin: GPIO10
    platform: gpio

sensor:
  - platform: dallas_temp
    address: 0xetcEtcEtc
    name: 'temp'
    accuracy_decimals: 3
Jason2866 commented 4 months ago

So the problem is using IDF 5.2. Both builds are from me. The working one uses IDF 5.1 the not working one uses IDF 5.2 Or you try Tasmota to get a working solution for the C6 :-)

ss89 commented 4 months ago

In fact i did compile it without the sensor and one_wire section (which did work), now adding both section it says the same error like before.

I would like to stick to esphome, but i guess i will have to wait until esphome properly supports the esp32-c6.

g0r3 commented 3 months ago

Having the same problem:

INFO ESPHome 2024.7.2
INFO Reading configuration /config/esphome/shellyplugs.yaml...
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 Updating https://github.com/espressif/esp-protocols.git@mdns-v1.2.5
INFO Compiling app...
Processing test (board: esp32doit-devkit-v1; framework: espidf; platform: platformio/espressif32@6.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.50101.230828 (5.1.1) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.7.1 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-xtensa-esp32 @ 12.2.0+20230208
Reading CMake configuration...
Dependency Graph
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/test/src/esphome/components/wifi/wifi_component.o
Compiling .pioenvs/test/src/esphome/components/wifi/wifi_component_esp8266.o
Compiling .pioenvs/test/src/esphome/components/wifi/wifi_component_esp_idf.o
Compiling .pioenvs/test/src/esphome/components/wifi/wifi_component_libretiny.o
src/esphome/components/wifi/wifi_component.cpp:7:10: fatal error: esp_eap_client.h: No such file or directory

************************************************************************
* Looking for esp_eap_client.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:esp_eap_client.h"
* Web  > https://registry.platformio.org/search?q=header:esp_eap_client.h
*
************************************************************************

    7 | #include <esp_eap_client.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/test/src/esphome/components/wifi/wifi_component.o] Error 1
========================== [FAILED] Took 7.43 seconds ==========================
Marquo1 commented 3 months ago

Having the same issue. Had a working config for a longest time using sintel's branch , but when ran into this when trying to update to latest esphome.

I managed to compile and flash a board using this:

esp32:
  board: esp32-c6-devkitc-1
  flash_size: 8MB
  variant: esp32c6
  framework:
    type: esp-idf
    version: "5.2.1"
    platform_version: 6.6.0
    sdkconfig_options:
      CONFIG_OPENTHREAD_ENABLED: n
      CONFIG_ENABLE_WIFI_STATION: y
      CONFIG_USE_MINIMAL_MDNS: y
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

I'm afraid to deploy it to the target board until I can prove it works with dallas sensors. It feels very hacky. Will you please let me know if it worked for you?

Credit for the config: https://github.com/esphome/feature-requests/issues/2176#issuecomment-2110090466

pan123sel commented 3 months ago

I could compile with the following config on esp32-c6 nano and dev boards (devkitc-1 and devkitm-1 both compiles):

` esp32: board: esp32-c6-devkitc-1 variant: esp32c6
flash_size: 8MB framework: type: esp-idf version: 5.2.2 platform_version: 6.7.0 sdkconfig_options: CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

`

ss89 commented 3 months ago

I could compile with the following config on esp32-c6 nano and dev boards (devkitc-1 and devkitm-1 both compiles):

` esp32: board: esp32-c6-devkitc-1 variant: esp32c6 flash_size: 8MB framework: type: esp-idf version: 5.2.2 platform_version: 6.7.0 sdkconfig_options: CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

`

Confirmed working for me with dallas ds18b20 sensors. Had so set platform_version to 6.5.0 (did not try 6.6.0).

Destroyer061090 commented 3 months ago

Hello,

I buy this device https://www.aliexpress.us/item/3256805917473022.html?spm=a2g0o.order_list.order_list_main.69.6a571802q9k4gj&gatewayAdapt=glo2usa4itemAdapt but when I try to setup it for the first use I have following error? Am I wrong something? if I correctly understoot it should be supported. image

ss89 commented 3 months ago

Hello,

I buy this device https://www.aliexpress.us/item/3256805917473022.html?spm=a2g0o.order_list.order_list_main.69.6a571802q9k4gj&gatewayAdapt=glo2usa4itemAdapt but when I try to setup it for the first use I have following error? Am I wrong something? if I correctly understoot it should be supported. image

You have to write the configuration manually. Try out my example from above with the suggestion of @pan123sel and my answer to him and you should be able to compile it, then upload via web.esphome.io by connecting to your device. The ESPC6 does not seem to be fully supported just yet, which doesn't mean that it doesn't work though.

mx5gr commented 3 months ago

Tried with the following settings: esp32: board: esp32-c6-devkitc-1 variant: ESP32C6 framework: type: esp-idf version: 5.3.0 sdkconfig_options: CONFIG_ESPTOOLPY_FLASHSIZE_4MB: y platform_version: 6.8.1

(I have a Seeedstudio Xiao ESP32C6)

... and got ...

In file included from src/esphome/components/esp32_ble/ble.cpp:6: src/esphome/components/esp32_ble/const_esp32c6.h:62:1: warning: missing initializer for member 'esp_bt_controller_config_t::cca_drop_mode' [-Wmissing-field-initializers] 62 | }; | ^ src/esphome/components/esp32_ble/const_esp32c6.h:62:1: warning: missing initializer for member 'esp_bt_controller_config_t::cca_low_tx_pwr' [-Wmissing-field-initializers] src/esphome/components/esp32_ble/const_esp32c6.h:62:1: warning: missing initializer for member 'esp_bt_controller_config_t::csa2_select' [-Wmissing-field-initializers]

Same occurs with the suggestion of @pan123sel and BLE seems not working after compilation. I have some BT sensors around and the device sends no information (Bluetooth Proxy) to HA..

Destroyer061090 commented 3 months ago

I could compile with the following config on esp32-c6 nano and dev boards (devkitc-1 and devkitm-1 both compiles): esp32: board: esp32-c6-devkitc-1 variant: esp32c6 flash_size: 8MB framework: type: esp-idf version: 5.2.2 platform_version: 6.7.0 sdkconfig_options: CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

Confirmed working for me with dallas ds18b20 sensors. Had so set platform_version to 6.5.0 (did not try 6.6.0).

So using 6.5.0 i have following error during compiling:

INFO ESPHome 2024.7.3
INFO Reading configuration /config/esphome/esp32c6.yaml...
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 This board is unknown. Make sure the chosen chip component is correct.
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 This board is unknown. Make sure the chosen chip component is correct.
INFO Generating C++ source...
INFO Updating https://github.com/espressif/esp-protocols.git@mdns-v1.2.5
INFO Compiling app...
Processing esp32c6 (board: esp32-c6-devkitc-1; framework: espidf; platform: platformio/espressif32@6.5.0)
--------------------------------------------------------------------------------
Platform Manager: Installing platformio/espressif32 @ 6.5.0
INFO Installing platformio/espressif32 @ 6.5.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%          
Platform Manager: espressif32@6.5.0 has been installed!
INFO espressif32@6.5.0 has been installed!
Tool Manager: Installing espressif/toolchain-riscv32-esp @ 12.2.0+20230208
INFO Installing espressif/toolchain-riscv32-esp @ 12.2.0+20230208
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: toolchain-riscv32-esp@12.2.0+20230208 has been installed!
INFO toolchain-riscv32-esp@12.2.0+20230208 has been installed!
HARDWARE: ESP32C6 160MHz, 512KB RAM, 8MB Flash
 - framework-espidf @ 3.50202.0 (5.2.2) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.7.1 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-riscv32-esp @ 12.2.0+20230208
Installing ESP-IDF's Python dependencies
Collecting pyparsing~=3.0.9
  Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.3/98.3 kB 3.0 MB/s eta 0:00:00
Collecting idf-component-manager~=1.2.3
  Downloading idf_component_manager-1.2.3-py3-none-any.whl (116 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.7/116.7 kB 6.2 MB/s eta 0:00:00
Collecting esp-idf-kconfig~=1.2.0
  Downloading esp_idf_kconfig-1.2.0-py3-none-any.whl (22 kB)
Requirement already satisfied: future in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (1.0.0)
Requirement already satisfied: packaging in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (24.1)
Requirement already satisfied: requests<3 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (2.32.3)
Requirement already satisfied: urllib3<2 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (1.26.19)
Requirement already satisfied: requests-file in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (1.5.1)
Requirement already satisfied: requests-toolbelt in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (1.0.0)
Requirement already satisfied: schema in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (0.7.5)
Requirement already satisfied: six in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (1.16.0)
Requirement already satisfied: tqdm<5 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (4.66.4)
Requirement already satisfied: colorama in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (0.4.6)
Requirement already satisfied: pyyaml>5.2 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (6.0.1)
Requirement already satisfied: cachecontrol[filecache]>0.12.6 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (0.14.0)
Requirement already satisfied: contextlib2>0.6.0 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (21.6.0)
Requirement already satisfied: click in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from idf-component-manager~=1.2.3) (8.1.7)
Requirement already satisfied: kconfiglib>=13.7.1 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from esp-idf-kconfig~=1.2.0) (14.1.0)
Requirement already satisfied: msgpack<2.0.0,>=0.5.2 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from cachecontrol[filecache]>0.12.6->idf-component-manager~=1.2.3) (1.0.8)
Requirement already satisfied: filelock>=3.8.0 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from cachecontrol[filecache]>0.12.6->idf-component-manager~=1.2.3) (3.15.4)
Requirement already satisfied: charset-normalizer<4,>=2 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from requests<3->idf-component-manager~=1.2.3) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from requests<3->idf-component-manager~=1.2.3) (3.7)
Requirement already satisfied: certifi>=2017.4.17 in /root/.platformio/penv/.espidf-5.2.2/lib/python3.11/site-packages (from requests<3->idf-component-manager~=1.2.3) (2024.7.4)
Installing collected packages: pyparsing, esp-idf-kconfig, idf-component-manager
  Attempting uninstall: pyparsing
    Found existing installation: pyparsing 3.1.2
    Uninstalling pyparsing-3.1.2:
      Successfully uninstalled pyparsing-3.1.2
  Attempting uninstall: esp-idf-kconfig
    Found existing installation: esp-idf-kconfig 1.4.3
    Uninstalling esp-idf-kconfig-1.4.3:
      Successfully uninstalled esp-idf-kconfig-1.4.3
  Attempting uninstall: idf-component-manager
    Found existing installation: idf-component-manager 1.5.3
    Uninstalling idf-component-manager-1.5.3:
      Successfully uninstalled idf-component-manager-1.5.3
Successfully installed esp-idf-kconfig-1.2.0 idf-component-manager-1.2.3 pyparsing-3.0.9
Reading CMake configuration...
-- Found Git: /usr/bin/git (found version "2.39.2") 
-- git rev-parse returned 'fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).'
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /data/cache/platformio/packages/toolchain-riscv32-esp@12.2.0+20230208/bin/riscv32-esp-elf-gcc
-- Check for working C compiler: /data/cache/platformio/packages/toolchain-riscv32-esp@12.2.0+20230208/bin/riscv32-esp-elf-gcc
-- Check for working C compiler: /data/cache/platformio/packages/toolchain-riscv32-esp@12.2.0+20230208/bin/riscv32-esp-elf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /data/cache/platformio/packages/toolchain-riscv32-esp@12.2.0+20230208/bin/riscv32-esp-elf-g++
-- Check for working CXX compiler: /data/cache/platformio/packages/toolchain-riscv32-esp@12.2.0+20230208/bin/riscv32-esp-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32c6
Solving dependencies requirements
.Updating lock file at /data/build/esp32c6/dependencies.lock
Processing 1 dependencies:
[1/1] idf (5.2.2)
-- Project sdkconfig file /data/build/esp32c6/sdkconfig.esp32c6
-- Configuring incomplete, errors occurred!
See also "/data/build/esp32c6/.pioenvs/esp32c6/CMakeFiles/CMakeOutput.log".

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Error at /data/cache/platformio/packages/framework-espidf/tools/cmake/tool_version_check.cmake:36 (message):

  Tool doesn't match supported version from list ['esp-13.2.0_20230928']:
  /data/cache/platformio/packages/toolchain-riscv32-esp@12.2.0+20230208/bin/riscv32-esp-elf-gcc

  Please try to run 'idf.py fullclean' to solve it.

Call Stack (most recent call first):
  /data/cache/platformio/packages/framework-espidf/components/esp_common/project_include.cmake:10 (check_expected_tool_version)
  /data/cache/platformio/packages/framework-espidf/tools/cmake/build.cmake:400 (include)
  /data/cache/platformio/packages/framework-espidf/tools/cmake/build.cmake:624 (__build_process_project_includes)
  /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:605 (idf_build_process)
  CMakeLists.txt:3 (project)

========================= [FAILED] Took 121.74 seconds =========================

using 6.7.0 i'm able to compiling and flash it but it seems it doesnt work properly

INFO ESPHome 2024.7.3
INFO Reading configuration /config/esphome/esp32c6.yaml...
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 This board is unknown. Make sure the chosen chip component is correct.
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 This board is unknown. Make sure the chosen chip component is correct.
INFO Starting log output from esp32c6.local using esphome API
WARNING Can't connect to ESPHome API for esp32c6.local: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)
INFO Trying to connect to esp32c6.local in the background
ss89 commented 3 months ago

This config works for me with esphome 2024.07.x, feel free to take it as a base and move on from there:

esphome:
  name: abc
  friendly_name: ABC

esp32:
  board: esp32-c6-devkitc-1
  variant: esp32c6
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y
    version: 5.1.2
    platform_version: 6.5.0
    source: https://github.com/tasmota/esp-idf/releases/download/v5.1.2.240221/esp-idf-v5.1.2.zip

# Enable logging
logger:
  level: none

# Enable Home Assistant API
api:
  encryption:
    key: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="

ota:
  password: "abc"
  platform: esphome

wifi:
  ssid: test
  password: test12345

one_wire:
  - pin: GPIO10
    platform: gpio

sensor:
  - platform: dallas_temp
    address: 0xabc
    name: 'abc'
    accuracy_decimals: 3
Destroyer061090 commented 3 months ago

This config works for me with esphome 2024.07.x, feel free to take it as a base and move on from there:

esphome:
  name: abc
  friendly_name: ABC

esp32:
  board: esp32-c6-devkitc-1
  variant: esp32c6
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y
    version: 5.1.2
    platform_version: 6.5.0
    source: https://github.com/tasmota/esp-idf/releases/download/v5.1.2.240221/esp-idf-v5.1.2.zip

# Enable logging
logger:
  level: none

# Enable Home Assistant API
api:
  encryption:
    key: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="

ota:
  password: "abc"
  platform: esphome

wifi:
  ssid: test
  password: test12345

one_wire:
  - pin: GPIO10
    platform: gpio

sensor:
  - platform: dallas_temp
    address: 0xabc
    name: 'abc'
    accuracy_decimals: 3

With this setup it seems working and now online 😄 Thankyou image

fhteagle commented 3 months ago

I did some playing around, found this newer combination to be working for my admittedly limited use cases so far. Esphome still blocks compilation if any ADC entries are specified. Using on multiple Teyleten Robot ESP32-C6-DevKitC-1 version boards.

esp32:
  board: esp32-c6-devkitc-1
  flash_size: 8MB
  variant: esp32c6
  framework:
    type: esp-idf
    version: "5.3.0"
    platform_version: 6.8.1
    sdkconfig_options:
      CONFIG_OPENTHREAD_ENABLED: n
      CONFIG_ENABLE_WIFI_STATION: y
      CONFIG_USE_MINIMAL_MDNS: y
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y
ss89 commented 2 months ago

I did some playing around, found this newer combination to be working for my admittedly limited use cases so far. Esphome still blocks compilation if any ADC entries are specified. Using on multiple Teyleten Robot ESP32-C6-DevKitC-1 version boards.

esp32:
  board: esp32-c6-devkitc-1
  flash_size: 8MB
  variant: esp32c6
  framework:
    type: esp-idf
    version: "5.3.0"
    platform_version: 6.8.1
    sdkconfig_options:
      CONFIG_OPENTHREAD_ENABLED: n
      CONFIG_ENABLE_WIFI_STATION: y
      CONFIG_USE_MINIMAL_MDNS: y
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

It does seem to work for me without these:

So here's my minimal working configuration for 2024.8.x which includes a sensor:

esphome:
  name: abc
  friendly_name: ABC

esp32:
  board: esp32-c6-devkitc-1
  flash_size: 8MB
  variant: esp32c6
  framework:
    type: esp-idf
    version: "5.3.0"
    platform_version: 6.8.1
    sdkconfig_options:
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

# Enable logging
logger:
  level: none

# Enable Home Assistant API
api:
  encryption:
    key: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="

ota:
  password: "abc"
  platform: esphome

wifi:
  ssid: test
  password: test12345

one_wire:
  - pin: GPIO10
    platform: gpio

sensor:
  - platform: dallas_temp
    address: 0xabc
    name: 'abc'
    accuracy_decimals: 3
Luis-Sarabando commented 1 month ago

I have gotten it to work with a few more pieces of it, including wifi signal monitor, Sensor button, Blue LED toggle. Update: added ADC sensor.

The only thing not working is the M5NanoC6 RGB LED which is GPIO20, if someone gets it working lt me know


esphome:
  name: water_level
  friendly_name: Water_level

esp32:
  board: esp32-c6-devkitc-1
  flash_size: 8MB
  variant: esp32c6
  framework:
    type: esp-idf
#Can be dev, latest, recommended, or check https://github.com/espressif/esp-idf/releases
    version: "5.3.1"
#check platform_version @ https://github.com/platformio/platform-espressif32/releases/
    platform_version: 6.9.0
    sdkconfig_options:
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

#This is to make sure adc compiles or else it will throw an error
external_components:
  - source:
      # https://github.com/lboue/esphome/blob/adc_oneshot/esphome/components/adc
      type: git
      url: https://github.com/lboue/esphome
      ref: adc_oneshot
    components: [ adc ]
    refresh: 0s

# Enable logging
logger:
  level: none

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxx"

ota:
  password: "abc"
  platform: esphome

wifi:
  ssid: TP-LINK
  password: xxx
  manual_ip:
    static_ip: 192.168.10.76  # Replace with your desired IP
    gateway: 192.168.10.254      # Replace with your router's IP
    subnet: 255.255.255.0

# Built-in button on GPIO9
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO9
      mode: INPUT_PULLUP
      inverted: true
    name: "M5NanoC6 Button"
    filters:
      - delayed_on: 10ms
      - delayed_off: 10ms

# RGB LED on GPIO7
output:
  - platform: ledc
    pin: GPIO7
    id: led_output

light:
  - platform: monochromatic
    output: led_output
    name: "M5NanoC6 Blue LED"
# RGB LED (WS2812) on GPIO20
  - platform: esp32_rmt_led_strip
    pin: GPIO20
    num_leds: 1
    rmt_channel: 0
    chipset: WS2812
    rgb_order: GRB
    name: "M5NanoC6 RGB LED"
    effects:
      - random:
      - strobe:
      - flicker:
    on_turn_on:
      then:
        - switch.turn_on: rgb_power
    on_turn_off:
      then:
        - switch.turn_off: rgb_power

# Grove connector pins (G1 and G2)
# G1 = GPIO1, G2 = GPIO2
# These can be used for various purposes, so we'll set them up as switches
# that you can later modify based on your specific use case
switch:
# RGB LED power control
  - platform: gpio
    pin: GPIO19
    name: "RGB LED Power"
    id: rgb_power
  - platform: gpio
    name: "Grove G1"
    pin: GPIO1
  - platform: gpio
    name: "Grove G2"
    pin: GPIO2

# Wi-Fi signal strength sensor
sensor:
  - platform: wifi_signal
    name: "M5NanoC6 WiFi Signal"
    update_interval: 60s
  - platform: uptime
    name: "M5NanoC6 Uptime"
  - platform: adc
    pin: GPIO5
    name: "Water Level Raw"
    id: water_level_raw
    update_interval: 2s
    filters:
      - multiply: 3.3  # Convert to voltage
      - sliding_window_moving_average:
          window_size: 30
          send_every: 30
    unit_of_measurement: "V"
    accuracy_decimals: 3

# IR transmitter on GPIO3
remote_transmitter:
  pin: GPIO3
  carrier_duty_percent: 50%

# Enable Web Server for easy debugging (optional)
web_server:
  port: 80

# Enable captive portal for initial setup (optional)
captive_portal:
ss89 commented 1 month ago

Here's my minimal working config for 2024.9.x:

esphome:
  name: abc
  friendly_name: ABC

esp32:
  board: esp32-c6-devkitc-1
  flash_size: 8MB
  variant: esp32c6
  framework:
    type: esp-idf
    version: "5.3.1"
    platform_version: 6.9.0
    sdkconfig_options:
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y

# Enable logging
logger:
  level: none

# Enable Home Assistant API
api:
  encryption:
    key: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="

ota:
  password: "abc"
  platform: esphome

wifi:
  ssid: test
  password: test12345

one_wire:
  - pin: GPIO10
    platform: gpio

sensor:
  - platform: dallas_temp
    address: 0xabc
    name: 'abc'
    accuracy_decimals: 3
ss89 commented 1 month ago

Here's my minimal working config for 2024.10.x:

esphome:
  name: abc
  friendly_name: ABC

esp32:
  board: esp32-c6-devkitc-1
  flash_size: 8MB
  variant: esp32c6
  framework:
    type: esp-idf
    version: "5.3.1"
    platform_version: 6.9.0

# Enable logging
logger:
  level: none

# Enable Home Assistant API
api:
  encryption:
    key: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="

ota:
  password: "abc"
  platform: esphome

wifi:
  ssid: test
  password: test12345

one_wire:
  - pin: GPIO10
    platform: gpio

sensor:
  - platform: dallas_temp
    address: 0xabc
    name: 'abc'
    accuracy_decimals: 3
elektrinis commented 1 month ago

I am trying to do BLE proxy. Everything compiles fine, until I add:

bluetooth_proxy:
  active: true

Then I get compile error:

In file included from src/esphome/components/esp32_ble/ble.cpp:6:
src/esphome/components/esp32_ble/const_esp32c6.h:62:1: error: 'const esp_bt_controller_config_t' has no non-static data member named 'enable_uart_hci'
   62 | };
      | ^

Any ideas? Is BLE not supported yet?

ss89 commented 1 month ago

@elektrinis It seems someone posted a fix for this: https://github.com/esphome/esphome/commit/c9e59197396c05bc7cc12740adf151a28997f527

It's going to be in the next release, until then you might have to wait or compile the dev version of esphome.

rvalitov commented 1 month ago

ESP32-C6 now compiles well in ESPHome dev branch. There are still issues with some components, like I2C and there are related issues about that. For some of them there are lifehacks, for others - a PR is needed.

ETE-Design commented 1 month ago

ESP32-C6 now compiles well in ESPHome dev branch. There are still issues with some components, like I2C and there are related issues about that. For some of them there are lifehacks, for others - a PR is needed.

@rvalitov So now ESPHome Official support ESP32-C6 without any modifications?

rvalitov commented 1 month ago

Of course not "officially". And I'm not an official representative here to give you such guarantees. ESPHome even did not switch to ESP-IDF 5.0 officially. If you need official status for ESP32-C6, then you need to wait a couple of years when ESPHome will fully support ESP-IDF 5.1. But 5.1 has only initial support for ESP32-C6, probably you will want to have a newer version. image

Anyway, what I want to say, that me and many other people do use ESPHome with ESP32-C6, unofficially, but it works.

BafS commented 2 weeks ago

It took me quite some time but if it can help anyone, here is a working solution with ESP32-C6-Zero from Waveshare with working built-in RGB LED and button

# ESP32-C6-Zero

esphome:
  name: foo
  friendly_name: Foo

esp32:
  board: esp32-c6-devkitc-1
  # flash_size: 4MB
  variant: esp32c6
  framework:
    type: esp-idf
    version: "5.3.1"
    platform_version: 6.9.0

logger:
  level: none

wifi:
  ssid: SSID
  password: PASS

# Built-in button on GPIO9
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO9
      mode: INPUT_PULLUP
      inverted: true
    name: "Built-in Button"
    filters:
      - delayed_on: 10ms
      - delayed_off: 10ms

switch:
  - platform: gpio
    id: onboard_led
    pin:
      number: GPIO2
      mode: OUTPUT
    restore_mode: ALWAYS_OFF

light:
  - platform: esp32_rmt_led_strip # https://esphome.io/components/light/esp32_rmt_led_strip
    pin: GPIO8
    num_leds: 1
    rmt_channel: 0
    chipset: WS2812
    rgb_order: RGB
    name: "Built-in RGB LED"
    effects:
      - random:
      - strobe:
      - flicker:
      - strobe:
          name: Quick strobe
          colors:
            - brightness: 100%
              red: 100%
              green: 0%
              blue: 0%
              duration: 50ms
            - state: false
              duration: 50ms

# Enable Web Server for easy debugging (optional)
web_server:
  port: 80

done

meeowgler commented 3 days ago

While this works, the debug component seems to indicate that it's only using 1 core. Anyone else encountering this?

debug: update_interval: 5s

text_sensor:

logger: level: debug

rvalitov commented 3 days ago

ESP32-C6 has 1 core only.