我无法连接到ESP8266的按钮



我按照几个说明从ESP8266连接到Pushbullet以下是的代码片段

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
const char* ssid = ".......";
const char* password = ".......";
const char* host = "api.pushbullet.com";
const int httpsPort = 443;
const char* PushBulletAPIKEY = "..............."; //get it from your pushbullet account
// Use web browser to view and copy
// SHA1 fingerprint of the certificate
const char* fingerprint = "2C BC 06 10 0A E0 6E B0 9E 60 E5 96 BA 72 C5 63 93 23 54 B3"; //got it using https://www.grc.com/fingerprints.htm
void setup() {
Serial.begin(115200);
Serial.println();
Serial.print("connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
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());
// Use WiFiClientSecure class to create TLS connection
WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println("connection failed");
return;
}

它在!client.connect(host, httpsPort)上失败。

使用浏览器api.prushullet.com:443失败

https://api.pushbullet.com返回一个漂亮的JSON代码

是否可以使用连接https://api.pushbullet.com?

是否存在端口问题?

感谢您的帮助。

来自RPI 的PS

curl --header 'Access-Token: o.abcdefghijklmnopqrstuvwxyz'  https://api.pushbullet.com/v2/users/me

工作起来很有魅力。

找到解决方案。

// Use WiFiClientSecure class to create TLS connection
WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println("connection failed");
return;
}

添加:<client.setInsecure((>下面是:WiFiClientSecure客户端;

在GitHub的某个地方找到了它,只是分享以帮助其他人找到解决方案。

相关内容

  • 没有找到相关文章