remote service and JSON parameter - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: remote service and JSON parameter (/showthread.php?tid=5250) |
remote service and JSON parameter - gilles38 - 16.02.2024 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-remote?m=json&r=grp&fn=write&alias=32/1/20&value=value={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 RE: remote service and JSON parameter - admin - 16.02.2024 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. RE: remote service and JSON parameter - gilles38 - 16.02.2024 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 |