-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Comments
@P-R-O-C-H-Y both number represent float from 16bit 0xFFFF divided by 100. One signed and one unsigned. |
Hi @phiphi060, those values are default. So it. looks you never send the updated values. Can you please set debug level to "Verbose" and paste log from the device? |
Hey Prochy, My Home Assistant run as Stand-Alone HA OS on a Raspberry Pi5 8GB with SSD 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 exemple Sketch "Zigbee_Temperature_Sensor" from Library august 2024 run perfectly but this sketch has no humidity Sensor ! |
When i set the battery level to 80 % this is correct reported in Home Assistant :) |
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. 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 :) |
Hi, 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.
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. 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) |
@P-R-O-C-H-Y
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):
|
Additional debug log:
If you need longer log file or something else tell me.... BTW: tested also with latest RC - same result
|
@phiphi060 I have seen that there maybe a problem with battery powered devices, will open a new issue (#10612). |
@michapr |
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. |
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. |
I have add humidity cluster to the temperature sensor example code, it will work fine (without Battery level and without deepsleep). Reporting is working |
@phiphi060 are you using H2 or C6? |
@phiphi060 Can you try to test with the changes from this PR #10623 ? Thank you |
@P-R-O-C-H-Y I'm using ESP32H2 |
So after first reboot (waking up from deep sleep), the chip is always rebooting? |
@P-R-O-C-H-Y I have tested with the PR#10623 modifications but the problem stay the same : |
@phiphi060 please set debug level to Verbose in the Arduino IDE Tools menu. Flash again, and post the logs then. |
@P-R-O-C-H-Y I have set the debug level to Verbose but i don't see more in serial monitor. // Copyright 2024 Espressif Systems (Shanghai) PTE LTD /**
#ifndef ZIGBEE_MODE_ED #include "Zigbee.h" #define BUTTON_PIN 9 //Boot button for C6/H2 ZigbeeTempSensor zbTempSensor = ZigbeeTempSensor(TEMP_SENSOR_ENDPOINT_NUMBER); /************************ Temp_hum sensor *****************************/ /********************* Arduino functions **************************/ Serial.begin(115200); // Init button switch // Optional: set Zigbee device name and model // Set minimum and maximum temperature measurement value (10-50°C is default range for chip temperature measurement) // Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C) // Add humidity cluster to the temperature sensor device with min, max and tolerance values // Add endpoint to Zigbee Core // When all EPs are registered, start Zigbee in End Device mode // Start Temperature sensor reading task // Set reporting interval for temperature measurement in seconds, must be called after Zigbee.begin() void loop() { |
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. |
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. |
@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) Please check at first the settings - "Erase All Flash before..." must be enabled,
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. |
@miroslavpetrov
This is working for me stable. @P-R-O-C-H-Y
In result humidity value will not be reported... |
@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:
|
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: This is what the serial log monitor tells about the processing:
|
@estegewr Looks like your device wasn't configured full at Zigbee Gateway. 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. |
@estegewr Try this sequence:
I have added a SHT-C3 TH sensor to one C6 and it has been working great for a few days now. |
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 👍🙏. |
@michapr @miroslavpetrov @estegewr @phiphi060 Can we close this issue? Seems to be solved to me :) |
@P-R-O-C-H-Y I think so |
@P-R-O-C-H-Y There is one detail inside using
|
After some testing I experiences some weird behaviour:
I also recognize sometimes trouble while connected to the ZigBee hub:
|
@P-R-O-C-H-Y
|
@P-R-O-C-H-Y 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 |
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.
Nothing interesting in the logs, all fine there. |
Hi, try to remove/include the device again:
And be sure that the option "Erase all flash before sketch upload" is enabled |
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. |
Closing since a PR to fix has been merged |
I have tested with 3.2.0-rc2 and it does not solve the issue. |
@IgorMilavec Have you tried all the steps above? And have you enabled the "Erase Flash" option before flashing the device? |
@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? |
@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 |
@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 |
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
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: