Page 1 of 1

HTTP request

Posted: 23 Feb 2020 13:34
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.

Re: HTTP request

Posted: 25 Feb 2020 13:03
by ricargr
Please any help?
Thanks

Re: HTTP request

Posted: 01 Mar 2020 22:37
by PoltoS
Your code looks ok. Make sure your reply has a correct Content-Type application/json

Re: HTTP request

Posted: 01 Mar 2020 22:38
by PoltoS
Ah, sorry, remove '' around true. You are using typed equal and string !== boolean

Re: HTTP request

Posted: 01 Mar 2020 23:43
by ricargr
Thanks Poltos
3 days trying and now works thanks to you
Regards