I used AWS Plugin to get data from AWS IoT Core, from the log everything seems to work,
{
“success”: true,
“message”: {
“message”: “Return from function.py”,
“status”: “OK”
}
}
The Device was also automatically added in the Device list, but no data was shown, no data exists.
And Dashboard can’t load data even with demo file.
Can someone help me? Thanks!
Greetings @MichaelVi,
As per step #4 in this guide, the JSON format expected by Ubidots from AWS IoT Core is the following:
{
"state": {
"reported": {
"temperature": 23,
"humidity":55
}
}
}
Can you please confirm that this is the format that you are using?
Best regards.
Yes I used the right format, so i think it is the problem from Ubidots server. Still thanks for the reply
Greetings,
Can you please confirm the following configurations:
- Make sure that the AWS IoT Rule Query statement is correctly set.
This is the format that the AWS IoT Rule Query statement should have:
SELECT topic(3) as device, * as payload FROM "$aws/things/+/shadow/update"
At the plugin creation interface as well as in the AWS “route” section
It should be like this:
- Parse de incoming data correctly.
Since AWS IoT Core sends the following JSON to Ubidots:
{
"state": {
"reported": {
"temperature": 23,
"humidity":55
}
}
}
You’d need to access the keys in which your data is, then build an Ubidots compatible JSON with that data. Said so, your decoder should look like this for this particular example:
def decode(args):
print("Arguments received in decode function", args)
payload = args.get("payload")
device_label = args.get("device")
# Please format your data and make sure this function returns a dictionary like this:
# {
# "device_label":"your_device_label",
# "payload": <An Ubidots API v1.6 compatible payload (See https://ubidots.com/docs/hw/#send-data)>
# }
return {"device_label": device_label, "payload": payload["state"]["reported"]}
I hope this guidelines help you on your integration.
Please feel free to reach back to us if any other question/doubt arises.
Best regards
This video shows it working