Weatherstation python script make me crazy

Hey Guys,

i have installed a new version of openhab regarding a change in my system for mostly ma Gardening stuff. But anyway… during the new installation now the Weatherstation doesn’t works anymore and guess i dont find the error but im sure its a layer 8 issue.

Error-Message:
14:01:24.153 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule ‘Weatherstation Humidity’: For input string: “Traceback (most recent call last):
File “/etc/openhab2/scripts/weatherstation.py”, line 27, in
humidity, _ = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/common.py”, line 94, in read_retry
humidity, temperature = read(sensor, pin, platform)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/common.py”, line 81, in read
return platform.read(sensor, pin)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/Raspberry_Pi_2.py”, line 34, in read
raise RuntimeError(‘Error accessing GPIO.’)
RuntimeError: Error accessing GPIO.
Traceback (most recent call last):
File “/etc/openhab2/scripts/weatherstation.py”, line 27, in
humidity, _ = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/common.py”, line 94, in read_retry
humidity, temperature = read(sensor, pin, platform)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/common.py”, line 81, in read
return platform.read(sensor, pin)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/Raspberry_Pi_2.py”, line 34, in read
raise RuntimeError(‘Error accessing GPIO.’)
RuntimeError: Error accessing GPIO.”
14:01:33.763 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule ‘Weatherstation Humidity’: For input string: “Traceback (most recent call last):
File “/etc/openhab2/scripts/weatherstation.py”, line 27, in
humidity, _ = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/common.py”, line 94, in read_retry
humidity, temperature = read(sensor, pin, platform)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/common.py”, line 81, in read
return platform.read(sensor, pin)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/Raspberry_Pi_2.py”, line 34, in read
raise RuntimeError(‘Error accessing GPIO.’)
RuntimeError: Error accessing GPIO.
Traceback (most recent call last):
File “/etc/openhab2/scripts/weatherstation.py”, line 27, in
humidity, _ = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/common.py”, line 94, in read_retry
humidity, temperature = read(sensor, pin, platform)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/common.py”, line 81, in read
return platform.read(sensor, pin)
File “/usr/local/lib/python3.5/dist-packages/Adafruit_DHT-1.4.0-py3.5-linux-armv7l.egg/Adafruit_DHT/Raspberry_Pi_2.py”, line 34, in read
raise RuntimeError(‘Error accessing GPIO.’)
RuntimeError: Error accessing GPIO.”

Run Script as openhab user:
pi@openhabpi : /etc/openhab2/scripts $ ./weatherstation.py temperature
25.100000381469727

For the Pressure its work fine, but except temperature and humidity

I have use this kind of tutorial:

regards
Wingdu

Please How to use code fences for code and logs.

The root error in the stack trace is that the Python script does not have permission to access the GPIO pins. So the possible problems are:

  • the openhab user doesn’t have permission to read/write to any GPIO pins. On a stock Raspbian this is addressed by adding the openhab user to the gpio group

  • the openhab user doesn’t have permission to read/write to the specific GPIO pins the DHT is connected to, check the permissions on those device files

  • the DHT is broken or the wires are broken

Hey,

thanks Rich. But i have recopied my backuped files and now its works… dont looks like a permission issue… with sudo -u openhabe was it possible to readout the pins really strange…

but thanks a lot!!