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

gefragt vor einem Jahr258 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen