Running a python script by the exec binding

I have very limited knowledge in linux and home automation.

I have found a phyton script that I have located in the folder etc/openhab2/scripts/watermeter

I want to execute:
python -u meter “

when I execute this in PuTTY it generates a number

I have installed the Exec binding and made a thing in Paper with the command:
python /etc/openhab2/scripts/watermeter/ -u meter “

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

How shall I configure the thing such that it can execute the phyton scrpt?

What are the permissions on both files?

-rw-rw-r-- 1 openhabian openhabian 7341 Jun 5 23:25 dialEye.conf
-rw-rw-r-- 1 openhabian openhabian 38853 May 31 21:44

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/ && 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/’: [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.

I am sorry, but my knowledge is unfortunately a bit too limited to follow all details.
What I did was to copy the files ( into /var/lib/openhab2/watermeter, and changed the command in the thing in Paper to python /var/lib/openhab2/watermeter/ -u meter “” -> was the same result as before "ERROR: Cannot read configuration file: dialEye.conf"
If I executed the command -u meter ""
when i was in the folder /var/lib/openhab2/watermeter it worked and returned a number

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.

Thanks, it is solved. Correct command line is:
python /var/lib/openhab2/watermeter/ -f /var/lib/openhab2/watermeter/dialEye.conf -c /var/lib/openhab2/watermeter/docs/watercal.jpg -u meter

Is this script working well on your installation?

You have a webcam which makes photos of the watermeter and the script reads out the current values?

Was ist a big deal to configure this all to get it running or is it very simple?


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/’, but it is not contained in whitelist.

but when I ran the code python /etc/openhab2/DHT11_Python/ from ssh it will return a correct value
please find attached all config done

your code goes here

String Weather_Temperature "Temperature [%.2f C]" { channel="exec:command:dht11:exit" }


Thing exec:command:dht11 [ command="python /etc/openhab2/DHT11_Python/", interval=5, autorun=true ]


 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

# read data using pin 14
instance = dht11.DHT11(pin=17)

        while True:
            result =
            if result.is_valid():
                print("%-3.1f C" % result.temperature)

except KeyboardInterrupt:

You could search this forum for recent postings about this message.

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/

but also didn’t worked