I just updated the project and rebuilt with v5.3.1, there were a few config changes, but nothing major, built and joined the network without issue.
Sorry hopefully my last question, I’m used to using Arduino IDE. Declaring in this file should use the same syntax ?
-
pinMode(GPIO, OUTPUT)
(placed at the top of the file) -
digitalWrite(GPIO, switch_state)
(placed at //GPIO logic here)
This should help esp-idf/examples/peripherals/gpio/generic_gpio/main/gpio_example_main.c at 0f0068fff3ab159f082133aadfa9baf4fc0c7b8d · espressif/esp-idf · GitHub
hello PrairieSnpr,
I compiled your code and I want to integrate the esp32C6 in my HA. Normally, to enter in a Zigbee network , you must push a button for pairing with the HA . In your code , I can’t see some led blinking on the device to enter in this mode. I am missing something?
It should immediately try to pair, just put the mesh in join mode and then power the board. You can watch the serial debug output via a pc if you still have issues, it should indicate it’s pairing status.
Yes I made this. Here my logs:;
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0x1c (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0x16b8
load:0x4086c110,len:0xe84
load:0x4086e610,len:0x304c
entry 0x4086c11a
I (23) boot: ESP-IDF v5.4-dirty 2nd stage bootloader
I (24) boot: compile time Jan 22 2025 09:48:17
I (24) boot: chip revision: v0.1
I (24) boot: efuse block revision: v0.2
I (28) boot.esp32c6: SPI Speed : 80MHz
I (31) boot.esp32c6: SPI Mode : DIO
I (35) boot.esp32c6: SPI Flash Size : 2MB
I (39) boot: Enabling RNG early entropy source…
I (43) boot: Partition Table:
I (46) boot: ## Label Usage Type ST Offset Length
I (52) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (59) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (65) boot: 2 factory factory app 00 00 00010000 000a2000
I (72) boot: 3 zb_storage Unknown data 01 81 000b3000 00004000
I (78) boot: 4 zb_fct Unknown data 01 81 000b7000 00000400
I (85) boot: End of partition table
I (88) esp_image: segment 0: paddr=00010020 vaddr=42058020 size=0d7e4h ( 55268) map
I (106) esp_image: segment 1: paddr=0001d80c vaddr=40800000 size=0280ch ( 10252) load
I (109) esp_image: segment 2: paddr=00020020 vaddr=42000020 size=53668h (341608) map
I (173) esp_image: segment 3: paddr=00073690 vaddr=4080280c size=0b77ch ( 46972) load
I (184) esp_image: segment 4: paddr=0007ee14 vaddr=4080df90 size=02090h ( 8336) load
I (190) boot: Loaded app from partition at offset 0x10000
I (190) boot: Disabling RNG early entropy source…
I (202) cpu_start: Unicore app
I (210) cpu_start: Pro cpu start user code
I (211) cpu_start: cpu freq: 160000000 Hz
I (211) app_init: Application information:
I (211) app_init: Project name: on_off_light_bulb
I (215) app_init: App version: 1
I (219) app_init: Compile time: Jan 22 2025 09:46:54
I (224) app_init: ELF file SHA256: 0d6ea878d…
I (228) app_init: ESP-IDF: v5.4-dirty
I (232) efuse_init: Min chip rev: v0.0
I (236) efuse_init: Max chip rev: v0.99
I (240) efuse_init: Chip rev: v0.1
I (244) heap_init: Initializing. RAM available for dynamic allocation:
I (250) heap_init: At 40814240 len 000683D0 (416 KiB): RAM
I (255) heap_init: At 4087C610 len 00002F54 (11 KiB): RAM
I (260) heap_init: At 50000000 len 00003FE8 (15 KiB): RTCRAM
I (267) spi_flash: detected chip: generic
I (270) spi_flash: flash io: dio
W (272) spi_flash: Detected size(16384k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (285) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (291) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (298) coexist: coex firmware version: 49a8cdc
I (316) coexist: coexist rom version 5b8dcfa
I (316) main_task: Started on CPU0
I (316) main_task: Calling app_main()
I (316) phy_init: phy_version 320,348a293,Sep 3 2024,16:33:12
I (396) phy: libbtbb version: 04952fd, Sep 3 2024, 16:33:30
I (396) main_task: Returned from app_main()
I (406) DEMO: ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
I (406) DEMO: Zigbee stack initialized
I (406) DEMO: Start network steering
I (2656) DEMO: Network steering was not successful (status: ESP_FAIL)
I (5906) DEMO: Network steering was not successful (status: ESP_FAIL)
I (9156) DEMO: Network steering was not successful (status: ESP_FAIL)
I (12406) DEMO: Network steering was not successful (status: ESP_FAIL)
It’s been awhile since I looked at logs from one, but that looks right, it’s just not found a network and paired yet.
all my others sensors ( china) has been paired with by presing by 5 secs on a button. You said that the sensor should enter in the pairing mode after reset and find itself the network ( network must be open for pairing) ?
I try to recompile all : now I have another pb
I (294) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (300) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (307) coexist: coex firmware version: 49a8cdc
I (325) coexist: coexist rom version 5b8dcfa
I (326) main_task: Started on CPU0
I (326) main_task: Calling app_main()
I (326) phy_init: phy_version 320,348a293,Sep 3 2024,16:33:12
I (396) phy: libbtbb version: 04952fd, Sep 3 2024, 16:33:30
E (406) ESP_ZIGBEE_CORE: Unknown device type!
I (416) main_task: Returned from app_main()
I (426) ESP_ZB_TEMP_SENSOR: ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
I (426) ESP_ZB_TEMP_SENSOR: Initialize Zigbee stack
Zigbee stack assertion failed zdo/zdo_commissioning.c:104
abort() was called at PC 0x4201d311 on core 0
— 0x4201d311: zb_assert at ??:?
Core 0 register dump:
MEPC : 0x40800962 RA : 0x40809e32 SP : 0x4081bcd0 GP : 0x40810c54
— 0x40800962: panic_abort at D::/EsE.pressif/frameworks/esp-idf-v5.4/components/esp_system/panic.c:468
0x40809e32: __ubsan_include at D:/Espressif/frameworks/esp-idf-v5.4/components/esp_system/ubsan.c:311
TP : 0x4081beb0 T0 : 0x37363534 T1 : 0x7271706f T2 : 0x33323130
S0/FP : 0x00000004 S1 : 0x4081bd34 A0 : 0x4081bcfc A1 : 0x4081bd32
A2 : 0x00000000 A3 : 0x4081bd29 A4 : 0x00000001 A5 : 0x40817000
A6 : 0x00000000 A7 : 0x76757473 S2 : 0x0000000f S3 : 0x000000ff
S4 : 0x7fffffff S5 : 0x42036238 S6 : 0x00000000 S7 : 0x00000000
— 0x42036238: zb_nwk_load_pib_confirm at ??:?
S8 : 0x00000028 S9 : 0x00000000 S10 : 0x00000019 S11 : 0x00000007
T3 : 0x6e6d6c6b T4 : 0x6a696867 T5 : 0x66656463 T6 : 0x62613938
MSTATUS : 0x00001881 MTVEC : 0x40800001 MCAUSE : 0x00000002 MTVAL : 0x00000000
— 0x40800001: _vector_table at D:/Espressif/frameworks/esp-idf-v5.4/components/riscv/vectors_intc.S:54
MHARTID : 0x00000000
Which repo are you building? I changed the temperature one so that you could build it in a codespace, if I get time I’ll do it for the test bench.
I downloaded your esp_zha_freezer_mon-master with an esp32c6 vroom…and I use esp-idf 5.4…thanks
Try bringing your ESP close to the Zigbee stick with which you are trying to pair, I had a similar issue and this was the solution. Connecting external antenna also helped but not reliable still.
you are right . the ESP32 c6 Vroom has very poor connectivity with the internal antenna,…
Interesting, I hadn’t really tested or noticed an issue. I did have issues when they were configured as routers so moved then to end points.
ok thanks for replying.
And what do you think about the problem ( see logs ) with the runtime issue dated the 22th?
Not something I’ve seen before, if the code is the same, I’d check the partion tables and ensure you are using the same ESP config.
Hi @PrairieSnpr
I’m looking to use ESP32-H2 as 4 gang switches.
The ideal solution, for me, would be to have them as router and not as endpoint.
They will be around the house, powered by 5V running in the walls and would be ideal (I think) to create a nice mesh zigbee network.
Would your code be difficult to adapt to fit that needs ?
I must confess that I’m an IT guy, but an infra IT guy.
Installing an IDE, importing some code, compiling and uploading it is OK for me but I’m not smart enough to update the code you wrote.
Thanks a lot for your input !
PS : We could arrange some kind of compensation for your time, if you are interested in such an agreement. I get that you put some time and effort in your development and it would be normal to gain something out of it.
You just want a 4 switch esp32-h2 configured as a router? What GPIOs do you want the outputs to be set to?
Yes, this is exactly the goal !
The GPIO id doesn’t really matter to me, I can adapt the hardware to the software if needed
I would say 1 to 4 but it can be different.
I have ESP32-H2 SuperMini boards and I plan to make some secondary PCB with screw connectors for the momentary input button and power supply.
The ultimate goal (but I really do not know if this would be possible) would be able to have some “double tap” and “long press” command. That is categorized as “dream feature” for the time being
To add some context…
I have an old analog “smart lightning” system. It is a bus running from switch to switch and going to some kind of relay. The switch are push buttons, connected to some PCB board with dip switch to assign an id to the switch. The relay recognized the switch ID and activate or disactivate the corresponding relay.
This this is 20 years old and start to have its own free will and will not always recognize the correct ID. It start to annoy me very much !
The goal is to get rid of all that except for the bus wire and the push buttons. I will use the bus wire to send 5v to some ESP32-H2 and the push buttons to send the analog input to the ESP32-H2. At the other end, some zigbee relays and Home Assistant in between.
My initial test are OK, except for the ESP32-H2 part that I do not manage at all…
This should get you going, just basic interrupt based push buttons for now, would need to add the long press and double tap logic.
prairiesnpr/esp_zha_quad_switch
Built and tested on a ESP32-H2
Man, I love you !!
I have to uninstall and reset Visual Studio Code (too much trial and error, too much messing around) and I will test all that right now !!
You have no idea how this is magical to me !
How can I express my gratitude ?