In the control of paper it sends the output:
ERROR: Cannot read configuration file: dialEye.conf
dialEye.conf is a conf file located in the same folder as dialEye.py
How shall I configure the thing such that it can execute the phyton scrpt?
OH permissions feels like a dark art to me. It resets the file permissions every time it starts so I am in the process of moving all my scripts out of the conf directories so I can control this a bit better. Your files don’t appear to be executable. Perhaps that might be the issue.
Try putting the files in another folder (away from the OH installation) and allow them to executable with chmod +x location/of/dialEye.py && chmod +x location/of/dialEye.conf
This is a good place to start on setting file permissions in linux. It’s what I have been reading while i figure them out myself, heh.
I put the files to /home/openhabian and made the chmod, and changed the command in the thing. Still no change.
It seems to be able to execute the dialEye.pp (as if change the path in the thing it writes "python: can’t open file ‘home/openhabian/watermeter/dialEye.py’: [Errno 2] No such file or directory python: "; with the correct path it writes “ERROR: Cannot read configuration file: dialEye.conf”).
The conf/scripts folder is not and never was intended as a place to put shell scripts. That folder is intended for openHAB Scripts. The start scripts do change the permissions on all the conf folders so a better place to store your shell scripts is ~openhab which maps to /var/lib/openhab2 in a standard apt-get installed deployment.
The python script is expecting there to be a dialEye.conf in the folder ./. You probably need to figure out if there is a way to pass the path to the dailEye.conf file in the call to the script.
need some help while stuck in displaying the temperature using dht11 sensor
got this error
2020-03-21 23:33:12.205 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute ‘python /etc/openhab2/DHT11_Python/dht11_example.py’, but it is not contained in whitelist.
but when I ran the code python /etc/openhab2/DHT11_Python/dht11_example.py from ssh it will return a correct value
please find attached all config done
your code goes here
items
String Weather_Temperature "Temperature [%.2f C]" { channel="exec:command:dht11:exit" }
things
Thing exec:command:dht11 [ command="python /etc/openhab2/DHT11_Python/dht11_example.py", interval=5, autorun=true ]
sitemap
Frame label="HTemperature"{
Text item=Weather_Temperature label="Home Temperature" icon="temperature"
python code
import RPi.GPIO as GPIO
import dht11
import time
import datetime
# initialize GPIO
GPIO.setwarnings(True)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# read data using pin 14
instance = dht11.DHT11(pin=17)
try:
while True:
result = instance.read()
if result.is_valid():
print("%-3.1f C" % result.temperature)
exit()
except KeyboardInterrupt:
print("Cleanup")
GPIO.cleanup()
hey rossko57
yes it is contained but I don’t know if it is done in the right way.
created a misc folder (cd /etc/openhab2/misc/ ) and inside it exec.whitelist
inside the exec.whitelist : python /etc/openhab2/DHT11_Python/dht11_example.py