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:
According to the log the script runs and returns json data. Using jsonquerytool.com 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.
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
Jan
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.