[solved] Transform not working in OH2

Hi all,

this is probably a noob error, but I have a problem getting a transformation to work.I migrated from 1.8.3. to OH2b3.

I’m reading data from a web service (volkszaehler.org middleware, which stores meter data). The webserver delivers data in XML form and there is a rule on how to read data from it.
However, OH2 complains that the requested XSLT transformation is not available. Using a different form, I can also get the data in JSON, but the OH2 runtime also complains about that one.

The error message is always the same:

2016-06-26 22:31:21.162 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type XSLT
2016-06-26 22:31:21.162 [WARN ] [ab.binding.http.internal.HttpBinding] - couldn’t transform response because transformationService of type ‘XSLT’ is unavailable

Here’s the item definition:

Number Haushaltsstrom_Verbrauch “Haushaltsstrom [%.1f W]” (Strom,Stromverbrauch) {http=“<[http://192.168.xxx.xxx/middleware.php/data/1d20a940-b45e-11e4-ad68-xxx.xml?from=-1Minute&to=+1Minute:60000:XSLT(volkszaehler_avg.xsl)]”}

And the transform rule volkszaehler_avg.xsl, which lives in /etc/openhab2/transform/volkszaehler_avg.xsl also exists.

Using the JSON form, the error stays the same:

20 16-06-30 12:50:43.726 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JSONPATH
2016-06-30 12:50:43.726 [WARN ] [ab.binding.http.internal.HttpBinding] - couldn’t transform response because transformationService of type ‘JSONPATH’ is unavailable

item:

Number Haushaltsstrom_Verbrauch “Haushaltsstrom [%.1f W]” (Strom,Stromverbrauch) {http=“<[haushaltsstrom:30000:JSONPATH($.data.average)]”}

The url ist defined in http.cfg:

haushaltsstrom.url=http://192.168.xxx.xxx/middleware.php/data/1d20a940-b45e-11e4-ad68-xxx.json?average
haushaltsstrom.updateInterval=30000

The Web service output for the JSON variant is something like this:

{“version”:“0.3”,“data”:{“uuid”:“1d20a940-b45e-11e4-ad68-xxx”,“from”:1467233208920,“to”:1467319978716,“min”:[1467270840269,439.86855390537],“max”:[1467308160611,4479.6995527236],“average”:795.636,“consumption”:19177,“rows”:543,“tuples”:…

So it’s the average 795.636 that i’m after.

Any ideas? Do I need to enable some transforms before using them?

Yes, you have to install any transformation service, you want to use. With PaperUI, choose Configuration -> Extensions -> Transformation (it’s the Headline)

This is from memory. The demo server has (for some reason) currently no PaperUI, so I can’t prove it right now.

yes, that worked, i hadd to enable them in addons.cfg

Hi @tkuehne,

I am a little confused.
My transformation addons are installed according to Paper UI.
Then I edited the addons.cfg in /etc/openhab2/services like this

# A comma-separated list of transformation services to install (e.g. "map,jsonpath")
transformation = jsonpath,map,regex

I still get:

2016-09-26 09:09:56.891 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JSONPATH
2016-09-26 09:09:56.896 [WARN ] [ore.transform.actions.Transformation] - No transformation service 'JSONPATH' could be found.

The same with my persistence - addons.cfg:

 # A comma-separated list of persistence services to install (e.g. "rrd4j,jpa")
persistence = rrd4j

openhab.log:

There is no queryable persistence service registered with the id ‘rrd4j’

NCO I have the same problem, installed the transformation and added it to addons.cfg but also still get the error

--------- update------------
It works now, I had to do update and upgrade over and above the installation of the transformation services and the addition in the addons.cfg file.
The update/upgrade did the trick