This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

remote service and JSON parameter
#1
Hello all,
for a customer demo I would need to connect a device that would communicate with the controler using remote services.

What I would like to do is using the remote service write a Json into a virtual groupe address: 32/1/20 (define as a 250Byte string)

when a new value is written in 32/1/20 it trigger a script that analyse the Json and then make all the required processing.

my issue is that usingĀ 

http://admin:password@192.168.0.10/scada...alue={Room:"Room%20Type":"Bedroom","Room%20Id":%201256321,"Temperature":%2025.5,"Humidity":%2060,"Luminosity":%20800}}

I see that 32/1/20 is updated but with empty value... what would be the trick to make it work ?

thanks
Gilles
Reply
#2
Remote service handler decodes the value as JSON then tries writing a table to a text object. This results in an empty value being written.

If you want to pass multiple values like this better use .lp scripting: https://kb.logicmachine.net/misc/apps/#lp-scripts
This way you can parse the incoming value and write the result to final output objects without an extra event script.
Reply
#3
Thanks a lot I will look at it.... in parallel what I have done is adding a character at the bigining of the json(so the W4K is not understanding it's json)
and then in my script it remove the first char...

Gilles
Reply


Forum Jump: