I was just wondering if anyone has any experience with calling external scripts from openHAB’s rules and scripting language. For example possibly having a rule which uses the openHAB timers to call a python script every X seconds. If not is there anyway to execute shell commands from openHAB’s scripting language. I am currently running openHAB on the raspberry pi with the latest version of openhabian.
I have seen things about Jython on the openHAB website but haven’t looked too much into it. The scripts I am currently running now are in python 3 but I would like to try to integrate them into openHAB so it can handle more of the scheduling of scripts so I don’t have to implement it myself in the python scripts.
Thanks for the resources Scott. I have been messing around with the executeCommandLine Action and have got it running external scripts that I have in python3. The code looks something like this in case anyone else was interested and is located in the rules/ directory of openHAB. The permissions on the python files also had to be changed to give openHAB access to them.
var result1 = executeCommandLine("python3 /home/openhabian/Environments/env_1/openHAB_Proj/bin/main.py")
I am going to see how this works out with just calling them as I have my own python packages that I created so might be a bit of work in it, thanks for the offer though. If i do end up having to convert them I’ll probably ask you for few pointers if thats ok?