Josar
(Josar)
February 14, 2018, 12:03pm
8
Basically first get the script to execute in command line without sudo, find out which permissions you need and add openhab to the specific group. Or enable sudo for this one command, which would be the last solution.
Additional add the shebang to your script and use it like this.
sudo u- openhab /etc/openhab2/scripts/pumpenreset.py
This is a example thread to show how the exec binding 2.x works with detailed explanations.
This tutorial only works since openHAB 2.3.0 Build #1212.
I set up a fresh installation of “Raspbian GNU/Linux 9 (stretch)” and installed OpenHAB just followed my own thread and found some more information i missed at the first time. It is based on the Tutorial from here .
First make sure you connect your transmitter with the Raspberry like follows. Have a look at the RPI pinout .
Pin ATAD Data to 11 - …
There are situations where you want to use the Exec Binding to trigger something. Sometimes you need the sudo privilege to do this. I would rather try some group specification to reduce the user rights to a minimum, but here is how i got openHAB to be able to execute sudo.
Try executing a command as openhab
sudo -u openhab sudo -l
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of other…
@Mando
have you copied the files to the python distribution?
Please list
ls -l /usr/local/lib/python2.7/dist-packages/
try to execute python from the environment.
/usr/bin/env python2
When this works add the shebang to your script, first line.
#!/usr/bin/env python2.7
import sys
import Adafruit_DHT
sensor = Adafruit_DHT.DHT22
pin = 18
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
print('{0:0.2f}'.format(temperatu…