Http sensor feedback

Hi I am trying to connect to Openremote which has a rest api but I can’t see how I parse the feedback which is xml and use this to set a switch in Openhab.

I’ve created a switch in Openhab that works:
Switch or_office_music "OR Office" (Music) {http=">[ON:POST:http://192.168.0.16:8080/controller/rest/control/2502/on] >[OFF:POST:http://192.168.0.16:8080/controller/rest/control/2502/off]"}

If I want to see that status I can post the following command which reads the Openremote sensor:

http://192.168.0.16:8080/controller/rest/status/5572173

This returns the following xml:

<status id="5572173">on</status>
</openremote>

I just need the on piece which I guess I can then use to update the openhab value. I have read the forums but can’t see how this works - I tried this but it did not work.

String OfficeMusicstatus "statistem" { http="<[http://192.168.0.16:8080/controller/rest/status/5572173:60000:JSONPATH($.status id="5572173")]" }

Thanks in advance!

The example you tried didn’t work because the JSONPATH is for parsing JSON data, not XML.

You need an XSLT Transformation.

Thanks I looked but I can’t see how you can extract the value in one command without rules? Is there not just a way to do regex matching of the return xml? I’ve searched all the forums and it seems you can do regex but there is very little documentation on how to do this.

You may not be looking at the link I put in the last posting because
everything it talks about there has nothing to do with rules.

Use one of the yahoo weather examples on that link to write your xslt and
then use the item example to see how to use the result of the xslt to
populate your item.

Hi in case anyone needs to do this it was pretty complicated but with some help this was the xslt that was needed:

<xsl:template match="/">
   <xsl:value-of select="*/o:status[@id='5572173']" />
</xsl:template>

</xsl:stylesheet>