Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zigbee_Temp_Hum_Sensor_Sleepy.ino : Temperature and Humidity value not correct reported in Home Assistant #10601

Closed
1 task done
phiphi060 opened this issue Nov 13, 2024 · 112 comments
Assignees
Labels
Area: Libraries Issue is related to Library support. Area: Zigbee Issues and Feature Request about Zigbee Status: In Progress ⚠️ Issue is in progress Status: Test needed Issue needs testing

Comments

@phiphi060
Copy link

Board

ESP32H2 Dev Module

Device Description

Only the Chip module

Hardware Configuration

No external connections

Version

latest master (checkout manually)

IDE Name

Arduino

Operating System

Windows 11

Flash frequency

921600

PSRAM enabled

yes

Upload speed

115200

Description

The Temperature value is ever reported in Home Assistant with -327.7 °C
The Humidity value is ever reported in Home Assistant with 655.4 %

I have test to give fixed temperature and humidity value but the reported values in Home Assistant stay the sames

Sketch

Original example sketch "Zigbee_Temp_Hum_Sensor_Sleepy.ino" without modification

Debug Message

no errors by Flashing

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@phiphi060 phiphi060 added the Status: Awaiting triage Issue is waiting for triage label Nov 13, 2024
@me-no-dev
Copy link
Member

@P-R-O-C-H-Y both number represent float from 16bit 0xFFFF divided by 100. One signed and one unsigned.

@P-R-O-C-H-Y P-R-O-C-H-Y added the Area: Libraries Issue is related to Library support. label Nov 14, 2024
@P-R-O-C-H-Y
Copy link
Member

P-R-O-C-H-Y commented Nov 14, 2024

Hi @phiphi060, those values are default. So it. looks you never send the updated values.
I did now retest the example with HomeAssistant and its working for me.
Screenshot 2024-11-14 at 8 47 36

Can you please set debug level to "Verbose" and paste log from the device?
Also more info would be nice, like what gateway are you using for HA.
Thanks

@P-R-O-C-H-Y P-R-O-C-H-Y added Resolution: More info needed More info must be provided in this issue and removed Status: Awaiting triage Issue is waiting for triage Resolution: More info needed More info must be provided in this issue labels Nov 14, 2024
@phiphi060
Copy link
Author

Hey Prochy,
Thank you for your help and your detailled answer.
I'm a beginner with zigbee under Arduino. I'm set the Core Debug Level to Verbose but i don't no where can i see the log file.
In Serial Monitor is Nothing (only Chip Model : ESP-ROM:esp32h2-20221101)
In Output : i send you 2 files, one by compilation and one by flashing
Zigbee_Temp_Hum_Sensor_Sleepy_compile.txt
Zigbee_Temp_Hum_Sensor_Sleepy_flash.txt
... and an image File from my Home Assistant
Capture_Home_Assistant

My Home Assistant run as Stand-Alone HA OS on a Raspberry Pi5 8GB with SSD
My Zigbee Gateway is the Home Assistant Sky Connect and all my Zigbee Devices are connected under ZHA (Zigbee 3.0)

How i have say in my precedent message, i have test to set the temperature value at 22°C directly in Sketch but without success
The temperature and humidity values are not reported to Home Assistant and stay to default values (-327.7 °C and 655.4 %)

The exemple Sketch "Zigbee_Temperature_Sensor" from Library august 2024 run perfectly but this sketch has no humidity Sensor !

@phiphi060
Copy link
Author

When i set the battery level to 80 % this is correct reported in Home Assistant :)

@P-R-O-C-H-Y
Copy link
Member

P-R-O-C-H-Y commented Nov 15, 2024

Are you using the UART port or the USB port of the ESP32-H2? Will help you to get the logs.

So re are running different gateways, so maybe there will be a change needed in the delay, that's the only thing I can think of.
What you can try first is to comment out the line 62: esp_deep_sleep_start(); and replace it with delay(5000). We can ensure that the problem is with the sleep this way.

Also if you don't need the sleepy device, you can easily add the humidity sensor to the exemple Sketch "Zigbee_Temperature_Sensor", just copy the related lines to the Humidity sensor from this example to the old one :)

@michapr
Copy link

michapr commented Nov 15, 2024

Hi,
I have/had same issue with ESP32C6. Using Zigbee2MQTT.

First problem - controller may remember about old configuration, if other sketch was loaded before (like RGB lamp etc.) So controller must be restarted after removing the device.

Second - something looks not right while join process.
In most cases (could not find out when) the join will fail:

[2024-11-15 13:53:17] debug:    zh:ember:ezsp: ezspTrustCenterJoinHandler(): callback called with: [newNodeId=9507], [newNodeEui64=0x543204fffe32f364], [status=STANDARD_SECURITY_SECURED_REJOIN], [policyDecision=NO_ACTION], [parentOfNewNodeId=55811]
[2024-11-15 13:53:17] debug:    zh:controller: Device '0x543204fffe32f364' joined
[2024-11-15 13:53:17] debug:    zh:controller: Device '0x543204fffe32f364' accepted by handler
[2024-11-15 13:53:17] debug:    zh:controller: New device '0x543204fffe32f364' joined
[2024-11-15 13:53:17] debug:    zh:controller: Creating device '0x543204fffe32f364'
[2024-11-15 13:53:17] info:     zh:controller: Interview for '0x543204fffe32f364' started
[2024-11-15 13:53:17] debug:    zh:controller:device: Interview - start device '0x543204fffe32f364'
[2024-11-15 13:53:17] info:     z2m: Device '0x543204fffe32f364' joined
[2024-11-15 13:53:17] info:     z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x543204fffe32f364","ieee_address":"0x543204fffe32f364"},"type":"device_joined"}'
[2024-11-15 13:53:17] info:     z2m: Starting interview of '0x543204fffe32f364'
[2024-11-15 13:53:17] info:     z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x543204fffe32f364","ieee_address":"0x543204fffe32f364","status":"started"},"type":"device_interview"}'
[2024-11-15 13:53:22] debug:    zh:controller:device: Interview - node descriptor request failed for '0x543204fffe32f364', attempt 1
[2024-11-15 13:53:24] debug:    zh:ember:ezsp: ezspTrustCenterJoinHandler(): callback called with: [newNodeId=9507], [newNodeEui64=0x543204fffe32f364], [status=STANDARD_SECURITY_SECURED_REJOIN], [policyDecision=NO_ACTION], [parentOfNewNodeId=55811]
[2024-11-15 13:53:24] debug:    zh:controller: Device '0x543204fffe32f364' joined
[2024-11-15 13:53:24] debug:    zh:controller: Device '0x543204fffe32f364' accepted by handler
[2024-11-15 13:53:24] debug:    zh:controller: Not interviewing '0x543204fffe32f364', completed 'false', in progress 'true'
[2024-11-15 13:53:27] debug:    zh:controller:device: Interview - node descriptor request failed for '0x543204fffe32f364', attempt 2
[2024-11-15 13:53:32] debug:    zh:controller:device: Interview - node descriptor request failed for '0x543204fffe32f364', attempt 3
[2024-11-15 13:53:36] debug:    zh:controller:device: Interview - node descriptor request failed for '0x543204fffe32f364', attempt 4
[2024-11-15 13:53:42] debug:    zh:controller:device: Interview - node descriptor request failed for '0x543204fffe32f364', attempt 5
[2024-11-15 13:53:42] debug:    zh:ember:ezsp: ezspTrustCenterJoinHandler(): callback called with: [newNodeId=9507], [newNodeEui64=0x543204fffe32f364], [status=STANDARD_SECURITY_SECURED_REJOIN], [policyDecision=NO_ACTION], [parentOfNewNodeId=55811]

I have seen cases, where the manufacturer and device type were shown, but no values were reported.

Have replaced the sleep with delay(10000), but in this case the setup() procedure will not be executed more.
Anyway the ESP will reboot now (about 2500ms after zbTempSensor.reportHumidity(); - but is not reporting...

So - something maybe wrong....

BTW: the sample "Zigbee_Color_Dimmable_Light" is working (more or less, can switch colors, brightness, on/off, but cannot set the startup value as sample - but this is an other problem)

@phiphi060
Copy link
Author

phiphi060 commented Nov 15, 2024

Hi Prochy,
I have comment out the line 62: esp_deep_sleep_start(); and replace it with delay(5000) --> The temperature and humidity are correct reported :)
I have tested with smaller delay value (step by step) and i have see that with value >= 550 the temperature and humidity values are correct reported in Home Assistant. With a delay from 500, they are not reported !
For the test, i have set the battery value to 80 %
Thank you for your Help
SleepyZigbeeTempSensorTest_Home_Assistant

@michapr
Copy link

michapr commented Nov 15, 2024

@P-R-O-C-H-Y
If I add hum/batt to the temperature sensor example code, it will work fine.
Reporting is working, request values also...
BUT: an other problem - if remove power - device is rebooting and will not report more any value (temp sketch).

[2024-11-15 18:32:54] debug:    zh:controller: Device '0x543204fffe32f364' joined
[2024-11-15 18:32:54] debug:    zh:controller: Device '0x543204fffe32f364' accepted by handler
[2024-11-15 18:32:54] debug:    zh:controller: Not interviewing '0x543204fffe32f364', completed 'true', in progress 'false'
[2024-11-15 18:33:12] debug:    zh:ember:ezsp: ezspTrustCenterJoinHandler(): callback called with: [newNodeId=15335], [newNodeEui64=0x543204fffe32f364], [status=STANDARD_SECURITY_SECURED_REJOIN], [policyDecision=NO_ACTION], [parentOfNewNodeId=55811]
[2024-11-15 18:33:12] debug:    zh:controller: Device '0x543204fffe32f364' joined
[2024-11-15 18:33:12] debug:    zh:controller: Device '0x543204fffe32f364' accepted by handler
[2024-11-15 18:33:12] debug:    zh:controller: Not interviewing '0x543204fffe32f364', completed 'true', in progress 'false'
[2024-11-15 18:33:21] debug:    zh:ember:ezsp: ezspTrustCenterJoinHandler(): callback called with: [newNodeId=15335], [newNodeEui64=0x543204fffe32f364], [status=STANDARD_SECURITY_SECURED_REJOIN], [policyDecision=NO_ACTION], [parentOfNewNodeId=55811]

For me it looks like that a "session" like parameter is lost after power down/reboot - so that gateway cannot recognize the already known device.

if it help - this I see in console, while device is rebooting every x seconds now (only after power off/on):

Zigbee stack assertion failed common/zb_error_indication.c:81

abort() was called at PC 0x4200fbe1 on core 0
Core  0 register dump:
MEPC    : 0x40801e4c  RA      : 0x40807ad4  SP      : 0x40821140  GP      : 0x4080ec60
TP      : 0x408108a8  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130
S0/FP   : 0x4082116c  S1      : 0x4082116c  A0      : 0x40821178  A1      : 0x4082115a
A2      : 0x00000000  A3      : 0x408211a5  A4      : 0x00000001  A5      : 0x40815000
A6      : 0x00000000  A7      : 0x76757473  S2      : 0x00000000  S3      : 0x40812490
S4      : 0x00000002  S5      : 0x00000000  S6      : 0x00000000  S7      : 0x00000000
S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000
T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938
MSTATUS : 0x00001881  MTVEC   : 0x40800001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000
MHARTID : 0x00000000

Stack memory:
40821140: 0x00000000 0x00000000 0x4082116c 0x4080d3f2 0x00000000 0x00000000 0x00000030 0x4080fa7c
40821160: 0x4082116c 0x4080fa98 0x40821158 0x30303234 0x31656266 0x00000000 0x726f6261 0x20292874
40821180: 0x20736177 0x6c6c6163 0x61206465 0x43502074 0x34783020 0x66303032 0x20316562 0x63206e6f
408211a0: 0x2065726f 0x00000030 0x00000000 0xdfcc3154 0x0000002f 0x40812880 0x420637f5 0x4200fbe4
408211c0: 0x0000ba3d 0x00000000 0x00000000 0x00000051 0x00000000 0x00000000 0x000000fe 0x4203490a
408211e0: 0x00000000 0x40812880 0x40821240 0x42010f5c 0x408108a8 0x00000000 0x000007d0 0x0001001f
40821200: 0x00000026 0x001f0040 0x00000000 0x00000000 0x000d0003 0x00000002 0x00000000 0x00000000
40821220: 0x0000001f 0x00000010 0x40812880 0x42012dbc 0x00000000 0x00000000 0x00000000 0x00000000
40821240: 0x00000026 0x001f0040 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x4202906c
40821260: 0x00000000 0x00000000 0x00000000 0x420293f6 0x00000000 0x00000000 0x00000000 0x42006050
40821280: 0x00000000 0x00000000 0x00000000 0x420002d4 0x00000000 0x00000000 0x00000000 0x4080a84e
408212a0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
408212c0: 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xbaad5678 0x0005b331 0x40815784
408212e0: 0x40815784 0x17a01064 0x3cbb4952 0xe9ce286f 0xcb53fd78 0xeae78b8b 0x9164f0a6 0x00ca4e16
40821300: 0x84197e7e 0x5bba3289 0xf1cb4d55 0x6cf7e1c9 0xbefba5d3 0xaba6e9b9 0x95252261 0xc0e1096c
40821320: 0x012ad910 0x524080cb 0x84efba99 0x9d7237ef 0xaf73fc8f 0x3e9eeb03 0x1d9f2097 0x911ae4b7
40821340: 0x25289656 0x84f50ac5 0x6d05d9be 0x34eb85cb 0xb94e677e 0x2fde297e 0xc286c605 0xc568213a
40821360: 0x1015c1dc 0x027287b3 0x73576612 0xbaa5df54 0x7bda2b8d 0x051679ff 0x0a30a020 0x3517317c
40821380: 0xbe5c8d82 0x6ca282e8 0x7e77afea 0xb7de4b64 0xcc4f8df6 0x9f7903ef 0x2a6a40e3 0xc88dda7a
408213a0: 0xe70510bd 0x8d2a8ac0 0x1bbfa96d 0x2ffdf624 0xf9cb6f2c 0x496ffe75 0x5b97f428 0x90d88bc3
408213c0: 0xa83b2048 0x769ce0c0 0x32df5f35 0x7648dcf7 0xc7ce8e77 0xf9dc9df1 0x074800c7 0x89300645
408213e0: 0x8b63c504 0x69091b6a 0x7b4eaa0f 0xce461fbd 0xc4887bd5 0x833a9fc1 0xab4e3c52 0x6dc3932f
40821400: 0x5cffb08b 0x5251bbf9 0x8b23deee 0xeb97f7a7 0x77b03bbd 0x729bcd44 0xdb85d6b2 0x2f98d80c
40821420: 0x548a1204 0x88396425 0x54eca676 0x85d9da70 0xdafc8f89 0x6efa9f7a 0x2772d5c0 0x02e2cb6d
40821440: 0x9ec88a3e 0x6b6fe488 0x2a87101a 0xf2cdf7e6 0x9fc277be 0x487d76a4 0x20b6c9ca 0x0f3a2908
40821460: 0x6506f711 0x6e4b554b 0x719fd0fb 0x1fa669aa 0xbeb6df7a 0x8fd2dcfd 0x88d14b77 0xe9f08325
40821480: 0xe8d12ba8 0x1eb96808 0x2f457c3f 0x9d5af07f 0xaa4e1eec 0x5175d2af 0x00825a14 0x9005001b
408214a0: 0x303a620b 0x88b31812 0xcf3faf7c 0x5cff741a 0xa8fe3afb 0xe5e1b7f1 0x8b262b80 0x6b628e28
408214c0: 0xecc19b6d 0xca02e6a2 0xd4bae6df 0x6fe7fe2f 0xb57b1ed9 0xb2870fde 0x652b45bf 0x4ad03b3f
408214e0: 0x49287054 0x1a85a825 0x2a92648e 0x76160d7f 0xf343e565 0x2ea69e7f 0x8ce3a666 0x765d4e15
40821500: 0x000834e9 0x552921d4 0x97e72ad9 0xc60460fa 0xff867f7f 0x57f2e977 0x9b9c9446 0xfd81bb84
40821520: 0x2f5590fa 0x9a034417 0x8368c46a 0xafff655f 0x715e7a7c 0x2fe93d6f 0xc5061321 0xa982d430



ELF file SHA256: 4a15bede10f27a22

Rebooting...
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0xc (SW_CPU),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4001975a
SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xcf8
load:0x4086e610,len:0x2e30
load:0x40875728,len:0x113c
entry 0x4086c410

@michapr
Copy link

michapr commented Nov 16, 2024

Additional debug log:
Have seen different lines before reboot:
[ 7919][E][ZigbeeCore.cpp:219] esp_zb_app_signal_handler(): Failed to initializeESP-ROM:esp32c6-20220919
or
[ 7921][E][ZigbeeCore.cpp:219] esp_zb_app_signal_handler(): Failed to initialize Zigbee stack (status: ESP_FAIL)
or nothing special...


[  7919][E][ZigbeeCore.cpp:219] esp_zb_app_signal_handler(): Failed to initializeESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0xc (SW_CPU),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4001975a
SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xcf8
load:0x4086e610,len:0x2e30
load:0x40875728,len:0x113c
entry 0x4086c410
[   252][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42005d82
[   263][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x42005d46
[   275][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x42005d0a
[   286][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42005cce
[   297][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42005d82
[   309][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x42005d46
[   320][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x42005d0a
[   331][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42005cce
[   343][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DM (38) successfully set to 0x420025ac
[   354][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DP (39) successfully set to 0x420025ac
[   365][V][ZigbeeEP.cpp:18] ZigbeeEP(): Endpoint: 10
[   375][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 17 successfully set to type UART_RX (2) with bus 0x4080e52c
[   386][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 16 successfully set to type UART_TX (3) with bus 0x4080e52c
[   396][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 12 successfully set to type USB_DM (38) with bus 0x40810394
[   407][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 13 successfully set to type USB_DP (39) with bus 0x40810394
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32-C6
  Package           : 1
  Revision          : 0.01
  Cores             : 1
  CPU Frequency     : 160 MHz
  XTAL Frequency    : 40 MHz
  Features Bitfield : 0x00000052
  Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : No
  BT Low Energy     : Yes
  IEEE 802.15.4     : Yes
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   449996 B ( 439.4 KB)
  Free Bytes        :   414204 B ( 404.5 KB)
  Allocated Bytes   :    28856 B (  28.2 KB)
  Minimum Free Bytes:   414204 B ( 404.5 KB)
  Largest Free Block:   393204 B ( 384.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         :  4194304 B (4 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 40 MHz
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
               app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x00290000, size:  1388.0 KB, type: DATA, subtype: SPIFFS
         zb_storage : addr: 0x003EB000, size:    16.0 KB, type: DATA, subtype: FAT
             zb_fct : addr: 0x003EF000, size:     4.0 KB, type: DATA, subtype: FAT
           coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Nov 16 2024 18:03:25
  Compile Host OS   : windows
  ESP-IDF Version   : v5.1.4-972-g632e0c2a9f-dirty
  Arduino Version   : 3.0.7
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32C6_DEV
  Arduino Variant   : esp32c6
  Arduino FQBN      : esp32:esp32:esp32c6:UploadSpeed=921600,CDCOnBoot=cdc,CPUFreq=160,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=zigbee,DebugLevel=verbose,EraseFlash=all,JTAGAdapter=default,ZigbeeMode=ed
============ Before Setup End ============
[   530][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 12 already has type USB_DM (38) with bus 0x40810394
[   530][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 13 already has type USB_DP (39) with bus 0x40810394
[   531][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x42003482
[   531][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 9 successfully set to type GPIO (1) with bus 0xa
[   532][D][ZigbeeCore.cpp:66] addEndpoint(): Endpoint: 10, Device ID: 0x0302
[   533][D][ZigbeeCore.cpp:103] zigbeeInit(): Initialize Zigbee stack
[   569][D][ZigbeeCore.cpp:110] zigbeeInit(): Register all Zigbee EPs in list
[   570][I][ZigbeeCore.cpp:118] zigbeeInit(): List of registered Zigbee EPs:
[   570][I][ZigbeeCore.cpp:120] zigbeeInit(): Device type: Temperature Sensor, Endpoint: 10, Device ID: 0x0302
[   582][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[   582][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[   583][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[   583][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[   584][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[   585][V][ZigbeeCore.cpp:301] esp_zb_app_signal_handler(): ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
[   585][I][ZigbeeCore.cpp:191] esp_zb_app_signal_handler(): Zigbee stack initialized
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   449996 B ( 439.4 KB)
  Free Bytes        :   389280 B ( 380.2 KB)
  Allocated Bytes   :    52844 B (  51.6 KB)
  Minimum Free Bytes:   389280 B ( 380.2 KB)
  Largest Free Block:   368628 B ( 360.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
  GPIO : BUS_TYPE[bus/unit][chan]
  --------------------------------------
     9 : GPIO
    12 : USB_DM
    13 : USB_DP
    16 : UART_TX[0]
    17 : UART_RX[0]
============ After Setup End =============
[  1584][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[  1584][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[  1585][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[  1585][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[  1586][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[  2586][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[  2586][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[  2587][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[  2587][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[  2588][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[  3588][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[  3588][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[  3589][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[  3589][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[  3590][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[  4590][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[  4590][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[  4591][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[  4591][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[  4591][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[  5592][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[  5592][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[  5593][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[  5593][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[  5594][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[  6594][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[  6594][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[  6595][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[  6595][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[  6596][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[  7596][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[  7596][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[  7597][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[  7597][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[  7598][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[  7921][E][ZigbeeCore.cpp:219] esp_zb_app_signal_handler(): Failed to initialize Zigbee stack (status: ESP_FAIL)
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0xc (SW_CPU),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4001975a
SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xcf8
load:0x4086e610,len:0x2e30
load:0x40875728,len:0x113c
entry 0x4086c410
[   252][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42005d82
[   263][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x42005d46
[   275][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x42005d0a
[   286][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42005cce
[   297][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42005d82
[   309][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x42005d46
[   320][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x42005d0a
[   331][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42005cce
[   343][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DM (38) successfully set to 0x420025ac
[   354][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DP (39) successfully set to 0x420025ac
[   365][V][ZigbeeEP.cpp:18] ZigbeeEP(): Endpoint: 10
[   375][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 17 successfully set to type UART_RX (2) with bus 0x4080e52c
[   386][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 16 successfully set to type UART_TX (3) with bus 0x4080e52c
[   397][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 12 successfully set to type USB_DM (38) with bus 0x40810394
[   407][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 13 successfully set to type USB_DP (39) with bus 0x40810394
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32-C6
  Package           : 1
  Revision          : 0.01
  Cores             : 1
  CPU Frequency     : 160 MHz
  XTAL Frequency    : 40 MHz
  Features Bitfield : 0x00000052
  Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : No
  BT Low Energy     : Yes
  IEEE 802.15.4     : Yes
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   449996 B ( 439.4 KB)
  Free Bytes        :   414204 B ( 404.5 KB)
  Allocated Bytes   :    28856 B (  28.2 KB)
  Minimum Free Bytes:   414204 B ( 404.5 KB)
  Largest Free Block:   393204 B ( 384.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         :  4194304 B (4 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 40 MHz
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
               app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x00290000, size:  1388.0 KB, type: DATA, subtype: SPIFFS
         zb_storage : addr: 0x003EB000, size:    16.0 KB, type: DATA, subtype: FAT
             zb_fct : addr: 0x003EF000, size:     4.0 KB, type: DATA, subtype: FAT
           coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Nov 16 2024 18:03:25
  Compile Host OS   : windows
  ESP-IDF Version   : v5.1.4-972-g632e0c2a9f-dirty
  Arduino Version   : 3.0.7
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32C6_DEV
  Arduino Variant   : esp32c6
  Arduino FQBN      : esp32:esp32:esp32c6:UploadSpeed=921600,CDCOnBoot=cdc,CPUFreq=160,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=zigbee,DebugLevel=verbose,EraseFlash=all,JTAGAdapter=default,ZigbeeMode=ed
============ Before Setup End ============
[   530][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 12 already has type USB_DM (38) with bus 0x40810394
[   530][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 13 already has type USB_DP (39) with bus 0x40810394
[   531][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x42003482
[   532][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 9 successfully set to type GPIO (1) with bus 0xa
[   533][D][ZigbeeCore.cpp:66] addEndpoint(): Endpoint: 10, Device ID: 0x0302
[   533][D][ZigbeeCore.cpp:103] zigbeeInit(): Initialize Zigbee stack
[   617][D][ZigbeeCore.cpp:110] zigbeeInit(): Register all Zigbee EPs in list
[   619][I][ZigbeeCore.cpp:118] zigbeeInit(): List of registered Zigbee EPs:
[   619][I][ZigbeeCore.cpp:120] zigbeeInit(): Device type: Temperature Sensor, Endpoint: 10, Device ID: 0x0302
[   631][V][Zigbee_Temperature_Sensor.ino:45] temp_sensor_value_update(): Temperature sensor value: 37.00°C
[   632][V][ZigbeeTempSensor.cpp:68] setTemperature(): Updating temperature sensor value...
[   632][D][ZigbeeTempSensor.cpp:70] setTemperature(): Setting temperature to 3700
[   633][V][ZigbeeTempSensor.cpp:108] setHumidity(): Updating humidity sensor value...
[   633][D][ZigbeeTempSensor.cpp:110] setHumidity(): Setting humidity to 3700
[   634][V][ZigbeeCore.cpp:301] esp_zb_app_signal_handler(): ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
[   635][I][ZigbeeCore.cpp:191] esp_zb_app_signal_handler(): Zigbee stack initialized
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   449996 B ( 439.4 KB)
  Free Bytes        :   389260 B ( 380.1 KB)
  Allocated Bytes   :    52864 B (  51.6 KB)
  Minimum Free Bytes:   389260 B ( 380.1 KB)
  Largest Free Block:   368628 B ( 360.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
  GPIO : BUS_TYPE[bus/unit][chan]
  --------------------------------------
     9 : GPIO
    12 : USB_DM
    13 : USB_DP
    16 : UART_TX[0]
    17 : UART_RX[0]
============ After Setup End =============

If you need longer log file or something else tell me....

BTW: tested also with latest RC - same result

  ESP-IDF Version   : v5.3.1-638-ga0f798cfc4-dirty
  Arduino Version   : 3.1.0

@michapr
Copy link

michapr commented Nov 17, 2024

@phiphi060
Only for interest - what happen in your case if you remove power from sensor and start it again?
All values will be reported?

I have seen that there maybe a problem with battery powered devices, will open a new issue (#10612).
So you can close this issue here if all is fine for you.

@phiphi060
Copy link
Author

@michapr
After comment line 62 and add a delay at line 63,iI have the same problem : if i remove the power - device is rebooting every 3,5 secs !

@phiphi060
Copy link
Author

I have updated the ESP32 Arduino Library to 3.1.0-RC3 and updated the Home Assistant Core to the latest version but the problem stay the same.

@P-R-O-C-H-Y
Copy link
Member

As many of you are using the Zigbee2MQTT, I will also try that instead of using the HomeAssistant. Maybe I will be able to reproduce it. Give me some time to properly test everything and I will keep you updated :) Thank you all for great reports and testing.

@P-R-O-C-H-Y P-R-O-C-H-Y added Status: Test needed Issue needs testing Status: In Progress ⚠️ Issue is in progress labels Nov 18, 2024
@phiphi060
Copy link
Author

I have add humidity cluster to the temperature sensor example code, it will work fine (without Battery level and without deepsleep). Reporting is working
If i remove power, no problem after rebooting

@P-R-O-C-H-Y
Copy link
Member

@phiphi060 are you using H2 or C6?
I have no issue with H2, but C6 temperature sensor (with/without humidity) is not working. It crashes after calling reportTemperature or reportHumidity. In the 3.0.0-RC3 we are using esp-zigbee-sdk 1.6.0, and I found out if I roll back to 1.5.1 it works again. So I assume the problem is there, but I am still testing if I can somehow fix it.

@P-R-O-C-H-Y
Copy link
Member

@phiphi060 Can you try to test with the changes from this PR #10623 ? Thank you

@phiphi060
Copy link
Author

@P-R-O-C-H-Y I'm using ESP32H2
I have make a sketch based of the example "Zigbee_Temperature_Sensor.ino" where i have add the Humidity cluster and a DHT22 temperature/humididty sensor, all run fine. But if i use as base the example "Zigbee_Temp_Hum_Sensor_Sleepy.ino" (even if i comment the line 62 and add a delay) the ESP32H2 reboot endless after power down.

@P-R-O-C-H-Y
Copy link
Member

So after first reboot (waking up from deep sleep), the chip is always rebooting?

@phiphi060
Copy link
Author

phiphi060 commented Nov 19, 2024

@P-R-O-C-H-Y I have tested with the PR#10623 modifications but the problem stay the same :
After the first reboot, the ESP32H2 reboot endless(direct after flashing)
(original sketch "Zigbee_Temp_hum_Sensor_Sleepy.ino" without modification)
163015.852 - ESP-ROMesp32h2-2022110.txt

@P-R-O-C-H-Y
Copy link
Member

@P-R-O-C-H-Y I have tested with the PR#10623 modifications but the problem stay the same : After the first reboot, the ESP32H2 reboot endless(direct after flashing) (original sketch "Zigbee_Temp_hum_Sensor_Sleepy.ino" without modification) 163015.852 - ESP-ROMesp32h2-2022110.txt

@phiphi060 please set debug level to Verbose in the Arduino IDE Tools menu. Flash again, and post the logs then.
Here is an empty log just with bootloader info.

@phiphi060
Copy link
Author

@P-R-O-C-H-Y I have set the debug level to Verbose but i don't see more in serial monitor.
I have see that the serial monitor don't print something with ESP32H2 chip. The command Serial.print run fine with Arduino R4 but not with ESP32H2. I see only the bootloader of the Chip. Do i making something special in configuration from Arduino IDE ?
My Serial Monitor is set to 115200 baud. I have set Show verbose output during "compile" and "upload" to true in Arduino IDE Preferences.
With the sketch "Zigbee_Temperature_Sensor2.ino", based of the example sketch "Zigbee_Temperature_Sensor.ino" where i have added a Humidity Cluster, all run fine but without Battery Level and Deepsleep. The Temperature and Humidity values are correct reported, after Power down and reboot too.

// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**

  • @brief This example demonstrates Zigbee temperature sensor.
  • The example demonstrates how to use Zigbee library to create a end device temperature sensor.
  • The temperature sensor is a Zigbee end device, which is controlled by a Zigbee coordinator.
  • Proper Zigbee mode must be selected in Tools->Zigbee mode
  • and also the correct partition scheme must be selected in Tools->Partition Scheme.
  • Please check the README.md for instructions and more detailed description.
  • Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/)
    */

#ifndef ZIGBEE_MODE_ED
#error "Zigbee coordinator mode is not selected in Tools->Zigbee mode"
#endif

#include "Zigbee.h"

#define BUTTON_PIN 9 //Boot button for C6/H2
#define TEMP_SENSOR_ENDPOINT_NUMBER 10

ZigbeeTempSensor zbTempSensor = ZigbeeTempSensor(TEMP_SENSOR_ENDPOINT_NUMBER);

/************************ Temp_hum sensor *****************************/
static void temp_hum_sensor_value_update(void *arg) {
for (;;) {
// Read temperature sensor value
float tsens_value = temperatureRead();
log_v("Temperature sensor value: %.2f°C", tsens_value);
// Update temperature value in Temperature sensor EP
zbTempSensor.setTemperature(tsens_value);
// Read humidity sensor value
float hsens_value = 55; //tsens_value
log_v("Humidity sensor value: %.2f%", hsens_value);
// Update Humidity value in Temperature sensor EP
zbTempSensor.setHumidity(hsens_value);
delay(1000);
}
}

/********************* Arduino functions **************************/
void setup() {

Serial.begin(115200);
while (!Serial) {
delay(10);
}

// Init button switch
pinMode(BUTTON_PIN, INPUT_PULLUP);

// Optional: set Zigbee device name and model
zbTempSensor.setManufacturerAndModel("Espressif", "ZigbeeTempHumSensor");

// Set minimum and maximum temperature measurement value (10-50°C is default range for chip temperature measurement)
zbTempSensor.setMinMaxValue(10, 50);

// Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C)
zbTempSensor.setTolerance(0.1);

// Add humidity cluster to the temperature sensor device with min, max and tolerance values
zbTempSensor.addHumiditySensor(0, 100, 1);

// Add endpoint to Zigbee Core
Zigbee.addEndpoint(&zbTempSensor);

// When all EPs are registered, start Zigbee in End Device mode
Zigbee.begin();

// Start Temperature sensor reading task
xTaskCreate(temp_hum_sensor_value_update, "temp_hum_sensor_update", 2048, NULL, 10, NULL);

// Set reporting interval for temperature measurement in seconds, must be called after Zigbee.begin()
// min_interval and max_interval in seconds, delta (temp change in °C)
// if min = 1 and max = 0, reporting is sent only when temperature changes by delta
// if min = 0 and max = 10, reporting is sent every 10 seconds or temperature changes by delta
// if min = 0, max = 10 and delta = 0, reporting is sent every 10 seconds regardless of temperature change
zbTempSensor.setReporting(1, 0, 0.1);
}

void loop() {
// Checking button for factory reset
if (digitalRead(BUTTON_PIN) == LOW) { // Push button pressed
// Key debounce handling
delay(100);
int startTime = millis();
while (digitalRead(BUTTON_PIN) == LOW) {
delay(50);
if ((millis() - startTime) > 3000) {
// If key pressed for more than 3secs, factory reset Zigbee and reboot
Serial.printf("Resetting Zigbee to factory settings, reboot.\n");
Zigbee.factoryReset();
}
}
zbTempSensor.reportTemperature();
zbTempSensor.reportHumidity();
}
delay(100);
}

@michapr
Copy link

michapr commented Dec 10, 2024

It's the scanDuration.

ok, last question here in this issue (it's a wrong place here for this :-)) .. ) Scanning process is not cancelled, if message from router say that device has reconnected? Or is it the max. scanDuration - then it should be not critical.

@miroslavpetrov
Copy link

I am using XIAO-C6 and Arduino core 3.1.0. I did a lot of tests today and I couldn't get the sleepy example working with Zigbee2MQTT. I am interested in helping to resolve this issue even tough I have limited free time...Adding 20sec delay if reset reason is not wake from deepsleep helped to get atleast the first sent temp and hum values correct in Z2M but after that the values are wrong again. Humidity is like 655,36% and temperature is -327.68.

@michapr
Copy link

michapr commented Dec 29, 2024

@miroslavpetrov I just have tested the 3.1.0 with ESP32C6 (devboard) and it was working fine with Zigbee2MQTT (have tested only once within short time)
I have seen that the final delay(100) in line 63 maybe too small - have changed it for testing now to delay(300) to be sure that report is finished.

Please check at first the settings - "Erase All Flash before..." must be enabled,
If device was added before in Z2M:

  1. upload code to ESP32
  2. switch off ESP32
  3. remove device from Z2M
  4. restart Z2M service to remove the old settings from memory (because device will have same MAC/ID as before)
  5. enable join mode in Z2M and then switch on ESP32

If still the same problem - set the settings in Tools to "Core Debug Level" to "Verbose" and copy the log output from serial monitor and paste it here (as "code")

I will make also some more tests today/tomorrow.

@michapr
Copy link

michapr commented Dec 29, 2024

@miroslavpetrov
Try to replace the
zbTempSensor.report();
with

  zbTempSensor.reportTemperature();
  zbTempSensor.reportHumidity();

This is working for me stable.

@P-R-O-C-H-Y
I get following debug message:

[  3987][V][ZigbeeTempSensor.cpp:112] setHumidity(): Updating humidity sensor value...
[  3987][D][ZigbeeTempSensor.cpp:114] setHumidity(): Setting humidity to 1500
[  3990][V][ZigbeeTempSensor.cpp:93] reportTemperature(): Temperature report sent
�[0;31mE (4107) ESP_ZIGBEE_COMMAND: esp_zb_zcl_report_attr_cmd_req(321): This attribute: 0x0 is not existed!�[0m
[  3992][V][ZigbeeTempSensor.cpp:135] reportHumidity(): Humidity report sent
Reported temperature: 15.00°C, Humidity: 15.00%

In result humidity value will not be reported...

@SuGlider SuGlider added the Area: Zigbee Issues and Feature Request about Zigbee label Dec 29, 2024
@miroslavpetrov
Copy link

@michapr I got it working... This is my code. What I do is count the wakes from deep sleep and send the value as both temperature and humidity. This way I can easily track in Z2M if all messages have arrived as expected. With this code all messages arrive even if delay is only 100ms after zbTempSensor.reportTemperature(). I also did what you suggested, delete the device from Z2M and restart Z2M addon before each flash of ESP32-C6. Here is the code:

#ifndef ZIGBEE_MODE_ED
#error "Zigbee end device mode is not selected in Tools->Zigbee mode"
#endif
#include <rom/rtc.h>

#include "Zigbee.h"
#include "esp_sleep.h"
/* Zigbee temperature sensor configuration */
#define TEMP_SENSOR_ENDPOINT_NUMBER 10
#define uS_TO_S_FACTOR 1000000ULL /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP  10         /* Sleep for 10s */
uint8_t button = BOOT_PIN;
RTC_DATA_ATTR int wakeCounter = 0; // Stored in RTC memory
ZigbeeTempSensor zbTempSensor = ZigbeeTempSensor(TEMP_SENSOR_ENDPOINT_NUMBER);

/************************ Temp sensor *****************************/
static void temp_sensor_value_update(void) {
  {
    // Read temperature sensor value
    float tsens_value = wakeCounter;
    Serial.printf("Updated temperature sensor value to %.2f°C\r\n", tsens_value);
    // Update temperature value in Temperature sensor EP
    zbTempSensor.setTemperature(tsens_value);
    zbTempSensor.setHumidity(tsens_value);
    //delay(100);
    zbTempSensor.reportTemperature();
    zbTempSensor.reportHumidity();
    delay(100);

  }
}

/********************* Arduino functions **************************/
void setup() {
  Serial.begin(115200);
  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
  wakeCounter++;
  // Init button switch
  pinMode(button, INPUT_PULLUP);

  // Optional: set Zigbee device name and model
  zbTempSensor.setManufacturerAndModel("Espressif", "ZigbeeTempSensor");

  // Set minimum and maximum temperature measurement value (10-50°C is default range for chip temperature measurement)
  zbTempSensor.setMinMaxValue(0, 100);

  // Optional: Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C)
  zbTempSensor.setTolerance(1);

  zbTempSensor.setPowerSource(ZB_POWER_SOURCE_BATTERY, 100);

  zbTempSensor.addHumiditySensor(0, 100, 1);

  // Add endpoint to Zigbee Core
  Zigbee.addEndpoint(&zbTempSensor);

  Serial.println("Starting Zigbee...");
  // When all EPs are registered, start Zigbee in End Device mode
  if (!Zigbee.begin()) {
    Serial.println("Zigbee failed to start!");
    Serial.println("Rebooting...");
    ESP.restart();
  } else {
    Serial.println("Zigbee started successfully!");
  }
  Serial.println("Connecting to network");
  while (!Zigbee.connected()) {
    Serial.print(".");
    delay(100);
  }
  Serial.println();

  if ( (int)rtc_get_reset_reason(0) != 5 )  {   //  SW_CPU_RESET=12 ,  POWERON_RESET=1 , DEEPSLEEP_RESET=5
    delay(20000);
  }
}

void loop() {
  // Checking button for factory reset
  if (digitalRead(button) == LOW) {  // Push button pressed
    // Key debounce handling
    delay(100);
    int startTime = millis();
    while (digitalRead(button) == LOW) {
      delay(50);
      if ((millis() - startTime) > 3000) {
        // If key pressed for more than 3secs, factory reset Zigbee and reboot
        Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
        delay(1000);
        Zigbee.factoryReset();
      }
    }
  }
  temp_sensor_value_update();
  Serial.println("Going to sleep now");
  esp_deep_sleep_start();
}

@estegewr
Copy link

estegewr commented Jan 2, 2025

I tried your example code with my ESP32-C6, @miroslavpetrov. The non-stop counter works as expected (continuous increase reported in the serial monitor). However, irregular values arrive at the MQTT broker, no matter what is sent:
Temperature: -327.68
Humidity: 655.35
I also deleted the device in z2m and erased ESP's flash memory as recommnended by @michapr.

This is what the serial log monitor tells about the processing:

[   703][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 12 already has type USB_DM (38) with bus 0x40811a04
[   704][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 13 already has type USB_DP (39) with bus 0x40811a04
[   704][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x42003ac0
[   705][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 9 successfully set to type GPIO (1) with bus 0xa
[   706][D][ZigbeeCore.cpp:84] addEndpoint(): Endpoint: 10, Device ID: 0x0302
Starting Zigbee...
[   707][D][ZigbeeCore.cpp:123] zigbeeInit(): Initialize Zigbee stack
[   726][D][ZigbeeCore.cpp:130] zigbeeInit(): Register all Zigbee EPs in list
[   728][I][ZigbeeCore.cpp:138] zigbeeInit(): List of registered Zigbee EPs:
[   728][I][ZigbeeCore.cpp:140] zigbeeInit(): Device type: Temperature Sensor, Endpoint: 10, Device ID: 0x0302
[   739][V][ZigbeeCore.cpp:339] esp_zb_app_signal_handler(): ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
[   740][I][ZigbeeCore.cpp:219] esp_zb_app_signal_handler(): Zigbee stack initialized
[  3092][I][ZigbeeCore.cpp:225] esp_zb_app_signal_handler(): Device started up in non factory-reset mode
[  3093][I][ZigbeeCore.cpp:238] esp_zb_app_signal_handler(): Device rebooted
[  3093][D][ZigbeeCore.cpp:466] searchBindings(): Requesting binding table for address 0x8f72
[  3094][D][ZigbeeCore.cpp:406] bindingTableCb(): Binding table callback for address 0x8f72 with status 0
[  3095][D][ZigbeeCore.cpp:409] bindingTableCb(): Binding table info: total 0, index 0, count 0
[  3096][D][ZigbeeCore.cpp:412] bindingTableCb(): No binding table entries found
Zigbee started successfully!
Connecting to network
Updated temperature sensor value to 7.00°C
[  3127][V][ZigbeeTempSensor.cpp:71] setTemperature(): Updating temperature sensor value...
[  3128][D][ZigbeeTempSensor.cpp:73] setTemperature(): Setting temperature to 700
[  3129][V][ZigbeeTempSensor.cpp:112] setHumidity(): Updating humidity sensor value...
[  3130][D][ZigbeeTempSensor.cpp:114] setHumidity(): Setting humidity to 700
[  3131][V][ZigbeeTempSensor.cpp:93] reportTemperature(): Temperature report sent
[  3132][V][ZigbeeTempSensor.cpp:135] reportHumidity(): Humidity report sent
Going to sleep now

@michapr
Copy link

michapr commented Jan 2, 2025

@estegewr Looks like your device wasn't configured full at Zigbee Gateway.
You can try to join the device again (maybe remove it at first from Gateway - see steps above) and post the first log here.

I have seen this once, I could finish the configuration pressing device reset after first join procedure (after device was going to sleep) but the join accept was still available at gateway.

@miroslavpetrov
Copy link

@estegewr Try this sequence:

  1. Power off the ESP32
  2. Remove device from Z2M with force remove option enabled
  3. Restart Z2M addon(I have found this is very important)
  4. Erase flash of ESP32 and flash it again. Be sure that you have selected Zigbee ED in tools and Zigbee 4MB partition.

I have added a SHT-C3 TH sensor to one C6 and it has been working great for a few days now.image

@estegewr
Copy link

estegewr commented Jan 2, 2025

I thought I had followed the procedure. But apparently I hadn't completed it correctly. After re-learning the ESP32-C6 at the zigbee gateway, it now works correctly with @michapr's example code 👍🙏.

@P-R-O-C-H-Y
Copy link
Member

@michapr @miroslavpetrov @estegewr @phiphi060 Can we close this issue? Seems to be solved to me :)

@miroslavpetrov
Copy link

@P-R-O-C-H-Y I think so

@michapr
Copy link

michapr commented Jan 7, 2025

@P-R-O-C-H-Y There is one detail inside using zbTempSensor.report();:
#10601 (comment)

@P-R-O-C-H-Y
I get following debug message:

[ 3987][V][ZigbeeTempSensor.cpp:112] setHumidity(): Updating humidity sensor value...
[ 3987][D][ZigbeeTempSensor.cpp:114] setHumidity(): Setting humidity to 1500
[ 3990][V][ZigbeeTempSensor.cpp:93] reportTemperature(): Temperature report sent
�[0;31mE (4107) ESP_ZIGBEE_COMMAND: esp_zb_zcl_report_attr_cmd_req(321): This attribute: 0x0 is not existed!�[0m
[ 3992][V][ZigbeeTempSensor.cpp:135] reportHumidity(): Humidity report sent
Reported temperature: 15.00°C, Humidity: 15.00%

In result humidity value will not be reported...

@estegewr
Copy link

estegewr commented Jan 7, 2025

After some testing I experiences some weird behaviour:

  1. ESP32-C6 is running @michapr's sample code, but only if I compile it in verbose mode. When I switch back to debug level "none" I get the reported wrong values for temperature: -327.68 and humidity: 655.35
  2. After any change to the program code I have to reassign the sensor at Z2M. Otherwise the reported values as in (1)

I also recognize sometimes trouble while connected to the ZigBee hub:

Starting Zigbee...
[   759][D][ZigbeeCore.cpp:123] zigbeeInit(): Initialize Zigbee stack
[   778][D][ZigbeeCore.cpp:130] zigbeeInit(): Register all Zigbee EPs in list
[   780][I][ZigbeeCore.cpp:138] zigbeeInit(): List of registered Zigbee EPs:
[   780][I][ZigbeeCore.cpp:140] zigbeeInit(): Device type: Temperature Sensor, Endpoint: 10, Device ID: 0x0302
[   788][V][ZigbeeCore.cpp:339] esp_zb_app_signal_handler(): ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
[   789][I][ZigbeeCore.cpp:219] esp_zb_app_signal_handler(): Zigbee stack initialized
[  3158][V][ZigbeeCore.cpp:339] esp_zb_app_signal_handler(): ZDO signal: NLME Status Indication (0x32), status: ESP_OK
[  3159][W][ZigbeeCore.cpp:251] esp_zb_app_signal_handler(): Commissioning failed, trying again...
�[0;31mE (4359) ESP_ZIGBEE_CORE: In BDB commissioning, an error occurred (for example: the device has already been running)�[0m
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x420009f0
file: "/Users/steffen/Library/Arduino15/packages/esp32/hardware/esp32/3.1.0/libraries/Zigbee/src/ZigbeeCore.cpp" line 205
func: void bdb_start_top_level_commissioning_cb(uint8_t)
expression: esp_zb_bdb_start_top_level_commissioning(mode_mask)

abort() was called at PC 0x40808c0f on core 0

@tbrown2337
Copy link

I can attest this is still an issue. I tried the solutions mentioned above on both esp32 C6 and H2 and even a fresh install of Z2M.

14:42:40.043 -> =========== Before Setup Start ===========
14:42:40.043 -> Chip Info:
14:42:40.043 -> ------------------------------------------
14:42:40.043 ->   Model             : ESP32-H2
14:42:40.043 ->   Package           : 0
14:42:40.043 ->   Revision          : 0.01
14:42:40.043 ->   Cores             : 1
14:42:40.043 ->   CPU Frequency     : 96 MHz
14:42:40.043 ->   XTAL Frequency    : 32 MHz
14:42:40.043 ->   Features Bitfield : 0x00000050
14:42:40.043 ->   Embedded Flash    : No
14:42:40.043 ->   Embedded PSRAM    : No
14:42:40.043 ->   2.4GHz WiFi       : No
14:42:40.043 ->   Classic BT        : No
14:42:40.043 ->   BT Low Energy     : Yes
14:42:40.043 ->   IEEE 802.15.4     : Yes
14:42:40.043 -> ------------------------------------------
14:42:40.043 -> INTERNAL Memory Info:
14:42:40.043 -> ------------------------------------------
14:42:40.043 ->   Total Size        :   235056 B ( 229.5 KB)
14:42:40.043 ->   Free Bytes        :   201700 B ( 197.0 KB)
14:42:40.043 ->   Allocated Bytes   :    28204 B (  27.5 KB)
14:42:40.043 ->   Minimum Free Bytes:   196888 B ( 192.3 KB)
14:42:40.043 ->   Largest Free Block:   184308 B ( 180.0 KB)
14:42:40.043 -> ------------------------------------------
14:42:40.043 -> Flash Info:
14:42:40.043 -> ------------------------------------------
14:42:40.043 ->   Chip Size         :  4194304 B (4 MB)
14:42:40.043 ->   Block Size        :    65536 B (  64.0 KB)
14:42:40.043 ->   Sector Size       :     4096 B (   4.0 KB)
14:42:40.043 ->   Page Size         :      256 B (   0.2 KB)
14:42:40.043 ->   Bus Speed         : 64 MHz
14:42:40.043 ->   Bus Mode          : QIO
14:42:40.043 -> ------------------------------------------
14:42:40.043 -> Partitions Info:
14:42:40.043 -> ------------------------------------------
14:42:40.043 ->                 nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
14:42:40.043 ->             otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
14:42:40.043 ->                app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
14:42:40.043 ->                app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
14:42:40.043 ->              spiffs : addr: 0x00290000, size:  1388.0 KB, type: DATA, subtype: SPIFFS
14:42:40.043 ->          zb_storage : addr: 0x003EB000, size:    16.0 KB, type: DATA, subtype: FAT
14:42:40.043 ->              zb_fct : addr: 0x003EF000, size:     4.0 KB, type: DATA, subtype: FAT
14:42:40.043 ->            coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
14:42:40.043 -> ------------------------------------------
14:42:40.043 -> Software Info:
14:42:40.043 -> ------------------------------------------
14:42:40.043 ->   Compile Date/Time : Jan  8 2025 14:27:18
14:42:40.043 ->   Compile Host OS   : windows
14:42:40.043 ->   ESP-IDF Version   : v5.3.2-282-gcfea4f7c98-dirty
14:42:40.043 ->   Arduino Version   : 3.1.1
14:42:40.043 -> ------------------------------------------
14:42:40.043 -> Board Info:
14:42:40.043 -> ------------------------------------------
14:42:40.043 ->   Arduino Board     : ESP32H2_DEV
14:42:40.043 ->   Arduino Variant   : esp32h2
14:42:40.043 ->   Arduino FQBN      : esp32:esp32:esp32h2:UploadSpeed=921600,CDCOnBoot=cdc,FlashFreq=64,FlashMode=qio,FlashSize=4M,PartitionScheme=zigbee,DebugLevel=verbose,EraseFlash=all,JTAGAdapter=default,ZigbeeMode=ed_debug
14:42:40.043 -> ============ Before Setup End ============
14:42:40.121 -> [   980][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 26 already has type USB_DM (38) with bus 0x408117e4
14:42:40.121 -> [   981][I][esp32-hal-periman.c:141] perimanSetPinBus(): Pin 27 already has type USB_DP (39) with bus 0x408117e4
14:42:40.121 -> [   982][V][esp32-hal-rmt.c:454] rmtInit(): GPIO 8 - TX MODE - MemSize[48] - Freq=10000000Hz
14:42:40.121 -> [   983][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type RMT_TX (10) successfully set to 0x42005a7c
14:42:40.165 -> [   984][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type RMT_RX (11) successfully set to 0x42005a7c
14:42:40.165 -> [   986][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 8 successfully set to type RMT_TX (10) with bus 0x4081a7a8
14:42:40.165 -> [   988][V][esp32-hal-rmt.c:305] _rmtWrite(): GPIO: 8 - Request: 24 RMT Symbols - Blocking - Timeout: -1
14:42:40.165 -> [   989][V][esp32-hal-rmt.c:306] _rmtWrite(): GPIO: 8 - Currently in Loop Mode: [NO] | Asked to Loop: NO, LoopCancel: NO
14:42:40.165 -> [  1028][D][zigbee_temp_sensor_DS18S20.ino:53] setup(): Setting device Espressif
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:215   >> zb_zcl_get_attribute_size: attr_type 0x42 attr_value 0x4081ad4c
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:348   << zb_zcl_get_attribute_size: result 10
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:215   >> zb_zcl_get_attribute_size: attr_type 0x42 attr_value 0x4081ad68
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:348   << zb_zcl_get_attribute_size: result 15
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:215   >> zb_zcl_get_attribute_size: attr_type 0x29 attr_value 0x4081f0cc
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:348   << zb_zcl_get_attribute_size: result 2
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:215   >> zb_zcl_get_attribute_size: attr_type 0x29 attr_value 0x4081f0ce
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:348   << zb_zcl_get_attribute_size: result 2
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:215   >> zb_zcl_get_attribute_size: attr_type 0x21 attr_value 0x4081f0ce
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:348   << zb_zcl_get_attribute_size: result 2
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:215   >> zb_zcl_get_attribute_size: attr_type 0x30 attr_value 0x4081f0cc
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:348   << zb_zcl_get_attribute_size: result 1
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:215   >> zb_zcl_get_attribute_size: attr_type 0x20 attr_value 0x4081f0cb
14:42:40.196 -> ZBOSS: zcl/zcl_common.c:348   << zb_zcl_get_attribute_size: result 1
14:42:40.196 -> [  1037][D][zigbee_temp_sensor_DS18S20.ino:59] setup(): Adding Zigbee Temperature Sensor endpoint to Zigbee Core
14:42:40.196 -> [  1038][D][ZigbeeCore.cpp:84] addEndpoint(): Endpoint: 10, Device ID: 0x0302
14:42:40.196 -> Starting Zigbee...
14:42:40.196 -> [  1039][D][ZigbeeCore.cpp:123] zigbeeInit(): Initialize Zigbee stack
14:42:40.196 -> ZBOSS: common/zb_init_default.c:181   ED build
14:42:40.196 -> ZBOSS: common/zb_init_default.c:187   sizes: g_zb 7576 sched 224 bpool 16 nwk 912 aps 3040 addr 284 zdo 840
14:42:40.196 -> ZBOSS: common/zb_init_default.c:196   sec 2
14:42:40.196 -> ZBOSS: common/zb_init_default.c:198   zcl 768
14:42:40.196 -> ZBOSS: common/zb_init_default.c:201   zll 960
14:42:40.196 -> ZBOSS: common/zb_init_default.c:207   nvram 140
14:42:40.196 -> ZBOSS: common/zb_init_default.c:210   buttons 200
14:42:40.196 -> ZBOSS: common/zb_init_default.c:212   err_ind 4
14:42:40.229 -> ZBOSS: common/zb_init_default.c:218   scheduler q size 80
14:42:40.229 -> ZBOSS: common/zb_init_default.c:221   g_mac 816 g_imac 28
14:42:40.229 -> ZBOSS: common/zb_init_default.c:225   Configurable mem build, use ZBOSS lib defaults = 0
14:42:40.229 -> ZBOSS: common/zb_init_default.c:231   ZB_IOBUF_POOL_SIZE 80 ZB_NWK_IN_Q_SIZE 40 ZB_MAC_PENDING_QUEUE_SIZE 20 ZB_APS_DST_BINDING_TABLE_SIZE 16 ZB_APS_BIND_TRANS_TABLE_SIZE 20 ZB_N_APS_RETRANS_ENTRIES 27
14:42:40.229 -> ZBOSS: common/zb_init_default.c:261   ZB_N_APS_KEY_PAIR_ARR_MAX_SIZE 8 ZB_IEEE_ADDR_TABLE_SIZE 64 ZB_NEIGHBOR_TABLE_SIZE 64 ZB_NWK_ROUTING_TABLE_SIZE 0 ZB_APS_DUPS_TABLE_SIZE 32
14:42:40.229 -> [  1064][D][ZigbeeCore.cpp:130] zigbeeInit(): Register all Zigbee EPs in list
14:42:40.229 -> ZBOSS: zdo/af_descriptor.c:357   ep_count 1
14:42:40.229 -> [  1067][I][ZigbeeCore.cpp:138] zigbeeInit(): List of registered Zigbee EPs:
14:42:40.229 -> [  1068][I][ZigbeeCore.cpp:140] zigbeeInit(): Device type: Temperature Sensor, Endpoint: 10, Device ID: 0x0302
14:42:40.229 -> ZBOSS: common/zb_nvram.c:3190   ds_ver == 2
14:42:40.229 -> ZBOSS: zdo/zdo_app_prod_conf.c:144   no production config block found
14:42:40.229 -> ZBOSS: zdo/zdo_app_prod_conf.c:781   no valid production configuration found, signaling to application
14:42:40.229 -> [  1086][V][ZigbeeCore.cpp:352] esp_zb_app_signal_handler(): ZDO signal: ZDO Config Ready (0x17), status: ESP_FAIL
14:42:40.229 -> [  1087][I][ZigbeeCore.cpp:219] esp_zb_app_signal_handler(): Zigbee stack initialized
14:42:40.229 -> ZBOSS: commissioning/bdb/zdo_commissioning_bdb.c:349   dev type 2, joined 1, ext_pan_id 1, authenticated 1, tclk_valid 1
14:42:42.556 -> ZBOSS: nwk/nwk_join.c:186   low lqi 0
14:42:42.556 -> ZBOSS: nwk/nwk_join.c:186   low lqi 15
14:42:42.601 -> ZBOSS: nwk/nwk_join.c:186   low lqi 0
14:42:42.601 -> ZBOSS: nwk/nwk_join.c:186   low lqi 0
14:42:42.601 -> ZBOSS: nwk/nwk_join.c:186   low lqi 20
14:42:42.601 -> ZBOSS: nwk/nwk_join.c:186   low lqi 25
14:42:42.601 -> ZBOSS: nwk/nwk_join.c:186   low lqi 20
14:42:42.601 -> ZBOSS: nwk/nwk_join.c:186   low lqi 0
14:42:42.601 -> ZBOSS: zdo/zdo_app_join.c:771   CONGRATULATIONS! joined status 0, addr 0xf56d, iface_id 0, ch 11, rejoin 1
14:42:42.601 -> ZBOSS: zdo/zdo_app_join.c:773   xpanid f8:f6:97:00:97:f9:14:89
14:42:42.649 -> [  3476][V][ZigbeeCore.cpp:352] esp_zb_app_signal_handler(): ZDO signal: NLME Status Indication (0x32), status: ESP_OK
14:42:42.649 -> ZBOSS: commissioning/bdb/zdo_commissioning_bdb.c:549   COMMISSIONING_STOP: app signal 6 comm status 14
14:42:42.649 -> [  3478][W][ZigbeeCore.cpp:251] esp_zb_app_signal_handler(): Commissioning failed, trying again...
14:42:42.649 -> ZBOSS: commissioning/bdb/zdo_commissioning_bdb.c:349   dev type 2, joined 1, ext_pan_id 1, authenticated 1, tclk_valid 1
14:42:43.158 -> �[0;31mE (4159) ESP_ZIGBEE_CORE: In BDB commissioning, an error occurred (for example: the device has already been running)�[0m
14:42:43.158 -> ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x42000b0e
14:42:43.158 -> file: "C:\Users\tbrow\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.1\libraries\Zigbee\src\ZigbeeCore.cpp" line 205
14:42:43.158 -> func: void bdb_start_top_level_commissioning_cb(uint8_t)
14:42:43.158 -> expression: esp_zb_bdb_start_top_level_commissioning(mode_
14:42:43.493 -> abort() was called at PC 0x4080842f on core 0
14:42:43.493 -> Core  0 register dump:
14:42:43.493 -> MEPC    : 0x40801862  RA      : 0x4080843a  SP      : 0x40825450  GP      : 0x4080fd04  
14:42:43.493 -> TP      : 0x40825590  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130  
14:42:43.493 -> S0/FP   : 0x4082547c  S1      : 0x4082547c  A0      : 0x40825488  A1      : 0x4082546a  
14:42:43.493 -> A2      : 0x00000000  A3      : 0x408254b5  A4      : 0x00000001  A5      : 0x40816000  
14:42:43.493 -> A6      : 0x00000000  A7      : 0x76757473  S2      : 0x003cba9a  S3      : 0x00000001  
14:42:43.493 -> S4      : 0x00000000  S5      : 0x0000004c  S6      : 0x00000000  S7      : 0x00000000  
14:42:43.493 -> S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000  
14:42:43.493 -> T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938  
14:42:43.493 -> MSTATUS : 0x00001881  MTVEC   : 0x40800001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000  
14:42:43.493 -> MHARTID : 0x00000000  
14:42:43.493 -> 
14:42:43.493 -> Stack memory:
14:42:43.493 -> 40825450: 0x00000000 0x00000000 0x40825468 0x4080e394 0x00000000 0x0000004c 0x00000030 0x40811188
14:42:43.493 -> 40825470: 0x4082547c 0x408111a4 0x40825468 0x30383034 0x66323438 0x42000b00 0x726f6261 0x20292874
14:42:43.493 -> 40825490: 0x20736177 0x6c6c6163 0x61206465 0x43502074 0x34783020 0x38303830 0x20663234 0x63206e6f
14:42:43.493 -> 408254b0: 0x2065726f 0x00000030 0x00000000 0x41fc1bff 0x420b0898 0x0000004c 0x4082349c 0x40808432
14:42:43.493 -> 408254d0: 0x00000000 0x00000049 0x4082349c 0x42000b12 0x00000000 0x00000000 0x00000000 0x42029404
14:42:43.493 -> 408254f0: 0x00000000 0x00000000 0x40823f1c 0x408090c0 0x42000ae4 0x003cb9d0 0x00000000 0xff4f4a00
14:42:43.493 -> 40825510: 0x408253d0 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x4205751e
14:42:43.493 -> 40825530: 0x00000001 0x00000001 0x00000000 0x4200a65c 0x00000000 0x00000000 0x40811750 0x4200a66a
14:42:43.493 -> 40825550: 0x00000000 0x00000000 0x00000000 0x408096f6 0x00000000 0x00000000 0x00000000 0x00000000
14:42:43.493 -> 40825570: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
14:42:43.493 -> 40825590: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xbaad5678 0x00027dd5 0x408168c4 0x408168c4
14:42:43.493 -> 408255b0: 0x3ae20c2d 0x77d59848 0x42c9020c 0xfa80d800 0x0c8d084b 0xe8b35887 0x42d13f19 0x61313040
14:42:43.493 -> 408255d0: 0x40b4849c 0x648883f2 0x4a1b4d9c 0xc00099ab 0x6a402696 0xa5369dcf 0x138043c9 0x083fc78e
14:42:43.493 -> 408255f0: 0x9b4b33de 0xb7d19163 0x4c3d968d 0x015cdac3 0x05f41b6b 0xdfb89ba5 0x590072a4 0xb7ca4d96
14:42:43.493 -> 40825610: 0xf87b3cad 0x9f6e6d47 0xb61ea010 0xf9f48975 0xf41371ff 0xae873ad3 0xcb40d908 0xd7bf8cc1
14:42:43.493 -> 40825630: 0xcef87d0d 0x6f2ed6bc 0xb0323980 0x4f20f619 0xefc0c9df 0xba7b361e 0x10544a52 0xff259581
14:42:43.493 -> 40825650: 0x7dd13ab6 0x197f7fa9 0x646e718c 0xa4ab948a 0x33d39754 0xa376092c 0xf3d82a01 0x424f8082
14:42:43.493 -> 40825670: 0xa4cc55bb 0x07923ff7 0xe83fb0a5 0x400d83c4 0x17e0b150 0x98972f95 0xc95497f6 0x7ea018e4
14:42:43.493 -> 40825690: 0x89e0282a 0x9e5247ed 0x7efb3bf5 0x04d2a052 0xf16f5dff 0xe63788fb 0x102a61a0 0xf1091027
14:42:43.493 -> 408256b0: 0x5f7807f1 0xcbf5195a 0x8815e965 0xcd0ad490 0xd55c4c3a 0x2e6315fe 0x86204610 0x005e8808
14:42:43.493 -> 408256d0: 0x880d7af1 0xcf6779ca 0x268310d1 0x8e1c0b8b 0xe47bd9e7 0xe2cb67c7 0x6f0303ca 0xe50e04dd
14:42:43.493 -> 408256f0: 0x25805966 0xa5bf946b 0xb5155450 0x79e0f1b5 0xdaa2064e 0xdad8cbcd 0x8a0ca880 0xc5b24068
14:42:43.493 -> 40825710: 0x8a9d9052 0x958badf8 0x1c735862 0x0b0205e9 0xb3989b6a 0x84389e78 0xc5508801 0xf729b049
14:42:43.493 -> 40825730: 0x96653294 0x4be8e472 0x93b12800 0x608995f2 0x10c88ca3 0x7e115463 0xe8f6e716 0x0f00f596
14:42:43.493 -> 40825750: 0xa12f38ee 0xc3d53b23 0xe52e8081 0x4acf8943 0x93f60f11 0xdedc64bd 0x7720dcf9 0xb5948254
14:42:43.493 -> 40825770: 0x72648c09 0x032f2dac 0xf8ce9410 0x31deb07e 0x2a4b2ab3 0x5750e4ac 0x021edc5c 0x47c80037
14:42:43.493 -> 40825790: 0x3c99ff07 0x1e7bf2a7 0xe8a1465a 0x09bc0099 0xadf4f36f 0xdc8df1e2 0x08e0cfa4 0x52f46340
14:42:43.493 -> 408257b0: 0xb8c392d1 0x43c0aa09 0xa20ea0a4 0x6c3c8249 0xa68eafda 0xd8bdb5ea 0x9168228a 0x22de9a85
14:42:43.493 -> 408257d0: 0xe0816e84 0x1d6f7d73 0x2fd13219 0x25e395ad 0xa5a7b68d 0x8114be2f 0x50428417 0x1206c236
14:42:43.493 -> 408257f0: 0xbad86cbf 0xeb70c39c 0x862a58f4 0x60e09b21 0xa242817a 0x74c69502 0x32fbef6f 0x9f03a9ce
14:42:43.493 -> 40825810: 0xe71a3d2a 0x1530d488 0x3d1caec2 0xf4a8977b 0xa0723a43 0x68b1fe8e 0x9c6a24cf 0xe315ff7f
14:42:43.493 -> 40825830: 0x923c46d4 0x0a8b3111 0xab8e870d 0x69d1bffc 0x721a607f 0x0814a8f4 0x1b4ff3e9 0x2cf0eb36
14:42:43.493 -> 
14:42:43.493 -> 
14:42:43.557 -> 
14:42:43.557 -> ELF file SHA256: ab29afbef
14:42:43.557 -> 
14:42:43.557 -> Rebooting...

Make note of the timestamp, during this crash it seems to be when the broken transmission is sent and Z2M shows -327 value, immediately after the reboot it successfully connects again and sends the correct temperature value
zigbee_temp_issue

There doesn't seem to be any consistency as it happens at random
graph

@phiphi060
Copy link
Author

phiphi060 commented Jan 10, 2025

@P-R-O-C-H-Y
Now with this two modifications zbTempSensor.reportTemperature(); zbTempSensor.reportHumidity();
the device run and wake up every 61 seconds and the values are only at the first start correct reported in Home Assistant ZHA, see log and image below. After thirst start the values are no more reported !
Another think is by me that the serial.print does not work (i have add while(!Serial); after Serial.begin(115200);
The ESP32H2 is connected under UART
Capture_Zigbee_Temp_Hum_Sensor_Sleepy

18:28:23.027 -> ESP-ROM:esp32h2-20221101 18:28:23.027 -> Build:Nov 1 2022 18:28:23.027 -> rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT) 18:28:23.027 -> SPIWP:0xee 18:28:23.027 -> mode:DIO, clock div:1 18:28:23.027 -> load:0x408460e0,len:0x11c4 18:28:23.027 -> load:0x4083cad0,len:0xe30 18:28:23.027 -> load:0x4083efd0,len:0x2dec 18:28:23.027 -> entry 0x4083cad0 18:28:23.212 -> [ 1][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42006316 18:28:23.246 -> [ 12][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x420062da 18:28:23.246 -> [ 24][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200629e 18:28:23.246 -> [ 35][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42006262 18:28:23.279 -> [ 47][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42006316 18:28:23.279 -> [ 58][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x420062da 18:28:23.279 -> [ 69][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200629e 18:28:23.313 -> [ 81][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42006262 18:28:23.313 -> [ 92][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DM (38) successfully set to 0x42002b3a 18:28:23.313 -> [ 104][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DP (39) successfully set to 0x42002b3a 18:28:23.346 -> [ 115][V][ZigbeeEP.cpp:20] ZigbeeEP(): Endpoint: 10 18:28:23.346 -> [ 130][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 23 successfully set to type UART_RX (2) with bus 0x4080f460 18:28:23.346 -> [ 141][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 24 successfully set to type UART_TX (3) with bus 0x4080f460 18:28:23.380 -> [ 152][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 26 successfully set to type USB_DM (38) with bus 0x40811484 18:28:23.380 -> [ 162][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 27 successfully set to type USB_DP (39) with bus 0x40811484 18:29:24.146 -> ESP-ROM:esp32h2-20221101 18:29:24.146 -> Build:Nov 1 2022 18:29:24.146 -> rst:0x5 (SLEEP_WAKEUP),boot:0xc (SPI_FAST_FLASH_BOOT) 18:29:24.146 -> SPIWP:0xee 18:29:24.146 -> mode:DIO, clock div:1 18:29:24.146 -> load:0x408460e0,len:0x11c4 18:29:24.146 -> load:0x4083cad0,len:0xe30 18:29:24.146 -> load:0x4083efd0,len:0x2dec 18:29:24.146 -> entry 0x4083cad0 18:29:24.147 -> [ 1][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42006316 18:29:24.147 -> [ 12][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x420062da 18:29:24.172 -> [ 24][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200629e 18:29:24.172 -> [ 35][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42006262 18:29:24.172 -> [ 47][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42006316 18:29:24.207 -> [ 58][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x420062da 18:29:24.207 -> [ 69][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200629e 18:29:24.207 -> [ 81][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42006262 18:29:24.251 -> [ 92][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DM (38) successfully set to 0x42002b3a 18:29:24.251 -> [ 104][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DP (39) successfully set to 0x42002b3a 18:29:24.251 -> [ 115][V][ZigbeeEP.cpp:20] ZigbeeEP(): Endpoint: 10 18:29:24.251 -> [ 130][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 23 successfully set to type UART_RX (2) with bus 0x4080f460 18:29:24.285 -> [ 141][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 24 successfully set to type UART_TX (3) with bus 0x4080f460 18:29:24.285 -> [ 152][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 26 successfully set to type USB_DM (38) with bus 0x40811484 18:29:24.285 -> [ 162][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 27 successfully set to type USB_DP (39) with bus 0x40811484 18:30:24.864 -> ESP-ROM:esp32h2-20221101 18:30:24.864 -> Build:Nov 1 2022 18:30:24.864 -> rst:0x5 (SLEEP_WAKEUP),boot:0xc (SPI_FAST_FLASH_BOOT) 18:30:24.864 -> SPIWP:0xee 18:30:24.864 -> mode:DIO, clock div:1 18:30:24.864 -> load:0x408460e0,len:0x11c4 18:30:24.864 -> load:0x4083cad0,len:0xe30 18:30:24.864 -> load:0x4083efd0,len:0x2dec 18:30:24.864 -> entry 0x4083cad0 18:30:24.896 -> [ 1][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42006316 18:30:24.896 -> [ 12][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x420062da 18:30:24.930 -> [ 24][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200629e 18:30:24.930 -> [ 35][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42006262 18:30:24.930 -> [ 47][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x42006316 18:30:24.964 -> [ 58][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x420062da 18:30:24.964 -> [ 69][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x4200629e 18:30:24.964 -> [ 81][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x42006262 18:30:24.998 -> [ 92][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DM (38) successfully set to 0x42002b3a 18:30:24.998 -> [ 104][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type USB_DP (39) successfully set to 0x42002b3a 18:30:24.998 -> [ 115][V][ZigbeeEP.cpp:20] ZigbeeEP(): Endpoint: 10 18:30:25.031 -> [ 130][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 23 successfully set to type UART_RX (2) with bus 0x4080f460 18:30:25.031 -> [ 141][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 24 successfully set to type UART_TX (3) with bus 0x4080f460 18:30:25.031 -> [ 152][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 26 successfully set to type USB_DM (38) with bus 0x40811484 18:30:25.077 -> [ 162][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 27 successfully set to type USB_DP (39) with bus 0x40811484

@phiphi060
Copy link
Author

@P-R-O-C-H-Y
Update
Now I saw that the temperature and humidity values ​​are only reported in Home Assistant ZHA if there is a variation.
After 3 hours of connection without temperature variation and without reporting, I varied the temperature and it was reported in Home Assistant.
The only think is that by me the serial.print does not work in Serial Monitor (i added while(!Serial); after Serial.begin(115200); without success)

So from my side, this issue can be closed 👍

Thank you for the big job 🥇

@tbrown2337
Copy link

@P-R-O-C-H-Y

Update

Now I saw that the temperature and humidity values ​​are only reported in Home Assistant ZHA if there is a variation.

After 3 hours of connection without temperature variation and without reporting, I varied the temperature and it was reported in Home Assistant.

The only think is that by me the serial.print does not work in Serial Monitor (i added while(!Serial); after Serial.begin(115200); without success)

So from my side, this issue can be closed 👍

Thank you for the big job 🥇

I don't think serial would have anything to do with this problem

@IgorMilavec
Copy link

The Zigbee_TemperatureSensor example also does not work for me. Using H2 and ZHA. It seems that the only time the temperature is updated from the -327.7 to an actual value is when I restart the ZHA. After that the value is never updated until I restart the ZHA again.
Test scenario:

  1. Build and upload the sketch to H2
  2. Add the device to ZHA
  3. Temp in HA reads -327.7
  4. Temp in HA is not updated however long you wait
  5. Restart ZHA
  6. Temp in HA reads the actual temperature reported by H2
  7. Temp in HA is not updated however long you wait

Nothing interesting in the logs, all fine there.

@michapr
Copy link

michapr commented Mar 10, 2025

Hi,

try to remove/include the device again:

    Power off the ESP32
    Remove device from Z2M with force remove option enabled
    Restart Z2M addon(I have found this is very important)
    Erase flash of ESP32 and flash it again. Be sure that you have selected Zigbee ED in tools and Zigbee 4MB partition.

And be sure that the option "Erase all flash before sketch upload" is enabled

@P-R-O-C-H-Y
Copy link
Member

P-R-O-C-H-Y commented Mar 10, 2025

Also there is a pending fix #11066 if you are using latest version or master branch. with 3.2.0-rc2 it will be fixed.
For now if you can try with 3.1.2 you should be good if this is the case of the issue.

@Jason2866
Copy link
Collaborator

Closing since a PR to fix has been merged

@IgorMilavec
Copy link

I have tested with 3.2.0-rc2 and it does not solve the issue.

@michapr
Copy link

michapr commented Mar 18, 2025

@IgorMilavec Have you tried all the steps above? And have you enabled the "Erase Flash" option before flashing the device?
I really haven't this problems with same device.

@P-R-O-C-H-Y
Copy link
Member

@IgorMilavec Also what we have find out in latest 2025.3.x versions of HomeAssistant, that after adding the device, you must hit the reconfigure button. Otherwise the reporting will not be configured properly. On 2025.2.x it works normally after the 1st connection. @michapr Have you seen this behavior also?

@michapr
Copy link

michapr commented Mar 18, 2025

@michapr Have you seen this behavior also?

@P-R-O-C-H-Y - haven't updated in this time my secondary HA instance... ;) My main instance is running with Z2M and HA using MQTT

@IgorMilavec
Copy link

@P-R-O-C-H-Y Hitting Reconfigure did the trick, thank you! Do you know if this is arduino-esp32 issue or ZHA issue? Is there a GH issue open for this in ZHA?

@P-R-O-C-H-Y
Copy link
Member

P-R-O-C-H-Y commented Mar 19, 2025

@P-R-O-C-H-Y Hitting Reconfigure did the trick, thank you! Do you know if this is arduino-esp32 issue or ZHA issue? Is there a GH issue open for this in ZHA?

I don't think this is issue with the Zigbee library, as It works with 2025.2.5 and does not with 2025.3.3 where device needs the "reconfigure". I have opened an Issue in HomeAssistant Core: home-assistant/core#140880

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Libraries Issue is related to Library support. Area: Zigbee Issues and Feature Request about Zigbee Status: In Progress ⚠️ Issue is in progress Status: Test needed Issue needs testing
Projects
None yet
Development

No branches or pull requests