Hi all,
I’m trying to connect Ignition with AWS IoT SiteWise using AWS native APIs instead of MQTT or IoT Bridge. The goal is to fetch and push data to SiteWise directly from Ignition scripts via AWS API.
Has anyone here implemented or tested this kind of direct AWS IoT SiteWise API integration in Ignition? Any examples or best practices would be great!
You could in theory load the AWS SDK via a custom module, but it's still going to be using MQTT/HTTP "under the hood" (as far as I can tell) so I'm not sure what advantage this would actually give you.
While you’re correct that loading the AWS SDK via a custom module ultimately uses MQTT or HTTP under the hood, there’s a specific customer demand to use AWS’s native SiteWise APIs to retrieve asset property values directly and plot trends accordingly. The advantage is that these APIs (like GetAssetPropertyValue and GetAssetPropertyAggregates) allow for targeted, secure, and auditable data access from the IoT side, which is ideal for both current and historical trend visualization and serves industrial requirements beyond generic telemetry streams.
Given this scenario, how can the direct SDK/API methodology be best implemented for real-time or historical trend plotting—especially for use cases where customers require fine-grained control and visibility into their IoT asset metrics from their SCADA or dashboard systems? What steps and best practices would you recommend to achieve reliable, scalable integration with minimal latency and maximum security?
You are asking questions that belong in the Module Development category, and are so broad that you are unlikely to get a response, short of paying for help.
I have written the following code to fetch data from an external AWS API. The response comes in a paginated format and contains timestamped values. I want to plot these values as a trend, but I need the plotting to be fast and optimized for shorter time durations (not for long-range historical data).
Can anyone suggest the best approach or tools for efficiently plotting this kind of paginated API response in Ignition? If you have experience handling similar trend plotting with external APIs, any tips or code snippets would be highly appreciated.
def api(startDate, endDate, interval, taguid):
import json
import pprint
from datetime import datetime
input_format = "%Y-%m-%d %H:%M:%S"
output_format = "%Y-%m-%dT%H:%M:%S.000+05:30"
sd = str(datetime.strptime(startDate, input_format).strftime(output_format))
ed = str(datetime.strptime(endDate, input_format).strftime(output_format))
url = 'https://id87gxb95c.execute-api.ap-south-1.amazonaws.com/dev/utclvendor/filter-by-uids-and-plant-any-interval-v4'
token = str(system.tag.readBlocking(["[default]Token"])[0].value)
payloadtoken = ''
tag_values = {}
headers = {
"Content-Type":"application/json",
"Authorization":"Bearer " + token
}
while True:
payload = json.dumps({
"sd": sd,
"ed": ed,
"pln_code":"KU01",
"uid":[
str(taguid)
],
"interval": interval,
"nextToken": payloadtoken
})
response = system.net.httpPost(url, "application/json", payload, 10000, 60000, None, None, headers, True, False)
data = json.loads(response)
for entry in data.get("result", []):
uid = str(entry["Id"])
value = float(entry["Value"])
ts = str(entry["Timestamp"])
point = {"time": ts, "Value": value}
if uid not in tag_values:
tag_values[uid] = []
tag_values[uid].append(point)
if "nextToken" in data:
payloadtoken = str(data["nextToken"])
else:
break
# pprint.pprint(tag_values)
# print data
return tag_values