This page last changed on Jun 30, 2012 by salesguy.

Hi. I have a problem parsing a cosm XML data response, and I can't sort out why openremote won't parse the response using XPATH while another application - thinkspeak will parse the exact same response using the same XPATH.

Openremote is successfully requesting the data, and the response is below. My XPATH expression is:

//data[@id='Arduino_Temperature']/current_value

And the data response is below.

Does anything jump out as being out of sorts? I've been looking at this too long to see any error myself.

thanks!

<?xml version="1.0" encoding="UTF-8"?>
<eeml xmlns="http://www.eeml.org/xsd/0.5.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="0.5.1" xsi:schemaLocation="http://www.eeml.org/xsd/0.5.1 http://www.eeml.org/xsd/0.5.1/0.5.1.xsd">
<environment updated="2012-06-30T13:40:07.325773Z" created="2012-06-29T20:49:27.296784Z" id="65354" creator="https://cosm.com/users/pcannell">
<title>Sam Snead</title>
<feed>https://api.cosm.com/v2/feeds/65354.xml</feed>
<status>live</status>
<private>false</private>
<tag>arduino</tag>
<location domain="physical" exposure="" disposition=""/>
<data id="Arduino_Temperature">
<current_value at="2012-06-30T13:40:06.955395Z">111.87</current_value>
<max_value>118.17</max_value>
<min_value>105.01</min_value>
</data>
<data id="Attic_Humidity">
<current_value at="2012-06-30T13:40:07.231170Z">43.30</current_value>
<max_value>50.0</max_value>
<min_value>0.0</min_value>
</data>
<data id="Attic_Humidity_2nd_Floor">
<current_value at="2012-06-30T13:40:07.231170Z">39.60</current_value>
<max_value>39.9</max_value>
<min_value>0.0</min_value>
</data>
<data id="Attic_Temp_1-wire">
<current_value at="2012-06-30T13:40:06.955395Z">96.80</current_value>
<max_value>134.04</max_value>
<min_value>73.06</min_value>
</data>
<data id="Attic_Temp_2nd_Floor">
<current_value at="2012-06-30T13:40:07.231170Z">87.98</current_value>
<max_value>122.18</max_value>
<min_value>32.0</min_value>
</data>
<data id="Attic_Temp_by_DHT">
<current_value at="2012-06-30T13:40:07.231170Z">89.06</current_value>
<max_value>131.54</max_value>
<min_value>32.0</min_value>
</data>
<data id="Crawlspace_Humidity">
<current_value at="2012-06-30T13:40:07.231170Z">49.00</current_value>
<max_value>50.2</max_value>
<min_value>0.0</min_value>
</data>
<data id="Crawlspace_Temperature">
<current_value at="2012-06-30T13:40:07.231170Z">78.62</current_value>
<max_value>78.8</max_value>
<min_value>0.0</min_value>
</data>
<data id="Garage_Humidity">
<current_value at="2012-06-30T13:40:07.231170Z">47.60</current_value>
<max_value>52.7</max_value>
<min_value>0.0</min_value>
</data>
<data id="Garage_Temperature">
<current_value at="2012-06-30T13:40:07.231170Z">83.30</current_value>
<max_value>95.0</max_value>
<min_value>32.0</min_value>
</data>
<data id="HVAC_Exhaust_humidity_1st">
<current_value at="2012-06-30T13:40:06.955395Z">75.20</current_value>
<max_value>75.74</max_value>
<min_value>32.0</min_value>
</data>
<data id="HVAC_Exhaust_Second_Floor_1-wire">
<current_value at="2012-06-30T13:40:06.955395Z">84.99</current_value>
<max_value>112.66</max_value>
<min_value>59.34</min_value>
</data>
<data id="HVAC_Exhaust_Temperature_1st">
<current_value at="2012-06-30T13:40:06.955395Z">59.80</current_value>
<max_value>75.2</max_value>
<min_value>0.0</min_value>
</data>
<data id="HVAC_Intake_Humidity_1st">
<current_value at="2012-06-30T13:40:06.955395Z">70.16</current_value>
<max_value>72.32</max_value>
<min_value>32.0</min_value>
</data>
<data id="HVAC_Intake_Temperature_1st">
<current_value at="2012-06-30T13:40:06.955395Z">76.50</current_value>
<max_value>99.9</max_value>
<min_value>0.0</min_value>
</data>
<data id="Livingroom_Humidity">
<current_value at="2012-06-30T13:40:07.231170Z">52.50</current_value>
<max_value>53.8</max_value>
<min_value>0.0</min_value>
</data>
<data id="Livingroom_Temperature">
<current_value at="2012-06-30T13:40:07.231170Z">72.14</current_value>
<max_value>73.76</max_value>
<min_value>0.0</min_value>
</data>
<data id="Outside_Humidity">
<current_value at="2012-06-30T13:40:07.231170Z">37.50</current_value>
<max_value>81.2</max_value>
<min_value>0.0</min_value>
</data>
<data id="Outside_Temperature">
<current_value at="2012-06-30T13:40:07.231170Z">97.34</current_value>
<max_value>102.02</max_value>
<min_value>32.0</min_value>
</data>
<data id="Router_Temperature">
<current_value at="2012-06-30T13:40:06.955395Z">109.62</current_value>
<max_value>122.56</max_value>
<min_value>98.04</min_value>
</data>
</environment>
</eeml>

It looked like the HTTPGetCommand had a bug.
The DocumentBuilderFactory was set to use namespaces but later the namespace for the XPath evaluation was not defined.
I created a version where the DocumentBuilderFactory should not use namespaces and it seems to work.
You can try my controller from here: http://www.redeker-consulting.de/openremote/OpenRemote-Controller-2.0.0.zip

Posted by mredeker at Jul 01, 2012 20:41

Thanks - I will give this a try ASAP.

Posted by salesguy at Jul 01, 2012 23:01

Sorry for the delay.

I used your controller files, and I now get this error when trying to log into my controller:

Downloading account configuration failed : sisko

Posted by salesguy at Jul 05, 2012 13:46

Sorry, about my late answer. Vacation time in Europe
I forgot a local configuration in a property file and that's why you have that error.
I uploaded a new version which should not have the "sisko" problem anymore when syncing.

You could also just edit the file controller-2.0.0/webapps/controller/WEB-INF/classes/config.properties.
All the way to the end is the line with "sisko" and a commented out line with the real version. Just switch the comments.

Posted by mredeker at Jul 20, 2012 22:25

Salesguy? is this working for you now? I am trying to get some information from cosm XML/JSON but my log's give me this error

2012-10-05 12:53:39,653 TRACE [Polling thread for sensor: verbruik]: Processed , received
2012-10-05 12:53:50,222 ERROR [Polling thread for sensor: verbruik]: HttpGetCommand could not execute
org.apache.http.client.HttpResponseException: Unauthorized
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:67)
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:54)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:735)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:709)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:700)
at org.openremote.controller.protocol.http.HttpGetCommand.requestURL(HttpGetCommand.java:176)
at org.openremote.controller.protocol.http.HttpGetCommand.run(HttpGetCommand.java:190)
at java.lang.Thread.run(Thread.java:662)

Posted by daferra at Oct 06, 2012 08:17
Document generated by Confluence on Jun 05, 2016 09:31