Page 1 of 2

Re: Pushafer Arduino error

Posted: 16. Apr 2018, 19:12
by admin
please replace this

Code: Select all

  pushsafer("It works!!!","Test",1,1,1,"a");  
by this

Code: Select all

  pushsafer("It works!!!","Test","1","1","1","a");  
and try again

Re: Pushafer Arduino error

Posted: 17. Apr 2018, 14:50
by admin
please change this line

Code: Select all

byte pushsafer(char *pushsafermessage, char *pushsafertitle, int sound, int vibration, int icon, char *psdevice)
to this

Code: Select all

byte pushsafer(char *pushsafermessage, char *pushsafertitle, char sound, char vibration, char icon, char *psdevice)
Kevin

Re: Pushafer Arduino error

Posted: 20. Apr 2018, 21:33
by admin
Please use this

Code: Select all

/*
   Pushsafer.ino
   Pushsafer.com sketch by Appzer.de Kevin Siml 2016-08-08
   Send pushsafer.com messages from the arduino
*/

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {0xDE,0xAC,0xBF,0xEF,0xFE,0xAA};

// pushsafer settings
char privatekey[] = "your20characterPrivateKey";

int length;

EthernetClient client;

void setup()
{
  Serial.begin(9600);
  Serial.print(F("Starting ethernet..."));
  if(!Ethernet.begin(mac)) Serial.println("failed");
  else Serial.println(Ethernet.localIP());

  delay(5000);
  Serial.println("Ready");
}

void loop()
{
  pushsafer("It works!!!","Test","1","1","1","a");  
  delay(60000); 
}

byte pushsafer(char *pushsafermessage, char *pushsafertitle, char *pssound, char *psvibration, char *psicon, char *psdevice)
{
  String title = pushsafertitle;
  String message = pushsafermessage;
  String device = psdevice;
  String sound = pssound;
  String vibration = psvibration;
  String icon = psicon;

  length = 41 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + privatekey.length();

  if(client.connect("pushsafer.com",80))
  {
    client.println("POST /api HTTP/1.1");
    client.println("Host: https://www.pushsafer.com");
    client.println("Connection: close\r\nContent-Type: application/x-www-form-urlencoded");
    client.print("Content-Length: ");
    client.print(length);
    client.println("\r\n");;
    client.print("k=");
    client.print(privatekey);
    client.print("&m=");
    client.print(message);
    client.print("&t=");
    client.print(title);	
    client.print("&s=");
    client.print(sound);
    client.print("&v=");
    client.print(vibration);	
    client.print("&i=");
    client.print(icon);
    client.print("&d=");
    client.print(device);	
    client.print("&retry=60");
    client.print("&expire=3600");
    while(client.connected())  
    {
      while(client.available())
      {
        char ch = client.read();
        Serial.write(ch);
      }
    }
    client.stop();
  }  
}

Re: Pushafer Arduino error

Posted: 25. Apr 2018, 18:50
by admin
Hi,

sorry, but i can not test the script. So we have to test!

Please change this line

Code: Select all

char privatekey[] = "your20characterPrivateKey";
to this

Code: Select all

String privatekey[] = "your20characterPrivateKey";
or this

Code: Select all

String privatekey = "your20characterPrivateKey";

Re: Pushafer Arduino error

Posted: 26. Apr 2018, 16:32
by admin
great to hear :-)

Re: Pushafer Arduino error

Posted: 4. Jul 2018, 08:00
by admin
Hi,

i updated the script on github, now it should work

https://github.com/appzer/arduino-pushsafer

Kevin

Re: Pushafer Arduino error

Posted: 4. Jul 2018, 08:41
by admin
this example works for anothoer customer, see the latest post in this thread.

It is better to ask in an arduino board, they can help you a little more than i can do.

You can refer to this thread:
viewtopic.php?p=4538#p4538

Kevin

Re: Pushafer Arduino error

Posted: 4. Jul 2018, 09:53
by admin
what device you have? Not an arduino based on esp8266

Re: Pushafer Arduino error

Posted: 4. Jul 2018, 19:58
by admin
sorry, but i cant help you.
Please try to find an anwser in an ardunio forum, i think they can help you better than i

You can reffer to the thread: viewtopic.php?f=24&t=3215

Kevin

Re: Pushafer Arduino error

Posted: 5. Jul 2018, 08:56
by admin
great to hear.
You changed the https to http connection, so i think you have to install openssl to work with https connection.

https://www.google.de/search?q=https+arduino

Kevin