I’m struggling with a problem which i can relate to OpenHAB, but i’m not able to solve it. I’ve been searching the internet for a solution, but unable to find one. I have a DHT22 temp sensor connected to a NodeMCU, which communicates via Raspberry Pi 3 running Mosquitto and OpenHAB. All is working well and temperature+humidity are displayed correctly in Mosquitto and OpenHAB at room temperatures.
Yesterday i moved one DHT22+NodeMCU outside for outdoor temps+humidity. Temperature dropped from room temp to outside temp, but got stuck at ~10°C in OpenHAB while temperature outside was around 0°C. Humidity values were still being updated, being above 10%.
Since this moment i checked the following:
I checked multiple DHT22 sensors at room temp, but all displayed about the same values: DHT22 is likely not the problem
I cooled the DHT22 sensor to ~3°C while connected to the serial monitor of Arduino IDE: the serial monitor displayed the temperature correctly, being lower than 10°C. Even humidity dropped briefly to about 7%, while OpenHAB stopped updating at 10%: DHT22 is definitely not the problem
I logged into my RPi, opened a terminal and subscribed to the outside temp topic: MQTT displayed the same values as the serial monitor in Arduino IDE: MQTT is not the problem
When temperature and humidity reached values above 10 (°C or %) OpenHAB picked up the correct values again automatically
i checked the format of the variables in OpenHAB, being “Temperatuur [%.1f °C]” and “Luchtvochtigheid [%.1f %%]”, but this seems to be the appropriate annotation. I even changed them temporarily to %s, but without result for the values below 10 (°C or %)
So i’m guessing the problem lies within OpenHAB, but i’m out of options. Any help would be more than welcome! Thanx in advance.
Do you see the correct values, 10 °C, or nothing at all in events.log when the the temp is below that threshold?
If you change the Item to a String Item and just print the value being read by OH, do you see anything that might point to a parsing error when the temp gets below the threshold? Common problems are leading or trailing white space, using a , instead of . for the decimal place, extraneous characters, etc.
There is nothing about the code that would cause OH to treat the numbers below 10 any differently than any other number so the problem almost has to be something different about the String that is being sent to OH when the number drops below 10.
Variable " *tempC" is of type “Char”, as is necessary for the client.publish() input. Should i add code to convert tempC for <10 values like this?:
“tempC = dtostrf(event.temperature, 4, 2, msgBuffer);”
(I haven’t got the time to check it now, but i will try this code tomorrow. If my english is confusing (i’m dutch) please let me know )
Use a String Item instead of a Number Item and use [%s] in the label. That will show you EXACTLY what is being received and it will show you whether you are receiving values below 10 or not. If you do receive such values when it is a String it means there is something wrong with the value sent by the arduinos that OH can’t parse into a Number.
Don’t worry about that. I’d venture to say non-native English speakers are the majority on this forum.