Help! JSONpath transformation drives me mad!

Hi all,
as a openhab newbie I am stuck with the following: openhab is running on a raspberry. I want to integrate sensor data from an other raspberry by running a script via SSH which then returns a json output. My setup looks like this:

Thing exec:command:temp_innen [command="ssh -i /scripts/id_rsa pi@raspi2 './'", interval=240, timeout=5, autorun=true]
Number Temp_Innen "Temperatur [JSONPATH($.Temp):%.1f]°C" <temperature> (gEG,gMapDB) {channel="exec:command:temp_innen:output"} 
String Temp_Innen2 "Temperatur [JSONPATH($.Temp):%s]" <temperature> (gEG,gMapDB) {channel="exec:command:temp_innen:output"} 
Text item=Temp_Innen
Text item=Temp_Innen2
//karaf log
23:01:52.960 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Exec [OUTPUT]: '{"Temp":   21.90,"Pressure": 1026.10}'
23:01:53.002 [DEBUG] [hab.binding.exec.handler.ExecHandler] - Transformed response is '{"Temp":   21.90,"Pressure": 1026.10}'

According to the log the script runs and returns json data. Using it shows that the structure is correct. However only the String-Item Temp_Innen2 returns a value, e.g. 22.90. The Number item returns Temp_Innen NULL. Jsonpath doesn’t give me the value, only strings…

Can anybody give me a hint what’s wrong here? Or how to set-up the logging, that I get more debug info from the transformation? Help, please!

Could you try to use %s instead of %1.f in the number item?

You receive a json string from the exec action and JSONPATH probably expects the input to be a string.
Just an idea.
I can’t test this on mobile now, but it could be possible.

If you need the value as Number, I would suggest to make a setup like in this post:

The exec thing returns a string, which cannot be directly stored in a number. So you can transform the string in a rule to a number and Update a number item with the converted value.

I also searched a solution for the same problem but did not find a better solution.

I am not quite sure, but it seems that the transformation does not work as we both thing it is. But I had no time for an extensive research.

I hope that helps.

Thanks for the help! It’s a bit odd that the transformation example in the user manual uses JSONPATH in a number item, but looking at your info it can’t be done this way. Is this a bug in the JSONPATH implementation in openhab?

Anyway - your tutorial makes sense as a alternative solution. That’s were I’ll proceed then…
Thanks again

I don´t know, maybe it worked like this in openHAB 1. I was not able to produce the shown examples in the manual.

But when i list the items in the karaf console i can clearly see that there is no assignment to cpuTemp.
cpuTemp_out is a string item added to the things output channel.
cpuTemp_rl is a number item updated by the type converted string in cpuTemp_out within the rule.
cpuTemp is an Number item linkt to the things output channel.

openhab> smarthome:items list
cpuTemp_out   (Type=StringItem, State=43470, Label=, Category=null)
cpuTemp_rl    (Type=NumberItem, State=43470.0, Label=, Category=null)
cpuTemp       (Type=NumberItem, State=NULL, Label=, Category=null)

As we can see there is nothing in the state of cpuTemp which could be then transformed with the rule of your jasonpath.