have some issues with executing a bash script to get dht22 sensor values.
I get the following output in OH:
Failed to acces lock file: /var/run/dht.lock error: Permission denied
I checked the script in the shell. With sudo it worked fine.
Probably is a raspberry problem? Maybe someone has a hint for me to solve this problem.
Or can I call the script with sudo from OH?
If you installed using apt-get (as you should have) OH is running as the openhab user. That means the openhab user must have permission to read and write to /var/run/ and /var/run/dht.lock
You can but you have to add the openhab user to sudoers and configure it so it doesn’t not require a password to run sudo.
thanks for the answer. Yes I installed OH using apt-get.
To solve the problem I tried:
sudo chmod +x /var/run/dht.lock
sudo chown openhab: /var/run/dht.lock
Now my response string is:
WiringPiSetup: Must be root.
Ok, I am rather new to this linux stuff (obviously).
May I ask for a new hint?
I’ve no exhausted with wiringpi so I’ll be off limited help but I think this means you need to run the script root. This means you need to add openhab to sudoers and configured to not need a password.