koenieee / PushBullet-ESP8266

PushBullet library to send and receive notifications/sms from your ESP8266 microcontroller.
GNU General Public License v2.0
27 stars 10 forks source link

Connection to api.pushbullet.com fails #6

Open anuroopshannu opened 5 years ago

anuroopshannu commented 5 years ago

Hey, I've been trying to get past this since a long time now. When I use this library it continuously fails at

if (!pb.checkConnection()) {
    Serial.println("Failed to connect to pushbullet.com");
    return;
  }

I've amended the ssid, password and api key wherever necessary and my esp8266 is successfully connecting to the internet too. Here's my code:

#include <ESP8266WiFi.h>
#include <PushBullet.h>
#include <WiFiClientSecure.h>

WiFiClientSecure client;

#define PORT 443

// wifi connection variables
const char* ssid     = "SSID";
const char* password = "PASS";

boolean wifiConnected = false;

int incomingByte = 0;
boolean connectWifi();

PushBullet pb = PushBullet("API", &client, 443);

void setup() {
  // Initialise Serial connection
  Serial.begin(115200);

  // Initialise wifi connection
  wifiConnected = connectWifi();

  if (!pb.checkConnection()) {
    Serial.println("Failed to connect to pushbullet.com");
    return;
  }

}

void loop() {
  // check if the WiFi connection were successful
  if (wifiConnected) {
    if (true) {

          Serial.println("Pushbullet note pushing");
          pb.sendNotePush("Hello, from me", "Message");
          delay(5000);

    }
  }
}

// connect to wifi – returns true if successful or false if not
boolean connectWifi() {
  boolean state = true;
  int i = 0;
  WiFi.begin(ssid, password);
  Serial.println("");
  Serial.println("Connecting to WiFi");

  // Wait for connection
  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    if (i > 10) {
      state = false;
      break;
    }
    i++;
  }
  if (state) {
    Serial.println("");
    Serial.print("Connected to ");
    Serial.println(ssid);
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());
  }
  else {
    Serial.println("");
    Serial.println("Connection failed.");
  }
  return state;
}

and the following is printed on my serial console:

...
Connected to MY-SSID
IP address: 192.168.0.113
Failed to connect to pushbullet.com

Please let me know a get around for this.

cattusuk commented 5 years ago

Have exactly same problem. The host and port are as follows:

const char* host = "api.pushbullet.com"; const int httpsPort = 443;

It fails at:

if (!client.connect(host, httpsPort)) { Serial.println("connection failed"); return; }

and my console says:

03:46:06.820 -> WiFi connected 03:46:06.820 -> IP address: 03:46:06.820 -> 192.168.50.97 03:46:06.867 -> connecting to api.pushbullet.com 03:46:07.664 -> connection failed

Would be great if someone could give a hint :)

ducktaperules commented 4 years ago

also have the same problem

Osmodia666 commented 4 years ago

I have the same problem. But I guess no one cares.

uyan21 commented 4 years ago

you have to varify by using thingspeak's fingerprint

tha-uep commented 4 years ago

I have the connection problem, too. Also tried to verify the actual fingerprint which I read out of the browsers certificate and via grc.com. Connection failed and certificate does not match :-(

Hope, anyone has an idea or can support me.

if(!pb.openConnection()) { Serial.println("Failed to connect to pushbullet.com"); //return; } // Use web browser to view and copy // SHA1 fingerprint of the certificate const char* fingerprint = "FA C0 BE 4E 64 B8 80 C7 B7 EC B6 D9 01 FF 61 0D AC 92 F5 A6"; //got it using https://www.grc.com/fingerprints.htm if (client.verify(fingerprint, "api.pushbullet.com")) { Serial.println("certificate matches"); } else { Serial.println("certificate doesn't match"); } if (!pb.checkConnection()) { Serial.println("Failed to connect to pushbullet.com"); return; }

gomme600 commented 4 years ago

Fails for me too. The current fingerprint should be: C1 72 5A 7A 6C AE BC CD 0A 57 8E 3A DA 39 C8 47 26 36 C9 77. But this didn't work for me...

HeinvdW commented 3 years ago

Hi api.pushbullet.com:443 is refused https://api.pushbullet.com returns the expected answer:

cat "(=^.^=)"
happy_to_see_you true
message "Welcome to the Pushbullet API!"

So I expect the connection setup should be different than: if (!client.connect(host,httpsPort)) { Serial.println("connection failed"); return; }

I have found the solution elsewhere in GitHub: Just add client.setInsecure(); in the line below WiFiClientSecure client;

Resulting in: WiFiClientSecure client; client.setInsecure();

Bighoneypot commented 1 year ago

@anuroopshannu please close..

froggerXR7 commented 1 year ago

This Is Not Working : Compilation error: 'class axTLS::WiFiClientSecure' has no member named 'setInsecure' 6-27-2023

froggerXR7 commented 1 year ago

This Is Not Working Not Connecting to Pushbullet : Compilation error: 'class axTLS::WiFiClientSecure' has no member named 'setInsecure' 6-27-2023

froggerXR7 commented 1 year ago

Found Prob. That was not Told The Arduino IDE 2.0.4 Dose Not Work, The 2.1.1 Works 7-7-2023

Aman17Gupta commented 3 months ago

Worked with Arduino 1.8.18 after adding " client.setInsecure();"