zigbee-plant-sensor
zigbee-plant-sensor copied to clipboard
Temperature readings wrong around with negative temperatures
I am experiencing a strange behaviour with the reported temperature values in Home Assistant via ZHA integration.
Currently we have negative temperatures outside but the reported temperatures are not. The chart probably best describes the behaviour.
At first I suspected a signed/unsigned integer error but the source code seems fine to me. Is there any setting with the SHTC3 sensor which might cause this?
I can rule out a defective device since all three sensor which I placed outside are showing the same behaviour.
As I am currently setting up some zigbee plant sensors (thanks for this great project by the way!) I tried to reproduce the situation shown above. While I can't confirm the weird behavior of the temperature rising, mine also have strage behaviour around the 0°C mark. When placed outside they move down to just below the 0° mark quite quickly and stay there (moving between -0.3 and -0.7), even though it is actually around -8°C outside.
@oleo65 your are using ZHA I assume? @bbadaboom what are you using?
I've place one sensor in the freezer and for me it works fine as you can see in the image (it is not the best freezer). Did you build the image yourself or did you use the prebuild file in the release section?
At first I did not expect people to place them outside so I did not optimize the code for large temperature fluctuations. For example the ADC is not re-calibrate when the temperature changes more that 10 degrees. Keep in mind that the clock might also become more inaccurate at lower temperatures, so the battery life might drop when placed outside.
Yes I use the Home Assistant ZHA integration and compiled the firmware myself.
Your chart shows exactly the same strange behavior around 0 degrees and then dropping further, also below 0. That is exactly the issue I was describing above. The temperature readings are off by a few degrees then, at least way out of the tolerance limits of the SHTC3 sensor.
With a different firmware on the identical hardware I do not experience this issue.
You’re right, I thought it was because I did open the fridge once, but apparently it is the same issue. I’ll investigate it feather, hopefully it is something that can be fixed easily.
After some digging I found a bug in the SHTCx driver from zephyr. I've added a quick fix in the main repo. Could someone verify if this solves the issue?
I might be able to try tomorrow. Thanks for researching this.
I just put a freshly flashed parasite in the freezer and it went down to -20°C. So I would say this is resolved.
Haven't managed to compile my own hex file yet so I can't test at the moment. (Hoping to get there some time around christmas, but so far have no experience with zephyr and I kinda want to know what I am doing, not just blindly installing everything and compiling... ;))
Sorry for the delay due to the holidays, but here is a hex file you can use to test. Let me know if this solves your issue. https://drive.google.com/file/d/1I_ztPCfgGjZiIEiXSXvrhQuPan2Sl1yL/view?usp=sharing