Error Exec and dht11

Hi,
I try to configure a DHT11 Temperature and Humidity Sensor with exec and python.
But i just get a Error
Thing

Thing exec:command:temp [command="bash /home/openhabian/Adafruit_Python_DHT/examples/dht11.sh", interval=60]

dht11.sh:

#!/bin/bash
DHT_DEVICE=11
GPIO_PIN=13
cd /home/openhabian/Adafruit_Python_DHT/examples/
eval `./AdafruitDHT.py $DHT_DEVICE $GPIO_PIN | sed -e 's/*C//g' | sed -e 's/%//$

echo "$Temp"
exit 0

item

String temp_wohnzimmer "Wohnzimmer Temperatur: %s°C" <temperature> {channel="exec:command:temp:output"}

And the Error:

/usr/lib/python2.7/dist-packages/pkg_resources.py:1049: 
UserWarning: /var/lib/openhab2/.python-eggs is writable by group/others and 
vulnerable to attack when used with get_resource_filename. Consider a more secure 
location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
 warnings.warn(msg, UserWarning) Traceback (most recent call last): File "./AdafruitDHT.py", 
 line 41, in <module> humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) 
 File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 94, in read_retry 
 File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 81, in read 
 File "build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2.py", line 34, 
 in read RuntimeError: Error accessing GPIO. /usr/lib/python2.7/dist-packages/pkg_resources.py:1049:
  UserWarning: /var/lib/openhab2/.python-eggs is writable by group/others and
   vulnerable to attack when used with get_resource_filename. Consider a 
   more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
    warnings.warn(msg, UserWarning) Traceback (most recent call last):
     File "./AdafruitDHT.py", line 41, in <module> humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) 
     File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 94, in read_retry 
     File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 81, in read 
     File "build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2.py", line 34, 
     in read RuntimeError: Error accessing GPIO.

I hope you can help me.
Thank you!

Make sure the openhab user has permission to read/write the GPIO. On a standard raspbian that is as simple as adding the openhab user to the gpio group. I don’t know if openHABian has that group though.

Thank you!
Now it works!
To ignore the Python warning i added:
import warnings
warnings.filterwarnings(“ignore”)

to the Adafruit_DHT.py

Now i am Happy :slight_smile: