All Projects → mariocannistra → Python Paho Mqtt For Aws Iot

mariocannistra / Python Paho Mqtt For Aws Iot

Licence: mit
Use Python and paho client with AWS IoT for MQTT messaging

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Paho Mqtt For Aws Iot

Cloudiscovery
The tool to help you discover resources in the cloud environment
Stars: ✭ 298 (+338.24%)
Mutual labels:  aws-cli, aws-iot
Serverless Chat
A serverless web chat built using AWS Lambda, AWS IoT (for WebSockets) and Amazon DynamoDB
Stars: ✭ 99 (+45.59%)
Mutual labels:  aws-iot, mqtt
React Native Aws Iot Device Shadows
React Native Component for connecting to AWS IoT Shadows from a device using SDK JavaScript bundle
Stars: ✭ 30 (-55.88%)
Mutual labels:  aws-iot, mqtt
Aws Mqtt Client
AWS Websocket Pub/Sub client
Stars: ✭ 147 (+116.18%)
Mutual labels:  aws-iot, mqtt
Aws Iot Chat Example
💬 Chat application using AWS IoT platform via MQTT over the WebSocket protocol
Stars: ✭ 474 (+597.06%)
Mutual labels:  aws-iot, mqtt
Thingsboard Gateway
Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
Stars: ✭ 796 (+1070.59%)
Mutual labels:  aws-iot, mqtt
Aws Iot Certificate Vending Machine
The CVM allows a device to apply for its own certificate and installation.
Stars: ✭ 64 (-5.88%)
Mutual labels:  aws-iot, mqtt
Mqtt blackbox exporter
Prometheus Exporter for MQTT monitoring
Stars: ✭ 57 (-16.18%)
Mutual labels:  mqtt
What Mqtt
What MQTT? MQTT on websocket sample.
Stars: ✭ 64 (-5.88%)
Mutual labels:  mqtt
Luamqtt
luamqtt - Pure-lua MQTT v3.1.1 and v5.0 client
Stars: ✭ 58 (-14.71%)
Mutual labels:  mqtt
Addon Zwave2mqtt
Z-Wave to MQTT - Home Assistant Community Add-ons
Stars: ✭ 58 (-14.71%)
Mutual labels:  mqtt
Mqtt
MQTT broker written in D, using vibe.d
Stars: ✭ 59 (-13.24%)
Mutual labels:  mqtt
Mhi Ac Ctrl
Reads and writes data (e.g. power, mode, fan status etc.) from/to a Mitsubishi Heavy Industries (MHI) air conditioner (AC) via SPI controlled by MQTT
Stars: ✭ 64 (-5.88%)
Mutual labels:  mqtt
Pysmartnode
Micropython Smarthome framework
Stars: ✭ 58 (-14.71%)
Mutual labels:  mqtt
Lwmqtt
a light weight MQTT implementation
Stars: ✭ 67 (-1.47%)
Mutual labels:  mqtt
Mqtt Siemens S7 300
MQTT library block written in Siemens SCL for S7-300 PLC with CP343-1
Stars: ✭ 57 (-16.18%)
Mutual labels:  mqtt
Mqtt Chat
MQTT Chat Using Mosca
Stars: ✭ 67 (-1.47%)
Mutual labels:  mqtt
Blinker Library
An IoT Solution,Blinker library for embedded hardware. Works with Arduino, ESP8266, ESP32.
Stars: ✭ 1,095 (+1510.29%)
Mutual labels:  mqtt
Cocoamqtt
MQTT for iOS and macOS written with Swift
Stars: ✭ 1,129 (+1560.29%)
Mutual labels:  mqtt
Aws Cli Docker
Docker container with the AWS CLI
Stars: ✭ 62 (-8.82%)
Mutual labels:  aws-cli

Python, paho, mqtt and AWS IoT

Platforms supported

I've tested the certificate creation commands only on Windows using the AWS CLI. I think they should work on the AWS CLI of other platforms.

My python programs run perfectly on:

  • Raspberry PI 2 with Raspbian Jessie and Python 2.7
  • Debian Jessie virtual machine with Python 2.7
  • Windows with Python 3.4 installed by Conda

Create a thing, certifcate, keys and attaching them to enable usage of AWS IoT hub

Based on AWS docs found here: http://docs.aws.amazon.com/iot/latest/developerguide/secure-communication.html

Create one thing in aws IoT:

aws iot create-thing --thing-name "myThingName"

list the things you now have:

aws iot list-things

create certificate and keys:

aws iot create-keys-and-certificate --set-as-active --certificate-pem-outfile cert.pem --public-key-outfile publicKey.pem --private-key-outfile privkey.pem

take note of the certificate-arn in the output or, if you forgot to copy the certificate-arn you can get it listing the certificates with:

aws iot list-certificates

download root certificate from this URL using your browser and save it with filename: aws-iot-rootCA.crt

create a policy from the file provided:

aws iot create-policy --policy-name "PubSubToAnyTopic" --policy-document file://iotpolicy.json

paste your certificate-arn inside the following command before entering it:

aws iot attach-principal-policy --principal "certificate-arn" --policy-name "PubSubToAnyTopic"

Two options about the configuration of your endpoint:

  • change the value of awshost using the returned value of "endpointAddress":
aws iot describe-endpoint
  • use data hostname and specify the region with the one you used to create the thing and certificates. Current sample code contains data.iot.eu-west-1.amazonaws.com (I will try to understand which are the benefits, if any, of one over the other).

At this point my sample python programs ( awsiotpub.py and awsiotsub.py ) should run correctly but the AWS documentation specifies to also enter the following to attach the certificate to the thing:

aws iot attach-thing-principal --thing-name "myThingName" --principal "certificate-arn"

How to test the sample Python programs

  • open two console windows and enter in the first awsiotsub.py and in the second awsiotpub.py
  • the second one will start sending random temperature values to the AWS IoT hub
  • the first one will display them when received from the IoT hub

You can check the sources and modify the topics used by both programs to better fit your needs. Currently, awsiotsub.py subscribes to any topic and will show all of the received msgs.

Enjoy MQTT and AWS IoT in your Python programs!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].