Strange behaviour when using exec binding

Hi there,

I’m currently migrating my config from OH1 to OH2 (snapshot). There is something I don’t understand, or maybe there is something wrong with the current snapshot.
I started to migrate some shell scripts to OH2 that were running fine with OH1. The ping.sh command is just executing a ping to the google dns and returning the average ping value.

things/net_ping.things

Thing exec:command:net_ping [command="/usr/bin/sudo /opt/openhab/bin/ping.sh", transform="REGEX((.*?))", interval=60, timeout=10, autorun=true]

items/net_ping.items

Number NET_PING "Ping [%.1f ms]" { channel="exec:command:net_ping:output" }
Number CHART_PERIOD

sitemaps/default.sitemap

sitemap default label="Main Menu" {

Text item=NET_PING {
   Switch item=CHART_PERIOD label="Zeitspanne" mappings=[0="Stunde", 1="Tag", 2="Woche"]
   Chart item=NET_PING period=h refresh=300 visibility=[CHART_PERIOD==0, CHART_PERIOD=="Uninitialized"]
   Chart item=NET_PING period=D refresh=1800 visibility=[CHART_PERIOD==1]
   Chart item=NET_PING period=W refresh=3600 visibility=[CHART_PERIOD==2]
}

}

Inside the paper-ui the Ping Item is displayed with a correct value (for example 20ms). But wheen I do a browser reload (F5) the value is NaN - this happens because the XML File from the ajax request is corrupted.
In the openhab.log there is the log-entry:

[WARN ] [io.rest.core.thing.ThingTypeResource] - Cannot find channel type: exec:running

Startup log/openhab.log

2016-12-11 21:10:53.156 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'rrd4j.persist'
2016-12-11 21:10:53.233 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'rrd4j.persist'
2016-12-11 21:10:53.269 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'rrd4j.persist'
2016-12-11 21:11:29.985 [INFO ] [ore.internal.i18n.LocaleProviderImpl] - Locale set to de_DE
2016-12-11 21:11:35.145 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'dht22.items'
2016-12-11 21:11:35.349 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'net_ping.items'
2016-12-11 21:11:36.499 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'rrd4j.persist'
2016-12-11 21:11:40.176 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'default.sitemap'
2016-12-11 21:11:40.772 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'net_ping.things'
2016-12-11 21:11:40.852 [WARN ] [home.core.thing.binding.ThingFactory] - Could not create channel 'run' for thing type 'exec:command:net_ping', because channel type 'exec:running' could not be found.
2016-12-11 21:11:40.871 [WARN ] [.thing.internal.GenericThingProvider] - Could not create channel 'run' for thing 'exec:command:net_ping', because channel type 'exec:running' could not be found.
2016-12-11 21:11:40.909 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'dht22.things'
2016-12-11 21:11:40.924 [WARN ] [home.core.thing.binding.ThingFactory] - Could not create channel 'run' for thing type 'exec:command:dht22_temp', because channel type 'exec:running' could not be found.
2016-12-11 21:11:40.927 [WARN ] [.thing.internal.GenericThingProvider] - Could not create channel 'run' for thing 'exec:command:dht22_temp', because channel type 'exec:running' could not be found.
2016-12-11 21:11:40.931 [WARN ] [home.core.thing.binding.ThingFactory] - Could not create channel 'run' for thing type 'exec:command:dht22_hum', because channel type 'exec:running' could not be found.
2016-12-11 21:11:40.934 [WARN ] [.thing.internal.GenericThingProvider] - Could not create channel 'run' for thing 'exec:command:dht22_hum', because channel type 'exec:running' could not be found.
2016-12-11 21:11:41.338 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type REGEX
2016-12-11 21:11:41.347 [WARN ] [hab.binding.exec.handler.ExecHandler] - Couldn't transform response because transformationService of type 'REGEX' is unavailable
2016-12-11 21:11:43.511 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2016-12-11 21:11:44.003 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2016-12-11 21:11:44.073 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui

When I’m now watching the values inside the basicui there is no value at all - also the chart data is completely empty.

Before I switched to the snapshot release I tried everything with the current beta version. And it was working very well. So my question ist, am I doing something completely wrong or is this a current issue of the snapshot release?

thank you in advance.

Dominik

Hi,

i have the same issue right now.

Do you have a solution?

Hi,

sorry for the delay. I’ve just seen your message.
I don’t have any news for you about the exec binding. My solution was to use a nodejs app that is doing those exec stuff and then pushing it to openhab via the api. Indeed it was just a quickfix, but it worked very well. And the good thing with this solution is that you can push states from an external infrastructure to openhab in a secure/easy way via the Api (via vpn tunnel).
It gives me also much more freedom in development.

Regards,
Dominik