Hi,
Just though I would share this information so it may help someone. This is a script I wrote that goes into ignition SCADA, the script hits the URL and then splits the results and then updates tags within Ignition.
The ipaddress needs to be changed to your iotawatt ip adress from x.x.x.x.
There needs to be a tag in Ignition which matches the tag within the iotawatt (as shown in the URL below)
Also there needs to be some other tags
lastTimestamp
#print receivedData
receivedData=system.net.httpGet("http://x.x.x.x/query?select=[time.local.unix,input1a.amps.d2,input1pf.pf.d1,input1w.watts.d1,input2a.amps.d2,input2pf.pf.d1,input2w.watts.d1,input3a.amps.d2,input3pf.pf.d1,input3w.watts.d1,input4a.amps.d2,input4pf.pf.d1,input4w.watts.d1,input5a.amps.d2,input5pf.pf.d1,input5w.watts.d1,input6a.amps.d2,input6pf.pf.d1,input6w.watts.d1,input7a.amps.d2,input7pf.pf.d1,input7w.watts.d1,input8a.amps.d2,input8pf.pf.d1,input8w.watts.d1,input9a.amps.d2,input9pf.pf.d1,input9w.watts.d1,input10a.amps.D2,input10pf.pf.d1,input10w.watts.d1,phaseA.volts.d1,phaseB.volts.d1,phaseAFreq.hz.d1,phaseBFreq.hz.d1]&begin=s-5s&end=s&resolution=high&group=auto&header=yes",1000,2500)
#print DataJSON
DataJSON=system.util.jsonDecode(receivedData)
for key, value in DataJSON.items(): #or leave the .keys() off entirely
print key
print value
val1=0
i=0
updateTags=0
for item in DataJSON["labels"]:
for j in DataJSON["data"]:
if ((item == "Time") & (updateTags==0)):
val1 = system.tag.read("[default]IotaWatt/lastTimestamp").value
if (val1 < j[i]):
updateTags=1
system.tag.write("[default]IotaWatt/lastTimestamp",j[i])
else:
if (updateTags==1):
if j[i] is not None:
system.tag.write("[default]IotaWatt/"+item,j[i])
i=i+1
# Need to compare the above with 1sec updates using http://x.x.x.x/status?inputs=yes&outputs=yes
# from the author and forum.