Please try: $.(0).NWATT (without the brackets)
See also here.
.
.
Btw. Did you read anything here in this topic?
.
.
EDIT: As I read here, it also could be: JSONPATH:$[0].NWATT
I’ve tried JSONPATH:($.(0).NWATT), JSONPATH:$.(0).NWATT and $.(0).NWATT in the StateTransformation of the channel and get exactly the same error.
I have ready through the thread, some is not relevant and some goes over my head.
I haven’t tried REGEX because I’m not familiar with it and it would be another thing I would have to learn. The JSONPATH transformation seemed the simplest way of extracting the data.
This is the data returned by the URL. ecostatus.txt (1.8 KB)
You also could try:
JSONPATH:$[0].NWATT (in PaperUI)
or in .things file
[ stateTransformation="JSONPATH:$[0].NWATT" ]
No matter what variation I put in I get pattern=‘($.(0).NWATT)’ in the error.
The last one was with no dot between $ and (0).
Potentially openHAB isn’t picking up changes in the things file? In this case, I usually corrupt the things file (just add some nonsense, or remove a "), then save. openHAB will complain and unload all the things from that file. Then restore the file (add the " back, or remove the nonsense) and save again - all the things will be reloaded.
I’m not using things or items files I’m doing everything in PaperUI until I get it working. I tried the square brackets but still got the same error. Why does the error contain pattern=‘($.(0).WATT)’ no matter what syntax I use? Maybe that’s the clue.
I showed that in the list of variations above. I’ve put the JSONPATH: back in each of the channels but it makes no difference I still have exactly the same error.
Of course your data might not be what you expect.
Make a string channel/Item that shows you the whoile message, and share with us?
According to this page (https://jsonpath.herokuapp.com/), the following values are valid for JSONPATH:
$.[0].NWATT
or
$[0].NWATT
I pasted the content of @lesterb s ecostatus.txt there. Then filled in a line below $[0].NWATT and then pressed Go!
And got the result: 2540.969
If that’s wrong, please enlighten me.
Hi Alex,
You are correct. I thought I had tried JSONPATH:$[0].NWATT before but I couldn’t have because that syntax stops the error.
However, it turns out I have a second error. I’m not reading the data.
When I run ecostatus.json I get the following error on the webpage.
SyntaxError: JSON.parse: unexpected character at line 105 column 28 of the JSON data
When I examine the page source the correct data is shown. If I login to the Ecomon I don’t get the error.
I’ve added the username and password in my thing but I still don’t see any data in the string channel I created. Thanks for the suggestion rossko.
Is there an easy way to round the extracted number to zero decimal points using the JSONPATH command?
This really isn’t about the new HTML binding.
No, it extracts what is there.
You can use state presentation on your Item.
Thanks Rossko.
I’ll start a new thread on this topic.
Hope you can help me there…again.
Hi Jan,
I see no feedback from anyone.
Are you still working on this binding?
Will this be the binding to be integrated into OH3?
I think of testing the binding to be prepared for OH3.
Thanks Joerg
I think It‘s mostly ready. Some documentation is missing.
Hi Jan,
I now installed the binding and added a thing and a channel.
But I allways get an authentication error.
Old HTTP binding:
name.url=http://<username>:<password>@<IP>/sc2_val.xml
name.updateInterval=30000
No matter how I tried to enter the URL into the the thing, I get an authentication error:
- Full URL: http://<username>:<password>@<IP>/sc2_val.xml
or
- URL: http://<IP>/sc2_val.xml and username/password in the separate fields
or
- The same but just http://<IP>/ and the XML extension entered in the channel definitiont
Regards Joerg
BTW: I added 3 other HTTP things/channels without authentication without any issues