Hello
I’m having a trouble reading temperature from DHT22 sensor(script in running fine in command line), what i’'ve done so far:
Items are named home.items
Number Temp “Temperature [%.1f °C]” {exec="<[/usr/bin/python /etc/openhab2/scripts/DHT22.py:10000:REGEX((.*?))]"}
script is named DHT22.py(script is working 100%)
import Adafruit_DHT
sensor = Adafruit_DHT.DHT11
pin = 4
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
print(’{0:0.2f}’.format(temperature))
else:
print(‘Failed to get reading. Try again!’)
No but openHAB itself and VSCode with the openHAB extension can. If you don’t see any errors in openhab.log when it loads the file, there are no syntax errors.