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

Open
1 task done
phiphi060 opened this issue Nov 13, 2024 · 29 comments
Assignees
Labels
Area: Libraries Issue is related to Library support. 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);
}

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

@phiphi060 are you using UART or USB port on the devkit?

@phiphi060
Copy link
Author

@P-R-O-C-H-Y I am using USB Port on the devkit. I don't have an USB --> UART interface

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

@phiphi060 So can you please also set this option in the Arduino IDE->Tools menu:
USB CDC on Boot -> Enabled
Let me know if you are getting any logs then, don't forget to keep the debug level on verbose.

@phiphi060
Copy link
Author

phiphi060 commented Nov 22, 2024

@P-R-O-C-H-Y Now i have installed the driver for the CP210x USB to UART Bridge and connected the ESP32H2 over UART.
Here the Log File at the Flash Process
Log_flash_Zigbee_Temp_Hum_Sensor_Sleepy.txt
and here the Log after joining Home Assistant
Log_Zigbee_Temp_Hum_Sensor_Sleepy_join_Home_Assistant.txt
This Log repeat endless !
(Tested with #10623 modifications but no change)

@michapr
Copy link

michapr commented Nov 23, 2024

yes, right, it is not working. Can confirm it for ESP32C6, even with last PR #10636 no changes, is rebooting...

@Nawor3565
Copy link

Somehow managed to not see this thread before making #10644. I was able to provide some more detailed logs in that issue that would probably be of help.

@michapr
Copy link

michapr commented Nov 24, 2024

@Nawor3565
Please check #10612 - I think this is all the same issue.

Device does not like to reconnect after reboot/restart in most cases.
Here you find a lot of logs...

I think if device will stable join again after reboot / restart, then the sleeping device also will work

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

@phiphi060 you can give a try with changes from #10651 :)

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. Status: In Progress Issue is in progress Status: Test needed Issue needs testing
Projects
None yet
Development

No branches or pull requests

5 participants