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

질문됨 일 년 전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
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인