Data from http request - to JSON - to KNX - 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: Data from http request - to JSON - to KNX (/showthread.php?tid=1304) |
Data from http request - to JSON - to KNX - Rune - 21.03.2018 Hi! I need a little help with this: I now got a energy-gateway that can send a JSON-file when requested. The way to do it, is type "http://10.0.0.xxx/output.json" in the web browser. I then get a file called "output.json" and the string is like this: {"0015BC001B024257":{"ApplicationHeartbeat":"1","CurrentSummationDelivered":"12812.1","CurrentSummationReceived":"0.0","Tamper":"0","InstantaneousDemand":"4342.0","Battery":"0"}} The information I need is CurrentSummationDelivered and InstantaneousDemand and the goal is to write this to two KNX groups with 30 seconds intervals. Any tips where to start? Thanks from a LM5-newbie. RE: Data from http request - to JSON - to KNX - Erwin van der Zwart - 21.03.2018 Hi, Try something like this: Code: require('socket.http') Erwin RE: Data from http request - to JSON - to KNX - Rune - 21.03.2018 (21.03.2018, 18:21)Erwin van der Zwart Wrote: Hi, Something tells me that I am forgetting something? No action on the KNX-bus. (Picture attached) RE: Data from http request - to JSON - to KNX - admin - 21.03.2018 Add log(data, code) after http request and log(data) at the end of the script, then check Logs tab for results. Do you have objects 4/0/20 and 4/0/21 created in LM? RE: Data from http request - to JSON - to KNX - Rune - 21.03.2018 Here is the solution, thank to you that know who you are. And thanks for all the help also! Code: sock = require('socket').tcp() |