Openhab is already in the group gpio. Here is my result:
Traceback (most recent call last):
File "/opt/openhab2/conf/scripts/hum.py", line 11, 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 80, in read
File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 51, in get_platform
File "build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2.py", line 22, in <module>
File "build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2_Driver.py", line 7, in <module>
File "build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2_Driver.py", line 4, in __bootstrap__
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1198, in resource_filename
self, resource_name
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1710, in get_resource_filename
self._extract_resource(manager, self._eager_to_zip(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1740, in _extract_resource
self.egg_name, self._parts(zip_path)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1265, in get_cache_path
self.extraction_error()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1245, in extraction_error
raise err
pkg_resources.ExtractionError: Can't extract file(s) to egg cache
The following error occurred while trying to extract file(s) to the Python egg
cache:
[Errno 13] Permission denied: '/home/openhab'
The Python egg cache directory is currently set to:
/home/openhab/.cache/Python-Eggs
Perhaps your account does not have write access to this directory? You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.
Update: The folder didn’t exist. I create it and change the permission for openhab to 755. Now I can use the script as the user openhab. Unfortunately its still not working on the panel. Log says:
==> /opt/openhab2/userdata/logs/openhab.log <==
2018-02-12 19:06:28.637 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Exec [ERROR]: 'Traceback (most recent call last):'
2018-02-12 19:06:28.648 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Exec [ERROR]: ' File "/opt/openhab2/conf/scripts/temp.py", line 11, in <module>'
2018-02-12 19:06:28.649 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Exec [ERROR]: ' humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)'
2018-02-12 19:06:28.651 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Exec [ERROR]: ' File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 94, in read_retry'
2018-02-12 19:06:28.653 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Exec [ERROR]: ' File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 81, in read'
2018-02-12 19:06:28.654 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Exec [ERROR]: ' File "build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2.py", line 34, in read'
2018-02-12 19:06:28.656 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Exec [ERROR]: 'RuntimeError: Error accessing GPIO.'
2018-02-12 19:06:28.660 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Transformed response is 'Traceback (most recent call last):
File "/opt/openhab2/conf/scripts/temp.py", line 11, 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.
Traceback (most recent call last):
File "/opt/openhab2/conf/scripts/temp.py", line 11, 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.'