appzer / pushsafer-arduino-library

Arduino library for Pushsafer.com
23 stars 9 forks source link

Not working #3

Closed hirani89 closed 5 years ago

hirani89 commented 5 years ago

Hi,

I really appreciate you made this library but it does not seem to work.

Is it because of the new changes you made a couple of weeks ago?

When I try with Postman, it works.

WiFi connection is successful as well.

My test code below:

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

// Initialize Wifi connection to the router

// Pushsafer private or alias key
#define PushsaferKey "mykey"

WiFiClientSecure client;
Pushsafer pushsafer(PushsaferKey, client);

void setup() {
  Serial.begin(115200);

  // Set WiFi to station mode and disconnect from an AP if it was Previously
  // connected
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  // Attempt to connect to Wifi network:
  Serial.print("Connecting Wifi: ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  pushsafer.debug = true;

  struct PushSaferInput input;
  input.message = "This is a test message";
  input.device = "a";

  Serial.println(pushsafer.sendEvent(input));
  Serial.println("Sent");
}

void loop() {
}
appzer commented 5 years ago

can you provide an error log

hirani89 commented 5 years ago

How do I get the logs?

On 28 Feb 2019, at 8:36 pm, Kevin Siml notifications@github.com wrote:

can you provide an error log

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/appzer/pushsafer-arduino-library/issues/3#issuecomment-468203623, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJoOiQj7F8p3LmKRacr2iKlkqFHy1OBks5vR6MngaJpZM4bWDjh.

appzer commented 5 years ago

https://arduino.stackexchange.com/questions/11601/how-to-see-log-from-arduino-ide

hirani89 commented 5 years ago

All I get in the Serial Monitor is the following:

WiFi connected
IP address: 172.16.101.14

Sent
hirani89 commented 5 years ago

After changing the library code to output more information about the whole process, I realised that the code fails on if (client->connect(HOST, SSL_PORT)).

I have made sure the this works with postman or curl from terminal.

appzer commented 5 years ago

you need SSL support, because the api communicate over https

hirani89 commented 5 years ago

So how do I fix this?

appzer commented 5 years ago

here you will find the necessary informations: https://arduino.stackexchange.com/questions/4/how-to-get-https-on-arduino