openHAB 2.4.0 on Raspberry Pi 3
1" OLED display connected via I2C
so I built a controller for my heating unit to access it from multiple devices.
However I still wanted to have some good old buttons and a small display to set the temperature and check the current temperature.
The buttons are connected to the Raspi GPIOs with which I can control the temperature and switches (control on/off etc). So the the manual interface to openHAB is all done physically. The display is only to display the current values.
I wrote a python script that reads out the current values through REST API every 1.5s (5 values in total) and shuts off after a certain time. Now I want to add a rule that starts the python script from within openHAB after certain actions that should trigger the script.
I successfully started a script to read out the DHT22 values but cannot get it working for the display.
rule "Display-Prozess starten" when Item display_start received command ON then executeCommandLine("python /etc/openhab2/scripts/oled.py") logInfo("Log","Displaystart") end
I also tested putting in a test-String for some more debugging insight, but it does not really bring me any further:
rule "Display-Prozess starten" when Item display_start received command ON then var String test = executeCommandLine("python /etc/openhab2/scripts/oled.py") logInfo("Log","Displaystart: " + test) end
[lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine ‘python /etc/openhab2/scripts/oled.py’
[g.eclipse.smarthome.model.script.Log] - Displaystart: null
I could not find really much about the parameters for executeCommandLine so my next try was to use the Exec Binding. But again I was not successful and also could not run the script.
Now I basically have to question:
- How can I run the python script for the display refresh from within openHAB?
- Does it even make sense to do it this way or is there a better / easier way to do it with another approach?