Hello
I’m new to Openhab but i’ve found it intriguing how configurable it is and defiently like it
I’ve although ran into a problem i hope you guys can assist me with in respect to “Exec-bindings”
A bit about my project:
- I’m running OH2 (ver 2.2.0) on my Synology 218+
- I’ve installed OH2 through the via https://docs.openhab.org/installation/synology.html
– As this is a manual install via synology i do not get a “service” running, at least what i can track… but OH2 functions without problems.
– When i have to restart the OH2 it’s a bit of pain as i need to restart the entire NAS… - I’ve already got various widgets to work in HABPanel so it’s up and running…
My problem:
- I want to take data from my own MySQL database (No MySQL persistent bindings is not an option, i want it from my external DB), in this case the simply the latest temperature
- I’ve found out the best way to do this must be via exec bindings… i hope…
- I’ve created a php script that works with no problems if I use it through the web browser of the Synology or via putty ssh. My return string from the php script is JSON and an example would be: [{“temperature”:“22.3”}]
– I do need to write php56 test.php (in putty) before it works though… using php test.php only, it will fail on mysqli… (which is kind of funny as if i write php -v i get the 5.6 version…) - Next step is that i’ve used exec binding via Things in the following way (My test.things):
Thing exec:command:TempOutsideScript [command="php ./conf/scripts/TempOutside1Latest.php", transform="Temperature [JSONPATH($.temperature):%.1f °C]", interval=15, timeout=5]
– I’ve also tried:
Thing exec:command:TempOutsideScript [command="php ./conf/scripts/TempOutside1Latest.php", transform="REGEX((.*?))", interval=15, timeout=5]
– I’m pretty sure this is where my issue is, but i simply dont get how to test if this “thing call” works?
– It doesnt show up in PAPER UI -> Configuration -> Things (but perhaps it shouldn’t?)
– How do i determine if the path is correct?
– How do i determine if the “transform part” is correct?
– How do i determine if any value is coming from the command?
- Afterwards the next step is to put in into items (test.items):
Number OutsideTemp1 "Temperature [%.2f °C]" {channel="exec:command:TempOutsideScript:output"}
- Finally i added a template widget to the HABPanel which just shows the value for now, which returns “NULL”:
{{itemValue('OutsideTemp1')}}
The event.log only shows that:
- Link ‘OutsideTemp1-exec:command:TempOutsideScript:output’ has been added.
The openhab.log shows (which means it is runnung…):
- 2018-02-18 17:43:29.570 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘test.things’
- 2018-02-18 17:54:16.961 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘test.items’
I hope you guys can help me, or tell me if i’m doing some basic stuff wrong as i’m new too this.
If you need further information please let me know.