How can I get data of DHT22 that connected to GPIO on Raspberry running Openhab

Hi @daskalov_daskalov,
Above AdafruitDHT.py, it will return both humidity and temperature. But I only use temperature
If you want to get humidity. you must replace this line

print('{0:0.2f}'.format(humidity))

instead of

print('{0:0.2f}'.format(temperature))

or you can get both by:

print('Temp={0:0.1f}*  Humidity={1:0.1f}%'.format(temperature, humidity))
1 Like