HTTP request

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
ricargr
Posts: 15
Joined: 13 May 2014 22:47

HTTP request

Post by ricargr »

Good Morning,

I have been looking in forum and I couldnt find the response for the problem I have.
First I have to say my level is JS is very low, but in other cases I could do what I needed.
In this case I created a HTTP request switchBinary. The URL for actions On and Off works perfectly, but in the URL to get value I have http://192.168.45.126/relay/0 that respond the value: {"ison":true, "has_timer":false} if the relay is on and {"ison":false, "has_timer":false} if the relay is off

I try many combinations for "Inline Javascript to parse incoming data to 'on'/'off' strings" but i must be doing something bad, for example $$.ison === 'true' ? 'on' : 'off'

if you could help me I would be very grateful. Thank you in advance.

ricargr
Posts: 15
Joined: 13 May 2014 22:47

Re: HTTP request

Post by ricargr »

Please any help?
Thanks

User avatar
PoltoS
Posts: 5887
Joined: 26 Jan 2011 19:36

Re: HTTP request

Post by PoltoS »

Your code looks ok. Make sure your reply has a correct Content-Type application/json

User avatar
PoltoS
Posts: 5887
Joined: 26 Jan 2011 19:36

Re: HTTP request

Post by PoltoS »

Ah, sorry, remove '' around true. You are using typed equal and string !== boolean

ricargr
Posts: 15
Joined: 13 May 2014 22:47

Re: HTTP request

Post by ricargr »

Thanks Poltos
3 days trying and now works thanks to you
Regards

Post Reply