aws / aws-iot-device-sdk-arduino-yun Goto Github PK
View Code? Open in Web Editor NEWSDK for connecting to AWS IoT from an Arduino Yún.
License: Apache License 2.0
SDK for connecting to AWS IoT from an Arduino Yún.
License: Apache License 2.0
Question: Are there plans to incorporate the ability to include a Last Will and Testament at the connect stage? Or is there already a way to do this?
See "Detecting a Thing is Connected", here:
http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-data-flow.html
I recently was able to get my Raspberry Pi to connect to AWS
I am attempting to build a gateway with the Yun (my LAN on one end, AWS IoT on the other). Specifically, I have a set of Philips Hue bulbs, the state of which I'd like to keep in Device Shadows. (Also, remote control would be awesome.)
I have set up the SDK on my Yun and successfully connected, set up the Shadow, updated it, and registered my delta function callback. However, when I try to integrate this with Philips Hue control, it breaks.
My Hue communication code:
void setup() {
// Initialize Bridge
Bridge.begin();
// Initialize Serial
Serial.begin(9600);
// Wait until a Serial Monitor is connected.
while (!Serial);
// Authenticate with Hue bridge (uncomment this if connecting to bridge for first time).
//authenticate();
// Turn lights on
runCurl(true);
}
/*
* Launches "curl" command and sends state to lights
*/
void runCurl(boolean on) {
// Create process over Yun's bridge
Process p;
// Launch curl command
p.begin("curl");
String s1 = String(" -d ");
String quote = String('"');
// Set payload
String payload;
if (on) {
if (isOn) {
// Update color with transition time
payload = String("{\"hue\":" + String(hue) + ",\"bri\":" + String(sat) + ",\"transitiontime\":" + String(50) + "}");
}
else {
// Turn light on
payload = String("{\"on\":true,\"hue\":" + String(hue) + ",\"bri\":" + String(sat) + "}");
}
}
else {
// Turn light off
payload = String("{\"on\":false,\"hue\":" + String(hue) + ",\"bri\":" + String(sat) + "}");
}
// Set new state
isOn = on;
// Build request
String url = String("http:/");
String url2 = String("/" + BRIDGE_IP + "/api/19aa6134f32d16f3fa3e75cdc0ed7/groups/0/action");
String params = s1 + quote + payload + quote + url + url2;
p.addParameter("-d");
p.addParameter(payload);
p.addParameter("-X");
p.addParameter("PUT");
p.addParameter(url + url2);
// Run the process and synchronously wait for its terimination
p.run();
// Read process output stream; uncomment to print stream over serial
while (p.available()>0) {
char c = p.read();
// Serial.print(c);
}
// Ensure the last bit of data is sent
Serial.flush();
}
It seems that both the Hue communication and the AWS IoT SDK require access to the Bridge in such a way that they cannot coexist. Is this correct? If so, is there any way to send a web request (using a CURL Process or not) while the SDK is running? If not, this would be a huge bummer....
Wanted to add a few extra variables to the json but keep getting an error. Am i treating the different variable correctly
#include <aws_iot_mqtt.h>
#include <aws_iot_version.h>
#include "aws_iot_config.h"
aws_iot_mqtt_client myClient;
char JSON_buf[400];
char float_buf[5];
char float_buf1[5];
char float_buf2[5];
char float_buf3[5];
char float_buf4[5];
char float_buf5[5];
char float_buf6[5];
char float_buf7[5];
float reportedTemp = 70.0;
float desiredTemp = 70.0;
float TRHtemp = 0;
float TRHhumid = 0;
float BMP = 0;
float BMPtemp = 0;
float BMPalt = 0;
float CO2 = 0;
float Therm = 0;
int cnt = 0;
int rc = 1;
bool success_connect = false;
bool print_log(const char* src, int code) {
bool ret = true;
if(code == 0) {
#ifdef AWS_IOT_DEBUG
Serial.print(F("[LOG] command: "));
Serial.print(src);
Serial.println(F(" completed."));
#endif
ret = true;
}
else {
#ifdef AWS_IOT_DEBUG
Serial.print(F("[ERR] command: "));
Serial.print(src);
Serial.print(F(" code: "));
Serial.println(code);
#endif
ret = false;
}
Serial.flush();
return ret;
}
void msg_callback_delta(char* src, unsigned int len, Message_status_t flag) {
if(flag == STATUS_NORMAL) {
// Get Temp section in delta messages
print_log("getDeltaKeyValue", myClient.getDeltaValueByKey(src, "Temp", JSON_buf, 50));
desiredTemp = String(JSON_buf).toFloat();
}
}
void setup() {
Serial.begin(115200);
while(!Serial);
char curr_version[80];
snprintf_P(curr_version, 80, PSTR("AWS IoT SDK Version(dev) %d.%d.%d-%s\n"), VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_TAG);
Serial.println(curr_version);
if(print_log("setup", myClient.setup(AWS_IOT_CLIENT_ID))) {
if(print_log("config", myClient.config(AWS_IOT_MQTT_HOST, AWS_IOT_MQTT_PORT, AWS_IOT_ROOT_CA_PATH, AWS_IOT_PRIVATE_KEY_PATH, AWS_IOT_CERTIFICATE_PATH))) {
if(print_log("connect", myClient.connect())) {
success_connect = true;
print_log("shadow init", myClient.shadow_init(AWS_IOT_MY_THING_NAME));
print_log("register thing shadow delta function", myClient.shadow_register_delta_func(AWS_IOT_MY_THING_NAME, msg_callback_delta));
}
}
}
}
void loop() {
if(success_connect) {
// If the desired temperature is set to a higher value, start heating.
if(desiredTemp - reportedTemp > 0.001) {reportedTemp += 0.1;}
// If the desired temperature is set to a lower value, start cooling.
else if(reportedTemp - desiredTemp > 0.001) {reportedTemp -= 0.1;}
TRHtemp = random(10, 100);
TRHhumid = random(10, 100);
BMP = random(10, 100);
BMPtemp = random(10, 100);
BMPalt = random(10, 100);
CO2 = random(10, 100);
Therm = random(10, 100);
dtostrf(reportedTemp, 4, 1, float_buf);
dtostrf(TRHtemp, 4, 1, float_buf1);
dtostrf(TRHhumid, 4, 1, float_buf2);
dtostrf(BMP, 4, 1, float_buf3);
dtostrf(BMPtemp, 4, 1, float_buf4);
dtostrf(BMPalt, 4, 1, float_buf5);
dtostrf(CO2, 4, 1, float_buf6);
dtostrf(Therm, 4, 1, float_buf7);
float_buf[4] = '\0';
float_buf1[4] = '\0';
float_buf2[4] = '\0';
float_buf3[4] = '\0';
float_buf4[4] = '\0';
float_buf5[4] = '\0';
float_buf6[4] = '\0';
float_buf7[4] = '\0';
sprintf_P(JSON_buf, PSTR("{\"state\":{\"reported\":{\"TRHtemp\":%s,\"TRHhumid\":%s,\"BMP\":%s,\"BMPtemp\":%s,\"BMPalt\":%s,\"CO2\":%s,\"Therm\":%s}}}"), float_buf1,float_buf2,float_buf3,float_buf4,float_buf5,float_buf6,float_buf7);
print_log("shadow update", myClient.shadow_update(AWS_IOT_MY_THING_NAME, JSON_buf, strlen(JSON_buf), NULL, 5));
if(myClient.yield()) {
Serial.println("Yield failed.");
}
delay(1000); // check for incoming delta per 1000 ms
}
}
I am experiencing a situation where the shadow_update
function seems to work once, but will then fail. I believe it returns GENERIC_ERROR
(-1). This is the output from serial monitor:
eption in thread Thread-4 (most likely raised during interpr5
/bin/ash: su: not found
/bin/ash: my-thing-name: not found
}
/bin/ash: 1: not found
/bin/ash: 5: not found
and...
: No messages.
/bin/ash: su: not found
/bin/ash: my-thing-name: not found
}
/bin/ash: 2: not found
/bin/ash: 5: not found
and
/bin/ash: 5: not found
/bin/ash: su: not found
/bin/ash: my-thing-name: not found
}
/bin/ash: 2: not found
/bin/ash: 5: not found
Later I am getting a yield error:
/bin/ash: 1: not found
/bin/ash: z: not found
Yield failed.
-35
...where -35
is the result of myClient.yield()
This is from my log:
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Started a subscribe request 1
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:_resubscribeCount: -1
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Subscribe request 1 sent.
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Subscribe request 1 succeeded. Time consumption: 40.0ms.
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Recover subscribe context for the next request: subscribeSent: False
INFO:AWSIoTPythonSDK.core.shadow.deviceShadow:Subscribed to delta topic for deviceShadow: my-thing-name
DEBUG:comm.serialCommunicationServer:Updated serialCommunicationServer internal protocolMessageQueue by inserting a new message. Size: 1
DEBUG:comm.serialCommunicationServer:Send through serial to remote client: S_RD T Size: 6
DEBUG:comm.serialCommunicationServer:Clear internal list. Size: 0
DEBUG:comm.serialCommunicationServer:Accept-timer starts, with acceptTimeout: 10 second(s).
DEBUG:comm.serialCommunicationServer:5 lines to be received. Loop begins.
DEBUG:comm.serialCommunicationServer:Received: 1/5 Message is: su
DEBUG:comm.serialCommunicationServer:Received: 2/5 Message is: my-thing-name
DEBUG:comm.serialCommunicationServer:Received: 3/5 Message is: {"state":{"reported":{"something": 0.00}}}
DEBUG:comm.serialCommunicationServer:Received: 4/5 Message is: 1
DEBUG:comm.serialCommunicationServer:Received: 5/5 Message is: 5
DEBUG:comm.serialCommunicationServer:Finish reading from remote client. Accept-timer ends.
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Started a subscribe request 2
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:_resubscribeCount: -1
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Subscribe request 2 sent.
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Subscribe request 2 succeeded. Time consumption: 30.0ms.
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Recover subscribe context for the next request: subscribeSent: False
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Started a subscribe request 3
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:_resubscribeCount: -1
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Subscribe request 3 sent.
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Subscribe request 3 succeeded. Time consumption: 80.0ms.
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Recover subscribe context for the next request: subscribeSent: False
INFO:AWSIoTPythonSDK.core.shadow.deviceShadow:Subscribed to update accepted/rejected topics for deviceShadow: my-thing-name
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Try to put a publish request 4 in the TCP stack.
DEBUG:AWSIoTPythonSDK.core.protocol.mqttCore:Publish request 4 succeeded.
DEBUG:comm.serialCommunicationServer:Updated serialCommunicationServer internal yieldMessageQueue by inserting a new message. Size: 1
DEBUG:AWSIoTPythonSDK.core.shadow.deviceShadow:shadow message clientToken: seeed02_my-thing-name_0_bnpyc
DEBUG:comm.serialCommunicationServer:Updated serialCommunicationServer internal protocolMessageQueue by inserting a new message. Size: 1
DEBUG:AWSIoTPythonSDK.core.shadow.deviceShadow:Token is in the pool. Type: accepted
DEBUG:comm.serialCommunicationServer:Send through serial to remote client: SU T Size: 4
DEBUG:comm.serialCommunicationServer:Updated serialCommunicationServer internal yieldMessageQueue by inserting a new message. Size: 2
DEBUG:comm.serialCommunicationServer:Clear internal list. Size: 0
DEBUG:comm.serialCommunicationServer:Accept-timer starts, with acceptTimeout: 10 second(s).
DEBUG:comm.serialCommunicationServer:1 lines to be received. Loop begins.
DEBUG:comm.serialCommunicationServer:Received: 1/1 Message is: z
DEBUG:comm.serialCommunicationServer:Finish reading from remote client. Accept-timer ends.
DEBUG:comm.serialCommunicationServer:Updated serialCommunicationServer internal protocolMessageQueue by inserting a new message. Size: 1
DEBUG:comm.serialCommunicationServer:Send through serial to remote client: Z T Size: 3
DEBUG:comm.serialCommunicationServer:Clear internal list. Size: 0
DEBUG:comm.serialCommunicationServer:Accept-timer starts, with acceptTimeout: 10 second(s).
DEBUG:comm.serialCommunicationServer:1 lines to be received. Loop begins.
DEBUG:comm.serialCommunicationServer:Received: 1/1 Message is: y
DEBUG:comm.serialCommunicationServer:Finish reading from remote client. Accept-timer ends.
DEBUG:comm.serialCommunicationServer:Start sending a new message to remote client: Y 0 0 JSON-2
DEBUG:comm.serialCommunicationServer:Send through serial to remote client. Chunk: Y 0 0 JSON-2 Size: 12
DEBUG:comm.serialCommunicationServer:Clear internal list. Size: 0
DEBUG:comm.serialCommunicationServer:Accept-timer starts, with acceptTimeout: 10 second(s).
DEBUG:comm.serialCommunicationServer:4 lines to be received. Loop begins.
DEBUG:comm.serialCommunicationServer:Received: 1/4 Message is: j
DEBUG:comm.serialCommunicationServer:Received: 2/4 Message is: JSON-2
DEBUG:comm.serialCommunicationServer:Received: 3/4 Message is: state"target
DEBUG:comm.serialCommunicationServer:Received: 4/4 Message is: 1
DEBUG:comm.serialCommunicationServer:Finish reading from remote client. Accept-timer ends.
DEBUG:comm.serialCommunicationServer:Updated serialCommunicationServer internal json buffer with a new JSON payload of size: 5
DEBUG:comm.serialCommunicationServer:JSON: Send through serial to remote client. Chunk: J 9.9 Size: 5
DEBUG:comm.serialCommunicationServer:Clear internal list. Size: 0
DEBUG:comm.serialCommunicationServer:Accept-timer starts, with acceptTimeout: 10 second(s).
DEBUG:comm.serialCommunicationServer:4 lines to be received. Loop begins.
DEBUG:comm.serialCommunicationServer:Received: 1/4 Message is: j
DEBUG:comm.serialCommunicationServer:Received: 2/4 Message is: JSON-2
DEBUG:comm.serialCommunicationServer:Received: 3/4 Message is: state"target
DEBUG:comm.serialCommunicationServer:Received: 4/4 Message is: 0
DEBUG:comm.serialCommunicationServer:Finish reading from remote client. Accept-timer ends.
DEBUG:comm.serialCommunicationServer:No more chunks for this JSON payload. Exiting writeToExternalJSON.
DEBUG:comm.serialCommunicationServer:Clear internal list. Size: 0
DEBUG:comm.serialCommunicationServer:Accept-timer starts, with acceptTimeout: 10 second(s).
DEBUG:comm.serialCommunicationServer:1 lines to be received. Loop begins.
DEBUG:comm.serialCommunicationServer:Received: 1/1 Message is: y
DEBUG:comm.serialCommunicationServer:Finish reading from remote client. Accept-timer ends.
DEBUG:comm.serialCommunicationServer:Start sending a new message to remote client: Y 1 0 JSON-0
DEBUG:comm.serialCommunicationServer:Send through serial to remote client. Chunk: Y 1 0 JSON-0 Size: 12
DEBUG:comm.serialCommunicationServer:Clear internal list. Size: 0
DEBUG:comm.serialCommunicationServer:Accept-timer starts, with acceptTimeout: 10 second(s).
DEBUG:comm.serialCommunicationServer:1 lines to be received. Loop begins.
DEBUG:comm.serialCommunicationServer:Received: 1/1 Message is: y
DEBUG:comm.serialCommunicationServer:Finish reading from remote client. Accept-timer ends.
DEBUG:comm.serialCommunicationServer:No more messages for yield. Exiting writeToExternalYield.
DEBUG:comm.serialCommunicationServer:Clear internal list. Size: 0
DEBUG:comm.serialCommunicationServer:Accept-timer starts, with acceptTimeout: 10 second(s).
DEBUG:comm.serialCommunicationServer:Raise a custom exception for accept timeout.
So I am trying to publish 4 ct measures to my topic but it seems to not publish when the title length is too long. Below is my code
#include <aws_iot_mqtt.h>
#include <aws_iot_version.h>
#include "aws_iot_config.h"
#include <Process.h>
#include "EmonLib.h"
EnergyMonitor emon1;
EnergyMonitor emon2;
EnergyMonitor emon3;
EnergyMonitor emon4;
aws_iot_mqtt_client myClient; // init iot_mqtt_client
char msg[32]; // read-write buffer
char data[100];
Process date;
int cnt = 0; // loop counts
int rc = -100; // return value placeholder
bool success_connect = false; // whether it is connected
// Basic callback function that prints out the message
void msg_callback(char* src, unsigned int len, Message_status_t flag) {
if(flag == STATUS_NORMAL) {
Serial.println("CALLBACK:");
int i;
for(i = 0; i < (int)(len); i++) {
Serial.print(src[i]);
}
Serial.println("");
}
}
void setup() {
// Start Serial for print-out and wait until it's ready
Serial.begin(115200);
while(!Serial)
//
emon1.current(0, 111.1);
emon2.current(1, 111.1);
emon3.current(2, 111.1);
emon4.current(3, 111.1);
char curr_version[80];
snprintf_P(curr_version, 80, PSTR("AWS IoT SDK Version(dev) %d.%d.%d-%s\n"), VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_TAG);
Serial.println(curr_version);
// Set up the client
if((rc = myClient.setup(AWS_IOT_CLIENT_ID)) == 0) {
// Load user configuration
if((rc = myClient.config(AWS_IOT_MQTT_HOST, AWS_IOT_MQTT_PORT, AWS_IOT_ROOT_CA_PATH, AWS_IOT_PRIVATE_KEY_PATH, AWS_IOT_CERTIFICATE_PATH)) == 0) {
// Use default connect: 60 sec for keepalive
if((rc = myClient.connect()) == 0) {
success_connect = true;
// Subscribe to "topic1"
if((rc = myClient.subscribe("greenhouse/ct_sensor", 1, msg_callback)) != 0) {
Serial.println("Subscribe failed!");
Serial.println(rc);
}
}
else {
Serial.println(F("Connect failed!"));
Serial.println(rc);
}
}
else {
Serial.println(F("Config failed!"));
Serial.println(rc);
}
}
else {
Serial.println(F("Setup failed!"));
Serial.println(rc);
}
// Delay to make sure SUBACK is received, delay time could vary according to the server
delay(2000);
}
void loop() {
if(success_connect) {
double Irms = emon1.calcIrms(1480);
double Irms2 = emon2.calcIrms(1480);
double Irms3 = emon3.calcIrms(1480);
//double Irms4 = emon4.calcIrms(1480);
int IrmsShadow = Irms/4.67;
int IrmsShadow2 = Irms2/4.67;
int IrmsShadow3 = Irms2/4.67;
int IrmsShadow4 = Irms2/4.67;
//Creating the JSON payload
String thing_id = "\"id\": \"" +String(AWS_IOT_MY_THING_NAME) +"\"" ;
String currentcurrent = ", \"ct_1\": " + String(IrmsShadow) ;
String currentcurrent2 = ", \"ct_2\": " + String(IrmsShadow2) ;
String currentcurrent3 = ", \"ct_3\": " + String(IrmsShadow3) ;
String currentcurrent4 = ", \"ct_4\": " + String(IrmsShadow4) ;
// Add both value together to send as one string.
String value = thing_id + currentcurrent + currentcurrent2 + currentcurrent3 + currentcurrent4;
Serial.println(value);
String payload = "{" + value + "}";
payload.toCharArray(data, (payload.length() + 1));
Serial.println(strlen(data));
if((rc = myClient.publish("greenhouse/ct_sensor", data, strlen(data), 1, false)) != 0) {
Serial.println(F("Publish failed!"));
Serial.println(rc);
}
// Get a chance to run a callback
if((rc = myClient.yield()) != 0) {
Serial.println("Yield failed!");
Serial.println(rc);
}
// Done with the current loop
sprintf_P(msg, PSTR("loop %d done"), cnt++);
Serial.println(msg);
delay(1000);
}
}
By changing id to thing_id it will not publish my message. when i do Serial.println(strlen(data));
it goes from 66 to 0. I have now clue what I'm doing wrong.
I have setup my Arduino Yun as instructed in the Readme file in https://github.com/aws/aws-iot-device-sdk-arduino-yun.
Caveat:
I am using Win 7 64-bit. I could upload the blink example to the Yun for sanity check.
I could get Yun to commuicate with AWS IoT through the python examples. But it did not work with the Arduino code. The serial monitor returned a setup error -1. There are probably some steps or configurations that I have missed or incorrectly done but I could not find what they were.
AWS IoT SDK Version(dev) 2.2.0-
YunTestTwo
YunTestTwo
a*************8.iot.us-east-2.amazonaws.com (I intentionally covered the my endpoint on this post)
8883
/root/AWS-IoT-Python-Runtime/certs/root-CA.crt
/root/AWS-IoT-Python-Runtime/certs/YunTestTwo.private.key
/root/AWS-IoT-Python-Runtime/certs/YunTestTwo.cert.pem
[ERR] command: setup code: -1
My initial setup with AWS IoT was to follow the instructions in Connect from the IoT menu. My steps were
Next, in the Arduino code, I opened the ThermostatSimulatorDevice example and modified aws_iot_config.h.
#define AWS_IOT_MQTT_HOST "a***********8.iot.us-east-2.amazonaws.com" // your endpoint
#define AWS_IOT_MQTT_PORT 8883 // your port
#define AWS_IOT_CLIENT_ID "YunTestTwo" // your client ID
#define AWS_IOT_MY_THING_NAME "YunTestTwo" // your thing name
#define AWS_IOT_ROOT_CA_FILENAME "root-CA.crt" // your root-CA filename
#define AWS_IOT_CERTIFICATE_FILENAME "YunTestTwo.cert.pem" // your certificate filename
#define AWS_IOT_PRIVATE_KEY_FILENAME "YunTestTwo.private.key" // your private key filename
I even modified AWS_IOT_PATH_PREFIX
from "../certs/"
to "/root/AWS-IoT-Python-Runtime/certs/"
but still got the same error.
Thank you in advance for reading my issue and helping me.
Using a Seeeduino Cloud (essentially like the Arduino Yun). My code was working fine. I got everything to how I wanted it. Then, I did not plug it in for a couple weeks. AWS, it appears (this is a guess) clears out all records of an IoT Thing after no activity for two weeks. So when I logged back in one day, I found nothing registered, no certificates, no policy, everything gone.
So, I had to create it all again.
Uploaded the new certificate files onto the board. Changed the file names in the sketch's aws_iot_config.h . Now it gives an error -10 when running the example sketches, which I see is CONNECT_SSL_ERROR = -10.
Any idea what would cause this? Any way to "reset" the Dragino board to pristine condition and then do everything over? But perhaps that would not solve it -- it may be a problem on the cloud end? I did set up IAM in the meantime -- would that break it?
Good evening im having problems when running the Sample bits of code.
Im using and Arduino yun, and I keep getting
AWS IoT SDK Version(dev) 1.0.3-
Connect failed!
When trying to run BasicPubSub.
Pls advise
Hi,
I'm having the same issue described on other closed issues. When running this basic example I get:
AWS IoT SDK Version(dev) 2.2.0-
Setup failed!
-5
I added the line
Serial.println(rw_buf);
after this one and the output was:
AWS IoT SDK Version(dev) 2.2.0-
Setup failed!
-5
I also run cat /proc/cmdline
on the board and the out put was:
board=linino-yun console=ttyATH0,250000 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd mem=64M rootfstype=squashfs,jffs2 noinitrd
I also confirmed having an internet connection by doing ping:
root@mydevice:~/AWS-IoT-Python-Runtime/lib# ping github.com
PING github.com (192.30.253.112): 56 data bytes
64 bytes from 192.30.253.112: seq=0 ttl=52 time=79.618 ms
64 bytes from 192.30.253.112: seq=1 ttl=52 time=68.120 ms
64 bytes from 192.30.253.112: seq=2 ttl=52 time=70.041 ms
64 bytes from 192.30.253.112: seq=3 ttl=52 time=70.931 ms
^C
--- github.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 68.120/72.177/79.618 ms
I'm using WiFi and I cannot use the Ethernet port to test.
I kept getting SERIAL1_COMMUNICATION_ERROR (-5) on re-upload. Always had to reset the Yun over again.
void setup() {
Serial.begin(115200);
while(!Serial);
if ((rc = myClient.setup(AWS_IOT_CLIENT_ID)) == 0) {
Serial.println(F("Begin setup..."));
// ...
} else {
// This two lines print out rc = -5
Serial.println(F("Setup failed"));
Serial.println(rc);
}
Hi, I've tried to enable logging for the PubSub example.
I replaced the following code in the runtimeHub.py init function
from;
self._logManagerHub.disable()
to;
self._logManagerHub.enable()
self._logManagerHub.enableFileOutput()
The previously running example now fails consistently with a -1 error.
AWS IoT SDK Version(dev) 1.0.3-
Setup failed!
-1
The logger does create a new log;
[2016-03-04 14:10:41.256372] Register timeout signal handler. [2016-03-04 14:10:41.272485] serialCommunicationServer init. [2016-03-04 14:10:41.277257] serialCommunicationServer set accept timeout to 15 [2016-03-04 14:10:41.282366] serialCommunicationServer set chunk size to 50 [2016-03-04 14:10:41.287254] Clear internal list. Size: 0 [2016-03-04 14:10:41.291974] Accept-timer starts, with acceptTimeout: 15 second(s). [2016-03-04 14:10:41.296875] 4 lines to be received. Loop begins. [2016-03-04 14:10:41.301735] Received: 1/4 Message is: i [2016-03-04 14:10:41.306648] Received: 2/4 Message is: cvmon1 [2016-03-04 14:10:41.311479] Received: 3/4 Message is: 1 [2016-03-04 14:10:41.316364] Received: 4/4 Message is: 4 [2016-03-04 14:10:41.321048] Finish reading from remote client. Accept-timer ends. [2016-03-04 14:10:41.330683] Paho MQTT Client init. [2016-03-04 14:10:41.337009] Register Paho MQTT Client callbacks. [2016-03-04 14:10:41.341630] mqttCore init. [2016-03-04 14:10:41.346389] Set maximum connect/disconnect timeout to be 10 second. [2016-03-04 14:10:41.351113] Set maximum MQTT operation timeout to be 5 second [2016-03-04 14:10:41.356251] Updated serialCommunicationServer internal protocolMessageQueue by inserting a new message. Size: 1 [2016-03-04 14:10:41.361421] Send through serial to remote client: I T Size: 3 [2016-03-04 14:10:41.366106] Clear internal list. Size: 0 [2016-03-04 14:10:41.370721] Accept-timer starts, with acceptTimeout: 15 second(s). [2016-03-04 14:10:56.370924] Raise a custom exception for accept timeout. [2016-03-04 14:10:56.373646] Accept Timeout
Have I missed something in enabling logging?
Thanks,
Jeff
Hi, was wondering if there was any way to save my readings I am getting to a file on the SD card while using aws iot sdk?
THanks
Hi All,
I have noticed there is a bug whereby you can't access key/value pairs when the value begins with an uppercase F.
Shadow state
{"state":{"desired":{"text":"Foxtrot"}}}
myClient.getDeltaValueByKey("JSON-0", "text", buffer, 32);
buffer = '0'
Shadow state
{"state":{"desired":{"text":"Golf"}}}
myClient.getDeltaValueByKey("JSON-0", "text", buffer, 32);
buffer = "Golf"
I modified the ThermostatSimulatorDevice such that the delay at the end of the loop is 10 seconds instead of 1 second. For some reason, for any delay time less than 10 seconds works as intended but as soon as the delay is 10 seconds or higher I get this error:
Exception in thread Thread-4 (most likely raised during interpr
[ERR] command: shadow update code: -1
And shadow updates no longer work. I'd ideally like to add some trigger in the arduino that would update the shadow, which might have a delay time of more than 10 seconds. I also changed the CMD_TIME_OUT to 400 in the config file, but the code is still timing out after 10 seconds.
Can you offer any advice on the best way to diagnose this error:
AWS IoT SDK Version(dev) 2.2.0-
Setup failed!
-1
My config file is:
//===============================================================
#define AWS_IOT_MQTT_HOST "a27sg7ieezj192.iot.us-east-1.amazonaws.com" // your endpoint
#define AWS_IOT_MQTT_PORT 8883 // your port
#define AWS_IOT_CLIENT_ID "seeed02" // your client ID
#define AWS_IOT_MY_THING_NAME "seeed-czajk02" // your thing name
#define AWS_IOT_ROOT_CA_FILENAME "root-CA.crt" // your root-CA filename
#define AWS_IOT_CERTIFICATE_FILENAME "hashed-certificate.pem.crt" // your certificate filename
#define AWS_IOT_PRIVATE_KEY_FILENAME "hashed-private.pem.key" // your private key filename
//===============================================================
Seems like I have been successful running the python sdk example, as a test (as was suggested in #28):
root@Seeed:~/aws-iot-device-sdk-python/samples/basicPubSub# python basicPubSub.py -e a27sg7ieezj192.iot.us-east-1.amazonaws.com -r ../../../AWS-IoT-Python-Runtime/certs/root-CA.crt -c
../../../AWS-IoT-Python-Runtime/certs/c51fbd44a5-certificate.pem.crt -k ../../../AWS-IoT-Python-Runtime/certs/c51fbd44a5-private.pem.key
2017-01-30 14:40:59,759 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Paho MQTT Client init.
2017-01-30 14:40:59,763 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - ClientID: basicPubSub
2017-01-30 14:40:59,767 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Protocol: MQTTv3.1.1
2017-01-30 14:40:59,770 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Register Paho MQTT Client callbacks.
2017-01-30 14:40:59,773 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - mqttCore init.
2017-01-30 14:40:59,777 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load CAFile from: ../../../AWS-IoT-Python-Runtime/certs/root-CA.crt
2017-01-30 14:40:59,780 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Key from: ../../../AWS-IoT-Python-Runtime/certs/c51fbd44a5-private.pem.key
2017-01-30 14:40:59,783 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Cert from: ../../../AWS-IoT-Python-Runtime/certs/c51fbd44a5-certificate.pem.crt
2017-01-30 14:40:59,788 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: baseReconnectTime = 1 sec
2017-01-30 14:40:59,791 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: maximumReconnectTime = 32 sec
2017-01-30 14:40:59,795 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: minimumConnectTime = 20 sec
2017-01-30 14:40:59,799 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: queueSize = -1
2017-01-30 14:40:59,802 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: dropBehavior = Drop Newest
2017-01-30 14:40:59,806 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for draining interval: 0.5 sec
2017-01-30 14:40:59,810 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum connect/disconnect timeout to be 10 second.
2017-01-30 14:40:59,813 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum MQTT operation timeout to be 5 second
2017-01-30 14:40:59,817 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connection type: TLSv1.2 Mutual Authentication
2017-01-30 14:41:00,579 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connected to AWS IoT.
2017-01-30 14:41:00,581 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Connect time consumption: 60.0ms.
2017-01-30 14:41:00,578 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Connect result code 0
2017-01-30 14:41:00,590 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Started a subscribe request 1
2017-01-30 14:41:00,882 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - _resubscribeCount: -1
2017-01-30 14:41:00,887 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Subscribe request 1 succeeded. Time consumption: 290.0ms.
2017-01-30 14:41:00,890 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Recover subscribe context for the next request: subscribeSent: False
2017-01-30 14:41:00,885 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Subscribe request 1 sent.
2017-01-30 14:41:02,898 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Try to put a publish request 2 in the TCP stack.
2017-01-30 14:41:02,901 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Publish request 2 succeeded.
Received a new message:
New Message 0
from topic:
sdk/test/Python
--------------
2017-01-30 14:41:03,909 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Try to put a publish request 3 in the TCP stack.
2017-01-30 14:41:03,912 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Publish request 3 succeeded.
Received a new message:
New Message 1
from topic:
sdk/test/Python
--------------
I have a yun setup with the AWS SDK. When pushing the script through my computer, I get a Subscribe failed -1, but the arduino is still able to publish messages to AWS IoT. If I plug in the arduino to a power adapter only, nothing us pushed to AWS. I tried resetting the arduino and re-launching the script by pressing the 32U4 button twice but nothing. As soon as I launch the script from my computer it works again. Any suggestions?
Hi,
I was trying the BasicPubSub example and everything was fine in the beginning. However, after I changed the delay in the loop from 1000ms to 10000ms, the program started reporting generic error and yield error. Only the first message was delivered.
I've tried several different delay time, this only happen when the delay is greater then 10000.
Thanks.
Trying to adapt the "ThingShadow" example, but I keep getting these errors:
AWS IoT SDK Version(dev) 2.2.0-
root@Seeed:~/AWS-IoT-Python-Runtime/runtime#
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
Linux
/
Later (I think when I expect the sketch to get shadow), I get this:
Exception in thread Thread-4 (most likely raised during interpr
Yield failed.
/bin/ash: 1: not found
/bin/ash: z: not found
Yield failed.
How best to diagnose these?
Hello,
I have uploaded my certs and verified they are in ~/AWS-IoT-Python-Runtime/runtime/certs
I have configured my aws_iot_config.h with the names of the cert and key files. When I run the BasicPubSub example, the connection fails with the error CONNECT_CREDENTIAL_NOT_FOUND.
AWS IoT SDK Version(dev) 2.2.0-
Connect failed!
-13
What causes this error?
Thanks!
So I am trying to run (just clicking on the check mark to verify) the Pub\Sub Example through Arduino and I get the following errors:
C:\Users..\Documents\Arduino\libraries\AWS-IoT-Arduino-Yun-Library\aws_iot_mqtt.cpp: In member function 'IoT_Error_t aws_iot_mqtt_client::configDrainingInterval(float)':
C:\Users..\Documents\Arduino\libraries\AWS-IoT-Arduino-Yun-Library\aws_iot_mqtt.cpp:211:39: error: 'dtostrf' was not declared in this scope
dtostrf(numberOfSeconds, 5, 2, rw_buf); // Only support XX.XX (including sign+/-)
^
Using library AWS-IoT-Arduino-Yun-Library in folder: C:\Users..\Documents\Arduino\libraries\AWS-IoT-Arduino-Yun-Library (legacy)
exit status 1
Error compiling for board Intel® Edison.
Looks like I need to specify config, but sure where. I have tried a couple things but to no avail only get other errors. figured I would ask.
Hi
Will support for Arduino UNO ESP8266 or Wi-Fi ?
Thanks
config is as follows
AWS_IOT_MQTT_HOST "**************.iot.ap-northeast-1.amazonaws.com"
I'm looking for tutorial suggestions for the next steps, like
Hello, I am trying to connect my YUN (with OpenWrt) to AWS IoT using this SDK. I have followed every step carefully, when I try using BasicPubSub Example .
When teh sketch runs I receive a response "Connect failed" with code "-1".
I read the issue #28, but my problem is not solved.
I use the Windows platform to update the YUn system.
Thanks
Hello, recently i got an arduino yun and downloaded aws arduino yun sdk and followed the installation steps on windows environment. I am getting setup failed, config failed, connect failed messages when trying to start the basic pub sub example, instead of serial monitor i am using console for printing information. I have verified that my yun is on the same network as my computer and tried couple of other small non aws programs which seems to be working alright. The CA root certificate, private key and certificate which i got from AWS console, which i am using with yun, if i use the same with Raspberry pi, its working correctly with the c sdk. Any pointers on what else i can check for the setup to work on yun would be a great help.
I had tried the procedure layout as per issue #39. However, I still encountered the same issue as setup failed (-5). Had run the YunSerialTerminal example and still got the same result. Checked the certificates, keys and policies and they are OK.
Connect to Yun via terminal and run the python program directly (basicPubSub.py) and got a return error of [Errno -2] Name or service not known.
Any help will be appreciated.
The CA file downloaded as per the README.md file does not have the correct name to match the "credentialCheck" assertion in the ThermostatSimulatorApp.py example.
The Python code is looking for a file which matches this glob:
# Get credentials
rootCA = glob.glob("./certs/*CA.crt")
Guys, I keep getting "Out of buffer size" during callback for myClient.shadow_get("xxxx", myCallback, 5);
Im not sure whether I putting it wrong for my callback function as shown below:
void myCallback(char* src, int len) {
String data = String(src);
Serial.println(data);
}
Hi,
I tried to follow the instructions on github aws-iot-device-sdk-arduino-yun to set up my Arduino Yun using my Windows machine. Everything seems okay and I have loaded my certs into /root/AWS-IoT-Python-Runtime/certs with corresponding filenames in the aws_iot_config.h file that was uploaded to the Arduino Yun board in the BasicPubSub example. Upon opening serial monitor, the message displayed was Connect Failed! -10.
Appreciate any advice, thanks!
Joseph
Hello, I am trying to connect my YUN (with OpenWrt) to AWS IoT using this SDK. I have followed every step carefully, when I try using BasicPubSub Example I face an issue of "Connect failed" with code "-1".
One thing that is in my notice is when i used:
"easy_install pip &
pip install AWSIoTPythonSDK==1.0.0" , I received few warnings include missing SNI and insecure platform. (I just don't know that they matter or not)
I am very new to this stuff and with very basic knowledge, Please Help!!
I have followed this issue: #25
but still without any way out.
I am stuck and getting nowhere, please could someone help?
When running the BasicPubSub example it stops at the first stage with a Setup Fail -1
AWS IoT SDK Version(dev) 2.2.0-
<RANDOM_STRING>.iot.us-west-2.amazonaws.com
8883
/AWS-IoT-Python-Runtime/certs/root-CA.crt
/AWS-IoT-Python-Runtime/certs/<SOME_HASH>-private.pem.key
/AWS-IoT-Python-Runtime/certs/<SOME_HASH>-certificate.pem.crt
yun
Setup failed!
-1
I have set-up an AWS IoT account and generated the keys and certificates which I loaded into the directory on yun.
root@yun:/AWS-IoT-Python-Runtime/certs# ls
<SOME_HASH>-certificate.pem.crt <SOME_HASH>-public.pem.key
<SOME_HASH>-private.pem.key root-CA.crt
I can connect to yun via WiFi and can use PuTTY and WinSCP.
I expect that it is something simple that I have not done - any pointers would be appreciated!
I have checked the keys and certificates by using MTTQ.fx and can publish and subscribe OK to AWS.
The code seems to be failing at the myClient.setup phase - not sure why this would be? Client id is "yun".
if((rc = myClient.setup(AWS_IOT_CLIENT_ID)) == 0) { // Load user configuration
Dumb question, but under windows installation, item 5, where it says...
Start WinSCP and upload AWS-IoT-Python-Runtime/ folder to /root on the board.
does that mean to upload the entire folder or just the contents?
Hello, I am trying to connect my YUN (with OpenWrt) to AWS IoT using this SDK. I have followed every step carefully, and sometime i got success and sometime it return "Connect failed" with code "-10" when I try using BasicPubSub Example.
I have tried to run script on YUN to connect AWS IoT, it also sometimes success and sometimes fail.
My config is:
//=======================================================
#define AWS_IOT_MQTT_HOST "ae83bn430lcel.iot.ap-southeast-1.amazonaws.com" // your endpoint
#define AWS_IOT_MQTT_PORT 8883 // your port
#define AWS_IOT_CLIENT_ID "DS01" // your client ID
#define AWS_IOT_MY_THING_NAME "Testing03" // your thing name
#define AWS_IOT_ROOT_CA_FILENAME "rootCA.crt" // your root-CA filename
#define AWS_IOT_CERTIFICATE_FILENAME "certificate.pem.crt" // your certificate filename
#define AWS_IOT_PRIVATE_KEY_FILENAME "private.pem.key" // your private key filename
//===============================================================
// SDK config, DO NOT modify it
#define AWS_IOT_PATH_PREFIX "../certs/"
#define AWS_IOT_ROOT_CA_PATH AWS_IOT_PATH_PREFIX AWS_IOT_ROOT_CA_FILENAME // use this in config call
#define AWS_IOT_CERTIFICATE_PATH AWS_IOT_PATH_PREFIX AWS_IOT_CERTIFICATE_FILENAME // use this in config call
#define AWS_IOT_PRIVATE_KEY_PATH AWS_IOT_PATH_PREFIX AWS_IOT_PRIVATE_KEY_FILENAME // use this in config call
#endif
//--------------------------------------------------------------------
Here is the log of success when i use script to connect AWS IoT:
root@DS:~/aws-iot-device-sdk-python-master/samples/basicPubSub# python basicPubSub.py -e ae83bn430lcel.iot.ap-southeast-1.amazonaws.com -r /root/AWS-IoT-Python-Runtime/certs/rootCA.crt -c /root/AWS-IoT-Python-Runtime/certs/certificate.pem.crt -k /root/AWS-IoT-Python-Runtime/certs/private.pem.key
2017-03-20 04:31:12,006 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Paho MQTT Client init.
2017-03-20 04:31:12,010 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - ClientID: basicPubSub
2017-03-20 04:31:12,013 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Protocol: MQTTv3.1.1
2017-03-20 04:31:12,017 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Register Paho MQTT Client callbacks.
2017-03-20 04:31:12,019 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - mqttCore init.
2017-03-20 04:31:12,022 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load CAFile from: /root/AWS-IoT-Python-Runtime/certs/rootCA.crt
2017-03-20 04:31:12,024 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Key from: /root/AWS-IoT-Python-Runtime/certs/private.pem.key
2017-03-20 04:31:12,031 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Cert from: /root/AWS-IoT-Python-Runtime/certs/certificate.pem.crt
2017-03-20 04:31:12,035 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: baseReconnectTime = 1 sec
2017-03-20 04:31:12,038 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: maximumReconnectTime = 32 sec
2017-03-20 04:31:12,042 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: minimumConnectTime = 20 sec
2017-03-20 04:31:12,046 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: queueSize = -1
2017-03-20 04:31:12,049 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: dropBehavior = Drop Newest
2017-03-20 04:31:12,053 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for draining interval: 0.5 sec
2017-03-20 04:31:12,056 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum connect/disconnect timeout to be 10 second.
2017-03-20 04:31:12,059 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum MQTT operation timeout to be 5 second
2017-03-20 04:31:12,065 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connection type: TLSv1.2 Mutual Authentication
2017-03-20 04:31:14,216 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connected to AWS IoT.
2017-03-20 04:31:14,219 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Connect time consumption: 260.0ms.
2017-03-20 04:31:14,214 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Connect result code 0
2017-03-20 04:31:14,229 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Started a subscribe request 1
2017-03-20 04:31:15,100 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - _resubscribeCount: -1
2017-03-20 04:31:15,103 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Subscribe request 1 sent.
2017-03-20 04:31:15,107 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Subscribe request 1 succeeded. Time consumption: 860.0ms.
2017-03-20 04:31:15,110 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Recover subscribe context for the next request: subscribeSent: False
2017-03-20 04:31:17,120 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Try to put a publish request 2 in the TCP stack.
2017-03-20 04:31:17,123 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Publish request 2 succeeded.
Received a new message:
New Message 0
from topic:
sdk/test/Python
2017-03-20 04:31:18,129 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Try to put a publish request 3 in the TCP stack.
2017-03-20 04:31:18,132 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Publish request 3 succeeded.
Received a new message:
New Message 1
from topic:
sdk/test/Python
//---------------------------------------------------
Here is the log of failure when i use script to connect AWS IoT:
root@DS:/aws-iot-device-sdk-python-master/samples/basicPubSub# python -V/aws-iot-device-sdk-python-master/samples/basicPubSub# openssl version -v
Python 2.7.3
root@DS:
OpenSSL 1.0.1h 5 Jun 2014
root@DS:~/aws-iot-device-sdk-python-master/samples/basicPubSub# python basicPubSub.py -e ae83bn430lcel.iot.ap-southeast-1.amazonaws.com -r /root/AWS-IoT-Python-Runtime/certs/rootCA.crt -c /root/AWS-IoT-Python-Runtime/certs/certificate.pem.crt -k /root/AWS-IoT-Python-Runtime/certs/private.pem.key
2016-04-07 12:21:39,823 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Paho MQTT Client init.
2016-04-07 12:21:39,826 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - ClientID: basicPubSub
2016-04-07 12:21:39,830 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Protocol: MQTTv3.1.1
2016-04-07 12:21:39,833 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Register Paho MQTT Client callbacks.
2016-04-07 12:21:39,837 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - mqttCore init.
2016-04-07 12:21:39,841 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load CAFile from: /root/AWS-IoT-Python-Runtime/certs/rootCA.crt
2016-04-07 12:21:39,844 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Key from: /root/AWS-IoT-Python-Runtime/certs/private.pem.key
2016-04-07 12:21:39,848 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Cert from: /root/AWS-IoT-Python-Runtime/certs/certificate.pem.crt
2016-04-07 12:21:39,852 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: baseReconnectTime = 1 sec
2016-04-07 12:21:39,854 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: maximumReconnectTime = 32 sec
2016-04-07 12:21:39,857 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: minimumConnectTime = 20 sec
2016-04-07 12:21:39,859 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: queueSize = -1
2016-04-07 12:21:39,864 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: dropBehavior = Drop Newest
2016-04-07 12:21:39,868 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for draining interval: 0.5 sec
2016-04-07 12:21:39,871 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum connect/disconnect timeout to be 10 second.
2016-04-07 12:21:39,875 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum MQTT operation timeout to be 5 second
2016-04-07 12:21:39,879 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connection type: TLSv1.2 Mutual Authentication
Traceback (most recent call last):
File "basicPubSub.py", line 133, in
myAWSIoTMQTTClient.connect()
File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 403, in connect
return self._mqttCore.connect(keepAliveIntervalSecond)
File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/mqttCore.py", line 290, in connect
self._pahoClient.connect(self._host, self._port, keepAliveInterval) # Throw exception...
File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 655, in connect
return self.reconnect()
File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 798, in reconnect
ciphers=self._tls_ciphers)
File "/usr/lib/python2.7/ssl.py", line 381, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python2.7/ssl.py", line 143, in init
self.do_handshake()
File "/usr/lib/python2.7/ssl.py", line 305, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [Errno 1] _ssl.c:504: error:14090086:lib(20):func(144):reason(134)
Please help me, thanks!
@liuszeng
HI, i have problem running the ThermoStatSimulator.py. it provides an invalid syntax error on line 7.
And on my serial monitor the setup monitor just hang on the following.
However, i have shadow updates on the AWS IOT console. i believe the connection to the AWS IOT console is successful.
thanks in advance for your help.
Can I use the Bridge library to acess the digital and analog pins ond the board through REST calls (192.xxx.xxx.xxx/digital/13) ?
I try to use this while sending msg to AWS and it doesn't work.
Hi All,
I would like to use this function to get the reported property of my device shadow. Something like this:
https://github.com/aws/aws-iot-device-sdk-arduino-yun#getValueByKey
char internalMessage[32];
myClient.getValueByKey("JSON-0", "state"desired"message", &internalMessage, 32);
I get a compile error - 'class aws_iot_mqtt_client' has no member named 'getValueByKey'.
I couldn't find the getValueByKey function defined anywhere in the SDK.
Am I doing something obviously wrong? How am I supposed to get properties of my state?
Thanks
To try solve this I had a look at this issue and also verified my file names were correct. After I SSH'd into the Arduino, my root CA (Symantec website one), IoT Certificate, and IoT private key (both generated through 1-Click certificate create in AWS IoT) were located in:
/root/AWS-IoT-Python-Runtime/certs
My aws_iot_config.h
(which is on my local computer) has AWS_IOT_PATH_PREFIX
set as "../certs/"
, which is default. I tried changing file endings to match the format of the original file but that did not work.
Any ideas? Does the -13 error strictly mean it cannot locate the certs and key file? Thanks for the help.
Hi,
I have a new Arduino UNO with the Yun shield. I'm trying to get the SDK installed, I'm running AWSIoTArduinoYunInstallAll.sh
as in the install instructions, the full output:
./AWSIoTArduinoYunInstallAll.sh 172.20.0.62 root xxx
This script will install all of the depencies and upload the codebase and credentials to the targeted Arduino Yun Board for the AWS IoT Arduino Yun SDK, which includes:
- Install dependencies
- Upload codebase
- Upload credentials
Please make sure you have included your credentials (private key, certificate and rootCA) in AWS-IoT-Python-Runtime/certs/
Changing permissions for functional scripts...
Done.
Uploading codebase and credentials...
Arduino Yun IP is: 172.20.0.62
Arduino Yun User Name is: root
Now start transmitting ./AWS-IoT-Python-Runtime to remote directory: [email protected]:/root/ ...
spawn scp -r ./AWS-IoT-Python-Runtime [email protected]:/root/
[email protected]'s password:
.DS_Store 100% 6148 6.0KB/s 00:00
3bb6658c3c-certificate.pem.crt 100% 1220 1.2KB/s 00:00
3bb6658c3c-private.pem.key 100% 1675 1.6KB/s 00:00
VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem 100% 1758 1.7KB/s 00:00
__init__.py 100% 0 0.0KB/s 00:00
communicationServer.py 100% 1165 1.1KB/s 00:00
serialCommunicationServer.py 100% 7211 7.0KB/s 00:00
__init__.py 100% 0 0.0KB/s 00:00
AWSIoTCommand.py 100% 1324 1.3KB/s 00:00
commandConfig.py 100% 2050 2.0KB/s 00:00
commandConnect.py 100% 2441 2.4KB/s 00:00
commandDisconnect.py 100% 2000 2.0KB/s 00:00
commandJSONKeyVal.py 100% 3393 3.3KB/s 00:00
commandLockSize.py 100% 1559 1.5KB/s 00:00
commandPublish.py 100% 2544 2.5KB/s 00:00
commandSetBackoffTiming.py 100% 2049 2.0KB/s 00:00
commandSetDrainingIntervalSecond.py 100% 1932 1.9KB/s 00:00
commandSetOfflinePublishQueueing.py 100% 2553 2.5KB/s 00:00
commandShadowDelete.py 100% 4075 4.0KB/s 00:00
commandShadowGet.py 100% 4063 4.0KB/s 00:00
commandShadowRegisterDeltaCallback.py 100% 3257 3.2KB/s 00:00
commandShadowUnregisterDeltaCallback.py 100% 3284 3.2KB/s 00:00
commandShadowUpdate.py 100% 4231 4.1KB/s 00:00
commandSubscribe.py 100% 2908 2.8KB/s 00:00
commandUnsubscribe.py 100% 2673 2.6KB/s 00:00
commandYield.py 100% 1178 1.2KB/s 00:00
__init__.py 100% 0 0.0KB/s 00:00
AWSIoTExceptions.py 100% 786 0.8KB/s 00:00
operationError.py 100% 703 0.7KB/s 00:00
operationTimeoutException.py 100% 716 0.7KB/s 00:00
__init__.py 100% 0 0.0KB/s 00:00
jsonManager.py 100% 4360 4.3KB/s 00:00
delete.me 100% 0 0.0KB/s 00:00
__init__.py 100% 0 0.0KB/s 00:00
run.py 100% 721 0.7KB/s 00:00
runtimeHub.py 100% 18KB 18.0KB/s 00:00
Completed!
Done.
Installing dependencies on Arduino Yun...
Arduino Yun IP is: 172.20.0.62
Arduino Yun User Name is: root
The following dependencies will be remotely installed on Arduino Yun:
distribute
python-openssl
Please wait until the installation completes and the program exits.
spawn ssh [email protected]
[email protected]'s password:
BusyBox v1.23.2 (2016-03-23 22:30:11 UTC) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
CHAOS CALMER (1.6.1, r48749) - Arduino Yun101 and Yun Shield
root@YunArduino:~# opkg update
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/base/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_base.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/base/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/arduino/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_arduino.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/arduino/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/custom/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_custom.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/custom/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/juci/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_juci.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/juci/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/luci/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_luci.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/luci/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/management/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_management.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/management/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/owrt_pub_feeds/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_owrt_pub_feeds.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/owrt_pub_feeds/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_packages.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/packages/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/routing/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_routing.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/routing/Packages.sig.
Signature check passed.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/telephony/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaoscalmer_telephony.
Downloading http://downloads.arduino.cc/openwrtyun/1.6.1/packages/telephony/Packages.sig.
Signature check passed.
root@YunArduino:~# opkg install distribute
Unknown package 'distribute'.
Collected errors:
* opkg_install_cmd: Cannot install package distribute.
root@YunArduino:~# opkg install python-openssl
Package python-openssl (2.7.9-6) installed in root is up to date.
root@YunArduino:~# easy_install pip
-ash: easy_install: not found
root@YunArduino:~# pip install AWSIoTPythonSDK==1.0.0
-ash: pip: not found
root@YunArduino:~# exit
Connection to 172.20.0.62 closed.
Done.
Execution completed!
I tried running opkg update
and opkg install distribute
manually (via ssh), fails the same.
opkg search distribute
returns nothing.
Has the package been moved, renamed, deleted?
Thanks.
Hello, I want to use Amazon AWS IoT with my Arduino Yun, but it failed still after 4 Days working. I got some fails and follows instruktions from #28 and #25 but no success. fresh openWRT is installed.
First I got this:
root@ichair:~/AWS-IoT-Python-Runtime/runtime#
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
Linux
/
I T
G T
Connect failed!
-1
Then I installed the python SDK and let basicPubSub sample running and got this:
root@Arduino:~/aws-iot-device-sdk-python-master/samples/basicPubSub# python basicPubSub.py -e .iot.eu-central-1.amazonaws.com -r /root/AWS-IoT-
Python-Runtime/certs/rootCA.crt -c /root/AWS-IoT-Python-Runtime/certs/-certificate.pem.crt -k /root/AWS-IoT-Python-Runtime/certs/-private
.pem.key
2017-06-23 13:04:22,960 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Paho MQTT Client init.
2017-06-23 13:04:22,963 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - ClientID: basicPubSub
2017-06-23 13:04:22,967 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Protocol: MQTTv3.1.1
2017-06-23 13:04:22,970 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Register Paho MQTT Client callbacks.
2017-06-23 13:04:22,974 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - mqttCore init.
2017-06-23 13:04:22,978 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load CAFile from: /root/AWS-IoT-Python-Runtime/certs/rootCA.crt
2017-06-23 13:04:22,981 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Key from: /root/AWS-IoT-Python-Runtime/certs/454c742925-private.pem.key
2017-06-23 13:04:22,985 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Cert from: /root/AWS-IoT-Python-Runtime/certs/454c742925-certificate.pem.crt
2017-06-23 13:04:22,988 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: baseReconnectTime = 1 sec
2017-06-23 13:04:22,992 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: maximumReconnectTime = 32 sec
2017-06-23 13:04:22,996 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: minimumConnectTime = 20 sec
2017-06-23 13:04:23,000 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: queueSize = -1
2017-06-23 13:04:23,003 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: dropBehavior = Drop Newest
2017-06-23 13:04:23,007 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for draining interval: 0.5 sec
2017-06-23 13:04:23,011 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum connect/disconnect timeout to be 10 second.
2017-06-23 13:04:23,015 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum MQTT operation timeout to be 5 second
2017-06-23 13:04:23,019 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connection type: TLSv1.2 Mutual Authentication
Traceback (most recent call last):
File "basicPubSub.py", line 87, in
myAWSIoTMQTTClient.connect()
File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 405, in connect
return self._mqttCore.connect(keepAliveIntervalSecond)
File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/mqttCore.py", line 290, in connect
self._pahoClient.connect(self._host, self._port, keepAliveInterval) # Throw exception...
File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 655, in connect
return self.reconnect()
File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 777, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
socket.error: [Errno 145] Connection timed out
What doese this meen?
And if now the Arduino SDK is running I got a different failure:
AWS IoT SDK Version(dev) 2.2.0-
root@Arduino:~/AWS-IoT-Python-Runtime/runtime#
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
/bin/ash: 1: not found
/bin/ash: /root: Permission denied
Linux
/
Traceback (most recent call last):
Setup failed!
-1
I really dont know what can I do more, can somebody help me?
Maybee @liuszeng ?
Thanks
Skrixx
I recently was able to get my Raspberry Pi to connect to AWS, but I'm new and having trouble connecting my Arduino YUN. I've made sure to follow the instructions for the SDK and that WiFi works but, whenever I run the example PubSub code my serial monitor shows the following output:
AWS IoT SDK Version(dev) 2.2.0-
Setup failed!
-5
I'm unsure as how to fix this issue. My closest understanding is that this is related to SERIAL1_COMMUNICATION_ERROR
. I've run the YunSerialTerminal sketch a few times to confirm that the Arduino Serial Monitor can see data from the OpenWRT side.
Hi! I'm trying your basicPubSub example and keep running into this error. Could you help me out?
I run the command:
python basicPubSub.py -e <host> -r ../../../root-CA.crt -c ../../../izac_listener.cert.pem -k ../../../izac_listener.private.key
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Paho MQTT Client init.
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - ClientID: basicPubSub
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Protocol: MQTTv3.1.1
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Register Paho MQTT Client callbacks.
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - mqttCore init.
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load CAFile from: ../../../root-CA.crt
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Key from: ../../../izac_listener.private.key
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Cert from: ../../../izac_listener.cert.pem
2017-05-08 22:58:35,694 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: baseReconnectTime = 1 sec
2017-05-08 22:58:35,695 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: maximumReconnectTime = 32 sec
2017-05-08 22:58:35,695 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: minimumConnectTime = 20 sec
2017-05-08 22:58:35,695 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: queueSize = -1
2017-05-08 22:58:35,695 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: dropBehavior = Drop Newest
2017-05-08 22:58:35,695 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for draining interval: 0.5 sec
2017-05-08 22:58:35,695 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum connect/disconnect timeout to be 10 second.
2017-05-08 22:58:35,695 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum MQTT operation timeout to be 5 second
2017-05-08 22:58:35,695 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connection type: TLSv1.2 Mutual Authentication
Traceback (most recent call last):
File "basicPubSub.py", line 133, in <module>
myAWSIoTMQTTClient.connect()
File "/Users/Ryan/virtualenvs/alexa/lib/python3.6/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 403, in connect
return self._mqttCore.connect(keepAliveIntervalSecond)
File "/Users/Ryan/virtualenvs/alexa/lib/python3.6/site-packages/AWSIoTPythonSDK/core/protocol/mqttCore.py", line 290, in connect
self._pahoClient.connect(self._host, self._port, keepAliveInterval) # Throw exception...
File "/Users/Ryan/virtualenvs/alexa/lib/python3.6/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 655, in connect
return self.reconnect()
File "/Users/Ryan/virtualenvs/alexa/lib/python3.6/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 798, in reconnect
ciphers=self._tls_ciphers)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1142, in wrap_socket
ciphers=ciphers)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:749)
I generated all the certificates with AWS IoT.
I am running Python3.6 and my ssl version:
>>> import ssl
>>> ssl.OPENSSL_VERSION
'OpenSSL 1.0.2j 26 Sep 2016'
Thank you in advance!
Hi All,
Thanks for all your great work on the aws yun SDK. It's been fun working with it so far!
I would like to make some suggestions about reducing the memory footprint of the MQTT driver. At the moment the example with shadow states takes up 75% of the memory on the ATmega. This leaves little room for other things to run alongside.
I have some suggestions which I would like to make sincerely. I know the driver is a work in progress, so maybe this is already planned.
1: I noticed there are a lot of string literals in aws_iot_mqtt.cpp - these are stored in SRAM when they could be offloaded to the flash. EG:
Instead of: sprintf(rw_buf, "state"reported"%s\n", key);
Use: sprintf_P(rw_buf, PSTR("state"reported"%s\n"), key);
2: The keyed functions will clear the data in the buffer if the value isn't returned correctly. This means I need to use an intermediate buffer and check the error code before copying again. This is a waste of resources, and could be avoided if the client left the target buffers alone on error
Now I have:
if(myClient.getDeltaValueByKey("JSON-0", "text", buffer, 32) == ERROR_NONE)
{ strcpy(theData, buffer); }
Better:
myClient.getDeltaValueByKey("JSON-0", "text", theData, THE_DATA_SIZE)
// I cant do this because myClient clears theData if the result is not ERROR_NONE
3: I still have to construct the return messages on the ATmega, to report the state back up to AWS. This means I need a huge buffer to hold a JSON document. It would be better to have some kind of function similar to the getValueByKey to construct a JSON doc on the linux host.
eg:
myClient.setValueByKey("JSON-R", "state"reported"text", theData)
myClient.sendMessage("JSON-R");
Thanks!
Hey guys, thanks for the library.
I was hacking on getting the library running on the Dragino and Arduino Uno but ran into the issue where the Serial1
port was not available as the Uno has only one Serial port.
It seems like it should be possible to run with an Uno if we could configure SoftwareSerial and use some of the other Arduino digital pins for the second Serial port. However, this library has hardcoded the use of Serial1
(seems to be exclusively in aws_iot_mqtt.cpp) for communication to the Dragino.
If we could set some config values for SoftwareSerial
in the config of our sketch (like we do for AWS_IOT_CLIENT_ID
), it seems like it would be straight forward to make this library work with much more hardware. I know we can solve this with different hardware, but it'd be great to have this software solution as well.
Thanks!
Hi, I tried to compile the SDK for arduino Tian but i was unsuccessful.
Currently is there any method in order to convert this SDK to a SDK for Arduino Tian?
Kind Regards.
Just installed the sdk in arduino yun and got this setup failed! message from the Serial monitor as below :-
Setup failed!
-5
What is -5 and what is the possible cause ? I am using arduino 1.6.12 IDE. Any help will be appreciated.
Hi, can I use Arduino Uno + Ethernet Shield?
Or there is something library that can I use with that configuration?
If I can't I want also know if I can use Arduino Uno + Ethernet Shield with one of the MQTT library available open source for Arduino without certificate, so disable certificate for my thing on AWS IOT.
Thanks
Hi, I have an Arduino Yún with SDK 2.1.1 installed where I have successfully tested BasicPubSub example with no problems.
However, ThingShadowEcho example gets stuck after printing "shadow init completed", without any error message. I have configured "aws_iot_config.h" the same way as in BasicPubSub example, so I think everything is in its place.
This is the what the serial monitor shows:
AWS IoT SDK Version(dev) 2.1.1-
[LOG] command: setup completed.
[LOG] command: config completed.
[LOG] command: connect completed.
[LOG] command: shadow init completed.
Any insights? Thanks.
Is there anyway to get a timestamp to pass from the aws iot sdk to pass into my json file?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.