我正在尝试连接NodeMCU ESP8266并上传阴影.我正在遵循IoT Design Pro的教程.当我第一次运行它时,我确实看到在AWS上更新了阴影.在随后的循环中,它停止更新.现在,我收到一条消息无法建立SSL连接".这是我的代码和串行输出窗口:
I'm trying to connect a NodeMCU ESP8266 and upload a shadow. I am following the tutorial from IoT Design Pro. When i first ran it, I did see the shadow updated on AWS. On subsequent loops, it stopped updating. Now i get a message "can't setup SSL connection". Here are my code and the serial output window:
#include <ESP8266WiFi.h> #include <AmazonIOTClient.h> #include "ESP8266AWSImplementations.h" Esp8266HttpClient httpClient; Esp8266DateTimeProvider dateTimeProvider; AmazonIOTClient iotClient; ActionError actionError; char *ssid="xxxxxxxxxxxxxxxxxxx"; char *password="xxxxxxxxxxx"; void setup() { Serial.begin(115200); delay(10); // Connect to WAP Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); iotClient.setAWSRegion("us-west-2");//axxxxxxxxxxxb-ats.iot.us-west-2.amazonaws iotClient.setAWSEndpoint("amazonaws"); iotClient.setAWSDomain("axxxxxxxxxxxb-ats.iot.us-west-2.amazonaws"); iotClient.setAWSPath("/things/MyThing/shadow"); iotClient.setAWSKeyID("AxxxxxxxxxxxxxxxxxxW"); iotClient.setAWSSecretKey("BxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxWmN1"); iotClient.setHttpClient(&httpClient); iotClient.setDateTimeProvider(&dateTimeProvider); } void loop(){ char* shadow = "{\"state\":{\"reported\": {\"Foobar\": \"bar\"}}}"; char* result = iotClient.update_shadow(shadow, actionError); Serial.print(result); delay(500000); }具有串行输出:
WiFi connected IP address: 10.1.10.128 a2rl12mynda91b-ats.iot.us-west-2.amazonaws 443 POST /things/MyThing/shadow HTTP/1.1 Content-Type: application/json Connection: close Content-Length: 41 Host: axxxxxxxxxxxb-ats.iot.us-west-2.amazonaws x-amz-content-sha256: d8af3f7d20512e6c2f9feddf0e729a9f9201023da39cde8ffa6826175c069174 x-amz-date: 20200122T221521Z Authorization: AWS4-HMAC-SHA256 Credential=AxxxxxxxxxxxxxxxxxxW/20200122/us-west-2/iotdata/aws4_request,SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date,Signature=1d5e8b7d70a67d91704403796fd7bdae28b7f9396523314af98e3e1857b4368a {"state":{"reported": {"Foobar": "bar"}}} can't setup SSL connectionAWS IoT影子输出: 串行输出是否指示已连接?我认为授权行暗示它正在连接,不是吗?我看不到我要去哪里错了.
And AWS IoT shadow output: Does the serial output indicate it connected or not? I would think with the Authorization line it would be implying it is connecting, no? I can't see where I am going wrong.
谢谢.
推荐答案我遇到了类似的问题.
有2个板ESP32和ESP8266,只有32个板能够通过HTTPS发出请求.
Having 2 boards ESP32 and ESP8266 only 32 were able to make the request over HTTPS.
选项1 :发送不带SSL的请求
Option 1: Send requests without SSL
选项2 :发送带有正确指纹的请求
Option 2: Send requests with the correct fingerprint
一些有用的链接:
buger .dread.cz/simple-esp8266-https-client-without-ver-verification-of-certificate-fingerprint.html
github/esp8266/Arduino/issues/3417
更多推荐
即使似乎与NodeMCU ESP8266连接到AWS也无法建立SSL连接
发布评论