FUXA icon indicating copy to clipboard operation
FUXA copied to clipboard

MQTT Parse JSON error

Open catalinzeb opened this issue 1 year ago • 1 comments

Hi, I'm beginner with this SCADA and i try to read and write some values through MQTTT I have this output from MQTT

SPC = { "node": "Network_1", "group": "SPC", "timestamp": 1708351277016, "timestamp": 1708351278016, "values": { "Voltage": 25.2, "Current": 63.86, "Power": 40.62 }, "errors": {} }

How can i read values.Voltage, value.Current, and values.Power? How can i write values.Current?

var myarrayStr = $getTag('t_092ed871-b16347bd' /* MQTT - myarray */); var myarray = JSON.parse(myarrayStr);

myarray.forEach(item=>{ console.log(item.Current); });

When i test it :

Http failure response for http://myip/api/runscript: 400 Bad Request

The connection is ok and I receive the data in raw format.

Thanks!:)

catalinzeb avatar Feb 19 '24 14:02 catalinzeb

Hi, you must pass at least the name of the script, to be put in the body of the POST

{
    "params": {
        "script": {
            "name": "script_5",
            "parameters": []
        }
    }
}

unocelli avatar Feb 23 '24 21:02 unocelli