【问题标题】:Unable to connect AWS IoT to Arduino Yun using Basic Pub/Sub example无法使用基本 Pub/Sub 示例将 AWS IoT 连接到 Arduino Yun
【发布时间】:2016-07-24 17:56:42
【问题描述】:

我正在尝试建立从 Amazon Web Service IoT(物联网)到我的 Arduino Yun 的连接。我遵循了关于使用“BasicPubSub”Arduino 示例发送和接收消息的教程,但它会说:

Failed to Connect!
-13

这意味着“CONNECT_CREDENTIAL_NOT_FOUND”。我在头文件中有正确的凭据和信息,也有正确的文件,它们是:xxx-certificate.pem.crt、xxx-private.pem.key 和 root_certificate.pem 在一个目录中,“/root/certs /",当我 SSH 进入 Arduino Yun 时。以下是我的头文件:

#ifndef config_usr_h
#define config_usr_h

// Copy and paste your configuration into this file
//===============================================================
#define AWS_IOT_MQTT_HOST "xxx.iot.us-east-1.amazonaws.com" // endpoint
#define AWS_IOT_MQTT_PORT 8883
#define AWS_IOT_CLIENT_ID "client_id"   // client ID
#define AWS_IOT_MY_THING_NAME "thing_name"  // thing name
#define AWS_IOT_ROOT_CA_FILENAME "root_certificate.pem" // root-CA filename
#define AWS_IOT_CERTIFICATE_FILENAME "xxx-certificate.pem.crt"                 // your certificate filename
#define AWS_IOT_PRIVATE_KEY_FILENAME "xxx-private.pem.key" // private key
//===============================================================
// SDK config, DO NOT modify it
#define AWS_IOT_PATH_PREFIX "../certs/"
#define AWS_IOT_ROOT_CA_PATH AWS_IOT_PATH_PREFIX AWS_IOT_ROOT_CA_FILENAME           // use this in config call
#define AWS_IOT_CERTIFICATE_PATH AWS_IOT_PATH_PREFIX AWS_IOT_CERTIFICATE_FILENAME   // use this in config call
#define AWS_IOT_PRIVATE_KEY_PATH AWS_IOT_PATH_PREFIX AWS_IOT_PRIVATE_KEY_FILENAME   // use this in config call

#endif

所以我的问题是 Arduino Yun 无法识别“/root/certs/”目录中的文件,其中凭证用于连接到 AWS IoT。请在这个问题上帮助我。提前谢谢你。

【问题讨论】:

  • 错误代码 -13 是 CONNECT_CREDENTIAL_NOT_FOUND。也许您将证书放在错误的地方或名称与上述代码不匹配?

标签: arduino arduino-yun aws-iot


【解决方案1】:

对于遇到此问题的其他任何人,我只是在运行基于 ThingSample 的先前工作的代码时遇到了这个问题。使用最新的 api (2.1.0),据我所知,放置 certs 文件夹的位置似乎已经改变。该文件夹应位于 /root/AWS-IoT-Python-Runtime/runtime/certs 中。不幸的是,安装脚本没有将证书放在该文件夹中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-25
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 2021-01-24
    • 2019-07-23
    相关资源
    最近更新 更多