【问题标题】:I cannot connect to pushbullet from ESP8266我无法从 ESP8266 连接到 pushbullet
【发布时间】:2021-03-24 00:28:02
【问题描述】:

我已经按照几个说明从 ESP8266 连接到 Pushbullet 这是一个代码sn-p

#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

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

像魅力一样工作。

【问题讨论】:

  • 我猜那是因为您忘记通过 NTP 设置设备时间。看看你是否可以使用github.com/ThingPulse/iotworkshop2019 来解决这个问题(分支firstGet 可能会有所帮助)。

标签: security esp8266 pushbullet


【解决方案1】:

找到解决方案。

   // 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 某处找到它,只是分享以帮助其他人找到解决方案。

【讨论】:

    猜你喜欢
    • 2017-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-08
    • 2019-04-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多