Comments (2)
You can get the desired shadow from AWS by publishing to the topic $aws/things/myThingName/shadow/get and subscribe topic $aws/things/myThingName/shadow/get/accepted.
When you publish a message to the topic $aws/things/myThingName/shadow/get, AWS IoT will publish a response state document to $aws/things/myThingName/shadow/get/accepted.
from aws-mqtt-websockets.
@Huong-nt This worked! Thank you so much! I will submit another pull request with an example when it functions correctly and is somewhat clean. With the example given, I modded/added:
const char* aws_topic_publish = "$aws/things/Device1/shadow/get";
const char* aws_topic_subscribe = "$aws/things/Device1/shadow/get/accepted";
Then modified the subscribe function like so:
//subscribe to a mqtt topic
void subscribe () {
//subscrip to a topic
int rc = client->subscribe(aws_topic_subscribe, MQTT::QOS0, messageArrived);
if (rc != 0) {
if (DEBUG_PRINT) {
Serial.print("rc from MQTT subscribe is ");
Serial.println(rc);
}
return;
}
if (DEBUG_PRINT) {
Serial.println("MQTT subscribed");
}
}
Serial output looks like:
MQTT subscribed
Message 1 arrived: qos 0, retained 0, dup 0, packetid 16383
Payload {"state":{"desired":{"on":false},"reported":{"on":false}},"metadata":{"desired":{"on":{"timestamp":1487734811}},"reported":{"on":{"timestamp":1487734811}}},"version":36,"timestamp":1487735007}
from aws-mqtt-websockets.
Related Issues (20)
- undefined reference to 'gmtime_r' in Stream.h and AWSWebSocketClient.h HOT 1
- Not seeing aws subscribed messages
- Fatal exception 3(LoadStoreErrorCause) with NodeMCU
- How can I publish a command to esp8266 from AWS? HOT 1
- pubsubclient sample cannot compile cannot declare variable 'awsWSclient' to be of abstract type 'AWSWebSocketClient' HOT 11
- Incompatibility with TimeLib 1.5
- While Using PubSub Example reconnections are still Happening every 5 secs
- Putting a private key on the device represents a HUGE security flaw HOT 4
- Eratic connection HOT 1
- Callback function doesn't execute while sub on get/accepted shadow HOT 1
- Using SessionToken to connect to AWS IoT Core
- ESP8266 AWS web socket connection fails because of BearSSL HOT 3
- Connection failed because of inproper initialization HOT 4
- How to connect by certificates instead of aws_key and aws_secret HOT 5
- Exception 3: LoadStoreError: Processor internal physical address or data error during load or store HOT 2
- 403 forbidden response from aws while handshake
- Exception 28 error HOT 2
- Unable to compile HOT 2
- Max payload size is 100 char
- Compiling error: no match for 'operator+=' (operand types are 'String' and 'char [(<anonymous> + 1)]') HOT 2
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 aws-mqtt-websockets.