Hi,
I am trying to persist my data using influxdb. For this i have a python script which has arguments, and it’s not working for me when the script is triggered by rules.
In my rule file i have this line of code:
executeCommandLine("python /opt/openhab2/conf/scripts/influxDBWrite.py \"light_test,region=east value=\\\""+Switch2.state.toString+"\\\"\"")
Then, i can see in the logs the next:
executed commandLine 'python /opt/openhab2/conf/scripts/influxDBWrite.py "light_test,region=east value=\"OFF\""'
How can i pass parameters through executeCommandLine for Python?
it should isn’t enough in that case, please chown to the openhab user and try - or put some action in the python script which indicates, it was called in the first place. To be really sure, try to
make sure, which Linux-User openHAB2 is running and chown to this one and try to start the script
make sure this openhab user is also allowed to use whatever connection to the influx-db you’re using within the script
this won’t get into your logs anyway - you have to have something that has impact outside of OH2 to be sure.
But I still think, you don’t have the permission for the user running your openhab to execute the script in the first place.
still, even if the script owner itself is the user openhab it could not be enough for OH2 to start the script
to be fair, I mixed the commands…
To be 100% sure, you don’t have to chown the file - but to start the file in the user for openhab to execute. If the user is openhab (see 1.), then please try:
su openhab
python /opt/openhab2/conf/scripts/influxDBWrite.py "light_test,region=east value=\"OFF\""
after the first command, you should see the prompt like this, which indicates you changed to the user openhab:
oh. sorry - I figured from your path, that you didn’t use openHABian but a manual installation. Either way, to change to the user, you have to activate the user “openhab”, which doesn’t have a shell at the moment.
or you have a look in the linux system logs for some errors regarding the failed(?) attempt to start your script - and place something in the script (generate an empty file with a current timestamp?) to see, if it is started after all…