HTTP DEVICE - parse XML response

Discussions about existing Z-Wave device and their usage with Z-Way/Z-Cloud/Z-Box
Post Reply
bgl
Posts: 2
Joined: 22 Nov 2017 13:52

HTTP DEVICE - parse XML response

Post by bgl » 22 Nov 2017 15:25

PIC01.JPG
PIC01.JPG (13 KiB) Viewed 668 times
Hello,
I want to implement my Homematic bidcos devices as HTTP DEVICE in Z-WAY. Switching on and off works without any problems. What I have not solved yet, is the query of the current device status. As a return value, I get an XML response. I am still not sure which parse string I have to enter in the HTTP DEVICE property field "Inline Javascript to parse incoming data to 'on'/'off' strings", to get the right device status back to Z-Way.


----------------------------------------------
status check
----------------------------------------------
http://192.168.99.99/config/xmlapi/stat ... nt_id=4711


----------------------------------------------
Answer: Devive ON
----------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<state>
<datapoint value="true" ise_id="4711"/>
</state>




----------------------------------------------
Answer: Devive OFF
----------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<state>
<datapoint value="false" ise_id="4711"/>
</state>





I am grateful for every proposed solution.


Best regards
Bodo
PIC02.JPG
PIC02.JPG (170.92 KiB) Viewed 668 times
raspberry pi3 with RaZberry (z-wave), raspberry pi2 as CCU (Homematic), Z-Way as frontend

bgl
Posts: 2
Joined: 22 Nov 2017 13:52

Re: HTTP DEVICE - parse XML response

Post by bgl » 27 Nov 2017 10:50

Hello,
I could solve the problem. I had to enter the following values in the two fields below:

"Inline Javascript to parse incoming data to 'on'/'off' strings" --> $$.findOne('/state/datapoint/@value') === 'true' ? 'on' : 'off'
"Interval in seconds between polling requests" --> 5

Best regards
Bodo
raspberry pi3 with RaZberry (z-wave), raspberry pi2 as CCU (Homematic), Z-Way as frontend

Post Reply