首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我无法从ESP8266连接到pushbullet

我无法从ESP8266连接到pushbullet
EN

Stack Overflow用户
提问于 2020-12-13 07:17:18
回答 1查看 110关注 0票数 0

我遵循了几条从ESP8266连接到Pushbullet的说明,下面是一段代码片段

代码语言:javascript
复制
#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.pushbullet.com:443失败

https://api.pushbullet.com返回一个很好的JSON代码

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

是否存在端口问题?

感谢你的帮助。

来自RPI的PS

代码语言:javascript
复制
curl --header 'Access-Token: o.abcdefghijklmnopqrstuvwxyz' \ https://api.pushbullet.com/v2/users/me

就像一种护身符。

EN

回答 1

Stack Overflow用户

发布于 2020-12-14 05:54:58

找到解决方案。

代码语言:javascript
复制
   // 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;
   }

在下面添加::WiFiClientSecure客户端;

我在GitHub上找到了它,只是为了帮助其他人找到解决方案而分享。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65270838

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档