Comments (5)
Hello Srini.
Those 2 variables ( clientId and thingName ) are not used here and you can delete those 2 lines, the examples will still work fine. If you want to distinguish data being sent from different IoT devices you can easily set the messages "topic" that work in a "tree like" way. Good documentation here: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html#_Toc442180919
I wrote these example programs when working at my radio-astronomy project https://www.hackster.io/mariocannistra/radio-astronomy-with-rtl-sdr-raspberrypi-and-amazon-aws-iot-45b617
In next version of that project I will probably use those two variables to identify different receiving stations sending data using MQTT on Raspberry PI.
Kind regards,
Mario
from python-paho-mqtt-for-aws-iot.
Dear Mario,
Thanks for the reply, Yes, understood
My need is to send the messages to thing shadow - if you can show me how to pass these two variables in API will be great and sincerely appreciated
Regards,
Srini
from python-paho-mqtt-for-aws-iot.
Dear Mario,
By the way your Astronomy project is Very Very Cool and I wish you all the best
Best,
Srini
from python-paho-mqtt-for-aws-iot.
Thank you Srini. I hope to publish version 2 soon.
To update the state of a thing shadow you must send a properly formatted json message and in this case use the proper thing name.
To try this you can delete this line:
mqttc.publish("temperature", tempreading, qos=1)
and replace it with:
jsonMessage = "{ \"state\": { \"reported\": { \"temperature\": " + str(tempreading) + "} } }"
mqttc.publish("$aws/things/**myThingName**/shadow/update", jsonMessage, qos=1)
In this way you will update the state of the shadow for the thing named "myThingName". Obviously you have to use here the name that you used when creating the thing, certificates, etc like explained in my instructions.
You can check the shadow state on the AWS IoT dashboard. Selecting the thing and looking at the right side panel you will see something like:
Some useful docs:
http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-mqtt.html
http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-document.html#thing-shadow-example
http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-document-syntax.html
Ciao,
Mario
from python-paho-mqtt-for-aws-iot.
Thank you very much Mario,
Greatly appreciated !
Best Regards,
Srini
from python-paho-mqtt-for-aws-iot.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-paho-mqtt-for-aws-iot.