Cannot publish to IoT-Core using python script (Raspberry Pi)

0

Hi there,

I've been struggling trying to publish a simple "Hello world" to AWS IoT core from my pi. Whenever I run my script it always timesout at mqttClient.connect().

I connected the device which automatically generated the certification and key files. Installed AWSIoTPython in terminal.

However I installed AWSIoTPython SDK v2 with: python3 - m pip install awsiotsdk

When I unzipped the zip folder you download when connecting a new device, and then entered the "./start.sh" command it successfully connected and published and subscribed "hello world" when it ran the pubsub.py script.

The code I have I feel is verbatim the successful examples I've seen online and the credential paths are copied directly from their folder.

Not sure what else to do to troubleshoot...

Thanks,

-Zach

質問済み 1年前258ビュー
1回答
0

Check that you are using the same clientid for the connection and the same topics to publish and subscribe. The certificate is associated to an AWS IoT Policy which is scoped down to some specific permission, including which clientId is allowed to connect and which topics the client can publish and subscribe to.

You can find more information about IoT Policies in the documentation.

https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html

AWS
エキスパート
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ