This page last changed on Dec 28, 2015 by arnoldg.

Hello,

I have a small problem with a json string.

i made a command

url : huis.******.nl:8080/json.htm?type=devices&rid=43
http methode :Get

polling: 10s
jsonpath: $.result\*.SetPoint

The result is like below.

When i use a custom sensor, the result in a label is [ "20.5" ]
How can i trim [ " and " ] from the label or is there a way to put the value in a slider, to change the setpoint.

HOW DO I PLACE CODE TAGS ARNOLD MY JSON QUERY IN THIS FORUM ?

   "ActTime" : 1451212321,
   "ServerTime" : "2015-12-27 11:32:01",
   "Sunrise" : "08:44",
   "Sunset" : "16:24",
   "result" : [
      
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "20.5",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 7,
         "HardwareName" : "Opentherm gateway",
         "HardwareType" : "OpenTherm Gateway USB",
         "HardwareTypeVal" : 18,
         "HaveTimeout" : true,
         "ID" : "0000005",
         "LastUpdate" : "2015-12-20 15:21:57",
         "Name" : "Gewenste temperatuur",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "SetPoint" : "20.5",
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "SetPoint",
         "Timers" : "false",
         "Type" : "Thermostat",
         "TypeImg" : "override_mini",
         "Unit" : 0,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "43"
    
   ],
   "status" : "OK",
   "title" : "Devices"

command.jpg (image/jpeg)

1) Please include you code in {code}{code} tags for better readability
2) In the past I have used

[0-9]{0,}[.]{0,1}[0-9]{0,2}
in the RegEx field. It limits the number to 2 decimal positions

Posted by pz1 at Dec 28, 2015 09:46

After putting

[0-9]{0,}[.]{0,1}[0-9]{0,2}

i get n/a in the label, so it seems that it isn't working
what could be wrong.

Posted by arnoldg at Dec 28, 2015 11:01

I must admit I only tried this RegEx combined with XPath Never with JSONPath.
Just a wild guess; maybe you need to put it in brackets there

([0-9]{0,}[.]{0,1}[0-9]{0,2})
Posted by pz1 at Dec 28, 2015 11:22

This also doesn't work.

i think the regex is procesed before the json result is availebel.
but i don't how to check if this is thru

Posted by arnoldg at Dec 28, 2015 11:28

http://jsonlint.com/ tells me that your JSON is not valid. So I can't do more testing

Posted by pz1 at Dec 28, 2015 12:28

that is becaus i didn't know how to post it correct.
Below is the correct json string, and if tested in the above link it is a "Valid JSON"

what could i try next.

{
   "ActTime" : 1451314497,
   "ServerTime" : "2015-12-28 15:54:57",
   "Sunrise" : "08:44",
   "Sunset" : "16:25",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "20.5",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 7,
         "HardwareName" : "Opentherm gateway",
         "HardwareType" : "OpenTherm Gateway USB",
         "HardwareTypeVal" : 18,
         "HaveTimeout" : true,
         "ID" : "0000005",
         "LastUpdate" : "2015-12-20 15:21:57",
         "Name" : "Gewenste temperatuur",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "SetPoint" : "20.5",
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "SetPoint",
         "Timers" : "false",
         "Type" : "Thermostat",
         "TypeImg" : "override_mini",
         "Unit" : 0,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "43"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}
Posted by arnoldg at Dec 28, 2015 14:55

Sorry, I can't help you any further. Pro release 1.4 has problems since almost 2 weeks on my Synology, so it won't start anymore. So I can't mimic your system here. I have to leave this to others.

I am waiting for a kind soul that either fixes 1.4, or provides me with a Pro 1.3 controller package ( I accidentally lost that one)

Posted by pz1 at Dec 28, 2015 20:04

@PZ1

Drop me an email and I'll send you a link to my archive zip of OR_Pro1.3

Cheers

Stuart

Posted by mdar at Dec 29, 2015 13:11

This v1.3 works fine now. Thanks.
Getting it working properly was a pain. For some reason, I do not yet understand, a http command to TTN LoraWAN messed up my system. After removing (designer 1.4) and syncing that (controller 1.3) my OpenRemote side id working fine again.

Posted by pz1 at Dec 30, 2015 11:50

how did you remove designer 1.4 ?

Posted by yogs at Dec 30, 2015 15:31

please us a own topic to discus the problem's installing/removing openremote. and stick to my problem

which is still not solved

Posted by arnoldg at Dec 30, 2015 18:20

stick to my problem which is still not solved

You are right. Just tried accessing from my OR your json file. Unfortunately I get the same results as you do:

 [ "20.5" ]

When I try the same in this JSONPath tester I do get the correct "20.5"
Also with JSONPath

$.result.[SetPoint]
result is the same.

I tried a couple of variants of that jsonPath with no success. Looks like the JSONPath Expression in OpenRemote does not deal with arrays.
Sorry I have no solution for you. Hopefully someone more experienced with JSONPath can point us in the right direction

Posted by pz1 at Dec 30, 2015 20:06

Hi there Arnold,

maybe a bit off topic but i was wondering how te get the temperature data from the opentherm gateway.
Im a noob on JSON so i havent got any clue how to make the HTTP get command in the designer.
in the designer i made a command like this, probably complety wrong. can you help me out on this?
I got the opentherm gateway usb connected on the same pc as the openremote server and got the otmonitor up and running with a responding web page on port 8081.

Posted by bgroot at Jan 09, 2016 10:47

never go off topic, that is not respectful!
Please open new topic with more precise title. If possible also try to publish the the full json that is returned by the command using the url in a webbrowser.

Posted by pz1 at Jan 09, 2016 18:05
Document generated by Confluence on Jun 05, 2016 09:33