Ubidots Community

[SOLVED] I can't visualize the data from AWS IOT

Hi I had an issues to visualize my data from AWS IoT Core. All the codes are working fine. It even created new device after I had publish the message. However, the message is empty and I can’t find the variable. I can’t find any problem there.
Uploading: 2.jpg…

@swkuay can you please share more about how you’re integrating Ubidots+AWS? Is is through our official plugin?

If so, please go to your plugin, then click on “Logs” and share them with us so we can inquire more about where the problem is:

This is the message logs obtained

I had also follow this articles exactly to build it.

Thanks @swkuay can you click on the Log Id and send us the actual output of the log?

 Messages:
{
  "success": true,
  "message": {
    "message": "Topic Rule Destination confirmed successfully ",
    "status": 200
  }

Logs:
2021-06-15T08:30:36.352530Z stdout: [Data Plugin AWS IoT Core] Params received: {'arn': 'arn:aws:iot:us-east-2:705960257188:ruledestination/http/f72b6888-e242-4964-9ef6-4c45b4198f44', 'confirmationToken': 'AYADeINfgMp3rVTf5-3xoynczhEAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREFzR29pVlRkaG9ZU1h4ZGxRNmpVaXA1VzE2ejFFUzFLRUM1K2tiZDJ6L2lGZlFGQVRqdmFmRmNVVjRZSjJxSkpCQT09AAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLWVhc3QtMjoxMTUxMzc4MDg0Njk6a2V5LzI5ZDk3N2RjLTE0YTMtNDEyMy04MmVhLWUwNmFkNTM3Yzg4MAC4AQIBAHj42jz0rmjO63WB3jUKIJ1w1fg8QxHwam9jYx8vZkGAAwFY1gWZSrGCb6bk0ezr8uKUAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMueNoF8Bz3IgbUyTpAgEQgDsZ1bf0J3Y7xLPNH62gqGNSdCLuI9vVePGhx3Rx5iIYjrM0UBjP0yRu92HO8Uc34xocD54qzH9TauBLywIAAAAADAAAEAAAAAAAAAAAAAAAAACTbRIpLCB_bnrWBhKHYTj9_____wAAAAEAAAAAAAAAAAAAAAEAAAB1VK-bLSSU-u9fcDKlP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GxOxCpAvWQe303giCW7EYD6ax4_lj7-2yFztBM5gZABnMGUCMQD-HHTjwM3WJYM8JdTzp-u109Lr97km3JEs3vPra4w8hkluugP0DI0el2dH1LAU9MgCMAqIT6pE8XLKMoktyewcH_PBWm5WDcCPE73IC-taupgV620DlXAokbMBTfglZ3Is1g', 'messageType': 'DestinationConfirmation', '_parameters': {'awsRegion': 'us-east-2', 'device_type_name': 'AWS IoT Devices', 'awsIotRuleQuery': 'SELECT topic(3) as device, state.reported as payload FROM "$aws/things/+/shadow/update"', 'token': 'BBFF-xxx', 'iam_account': '705960257188', 'role_trusted': 'Ubidots_813028286946', 'plugin_version_id': '60c864e14763e72baa70fc8b', 'is_new_webhook_url': True}}

2021-06-15T08:30:36.352607Z stdout: _parameters {'awsRegion': 'us-east-2', 'device_type_name': 'AWS IoT Devices', 'awsIotRuleQuery': 'SELECT topic(3) as device, state.reported as payload FROM "$aws/things/+/shadow/update"', 'token': 'BBFF-IJ7UYpoMslhLOE6yRqnCDDPOTwxozD', 'iam_account': '705960257188', 'role_trusted': 'Ubidots_813028286946', 'plugin_version_id': '60c864e14763e72baa70fc8b', 'is_new_webhook_url': True}

2021-06-15T08:30:36.352619Z stdout: AWS Payload {'arn': 'arn:aws:iot:us-east-2:705960257188:ruledestination/http/f72b6888-e242-4964-9ef6-4c45b4198f44', 'confirmationToken': 'AYADeINfgMp3rVTf5-3xoynczhEAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREFzR29pVlRkaG9ZU1h4ZGxRNmpVaXA1VzE2ejFFUzFLRUM1K2tiZDJ6L2lGZlFGQVRqdmFmRmNVVjRZSjJxSkpCQT09AAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLWVhc3QtMjoxMTUxMzc4MDg0Njk6a2V5LzI5ZDk3N2RjLTE0YTMtNDEyMy04MmVhLWUwNmFkNTM3Yzg4MAC4AQIBAHj42jz0rmjO63WB3jUKIJ1w1fg8QxHwam9jYx8vZkGAAwFY1gWZSrG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y7xLPNH62gqGNSdCLuI9vVePGhx3Rx5iIYjrM0UBjP0yRu92HO8Uc34xocD54qzH9TauBLywIAAAAADAAAEAAAAAAAAAAAAAAAAACTbRIpLCB_bnrWBhKHYTj9_____wAAAAEAAAAAAAAAAAAAAAEAAAB1VK-bLSSU-u9fcDKlPIwHpr-dKD-VLJcUJjDefXHOWUKllQfsHtO-SG241GKgOglp5tzVeMhi-RRiteVrjM7m_EAJv98FkA_8Y1yZuUFqhgkbrga2Y-Tkv-crmj3GuHCHrMPu4qoWGxOxCpAvWQe303giCW7EYD6ax4_lj7-2yFztBM5gZABnMGUCMQD-HHTjwM3WJYM8JdTzp-u109Lr97km3JEs3vPra4w8hkluugP0DI0el2dH1LAU9MgCMAqIT6pE8XLKMoktyewcH_PBWm5WDcCPE73IC-taupgV620DlXAokbMBTfglZ3Is1g', 'messageType': 'DestinationConfirmation'}

2021-06-15T08:30:36.352635Z stdout: aws_region us-east-2

2021-06-15T08:30:36.352643Z stdout: iam_account 705960257188

2021-06-15T08:30:36.352650Z stdout: role_trusted Ubidots_813028286946

2021-06-15T08:30:36.352658Z stdout: ubidots_token BBFF-xxxxxxxx

2021-06-15T08:30:36.352665Z stdout: aws_iot_rule_query SELECT topic(3) as device, state.reported as payload FROM "$aws/things/+/shadow/update"

2021-06-15T08:30:36.352675Z stdout: device_type_name aws-iot-devices

2021-06-15T08:30:36.352681Z stdout: Response from AWS, confirming endpoint <Response [200]>

Hey, It seems that the rule destination was created successfully, but no data is being received from AWS. Also, the fact that you only have 1 plugin log, shows that there’s only been 1 plugin activation.

To troubleshoot, we suggest making sure you’re sending data to AWS in the right topic, and that your payload is consistent with the AWS IoT rule specified:

SELECT topic(3) as device, state.reported as payload FROM "$aws/things/+/shadow/update"

As you can see in this statement, the AWS IoT Rule expects a payload with this structure:

{ 
  "state": { 
    "reported": { 
      "temperature": 23, 
      "humidity":55 
    } 
  } 
}

How can I edit the rule to a correct statement in the plugin? As once i had changed, the plugin automatically stopped. My topic is just $aws/outTopic and the statement that had test is in correct JSON format too.

@swkuay you should edit the rule directly in AWS IoT.

As per your example, if you want the AWS rule to forward data to the plugin, then you want to tell it to grab all data from your topic “$aws/outTopic” and send it in the specified format:

SELECT <your-unique-device-id> as device, state.reported as payload FROM "$aws/outTopic"

i also facing this issue, My device also connected by i cant see any data, my topic is “$aws/things/+/shadow/update” i modified like this, and my aws payload format is

{
“temperature”: 23,
“humidity”:55
} and how can i change the decoding function, i tried many ways nothing workout, help me

and my json format is …
{
“format”: “json”,
“topic”: “$aws/things/84:0d:8e:8c:f8:3c/shadow/update”,
“timestamp”: 1624530392293,
“payload”: {
“Temprature”: 30,
“Humidity”: 11
}
},

Hello @Radps,

Can you confirm that your device is:

  1. Publishing to a topic following this structure "$aws/things/+/shadow/update", where the + sign is replaced by your device identifier? Note that this topic can’t be only in the payload, it must also be the topic you use to publish.
  2. Publishing a payload with the structure seen at the end: note that the "state.reported" key holds the actual data that will be sent to the Ubidots Plugin because the AWS IoT rule specifies that way as seen in the below

Expected message structure:

{ 
  "state": { 
    "reported": { 
      "temperature": 23, 
      "humidity":55 
    } 
  } 
}

If you’re not following either of the above points, then it makes sense that the data isn’t correctly forwarded. Please make the necessary changes to adjust to the aforementioned indications.

I’ll be attentive should you need additional clarification.

-D

@dsr thanks for your support,


i think i already have that correct Topic …

@Radps,

Yes, the topic is correct. Now we’re only left with the payload. Are you sending this from a physical device or using AWS IoT core’s publish simulation tool?
Either way, you should send a payload like this:

{ 
  "state": { 
    "reported": { 
      "temperature": 23, 
      "humidity":55 
    } 
  } 
}

Because that’s what the rule expects, otherwise, data won’t be forwarded to the Plugin

Does it make sense?

Thankyou soo much for the help…now i got the clear view…

1 Like