Hi, I have an arduino wired up to a pager and when the pager is activated, the arduino uses the code below to send a Notification to my smartphone telling me the pager has been activated, All works great.
Now I want to set up a group of people that will receive the same Notification when the pager is activated, This can be done my having a group userkey in place of my own userkey, But I get the following error :
{"errors":["messages to users other than the creator of this application (Pager) must be sent over SSL to https://api.pushover.net/"],"status":0,"request":"c0cf5a77ef6bt705f727352d08599a99"}
So it's got something to do with https and the HTTP in the code but I am unable to figure it out,
Can anyone help me with this or point me in the right direction
/*
Pushover sketch by M.J. Meijer 2014
Send pushover.net messages from the arduino
*/
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE,0xAC,0xBF,0xEF,0xFE,0xAA};
// Pushover settings
char pushoversite[] = "api.pushover.net";
char apitoken[] = "my api token here";
char userkey [] = "my uesrkey here";//My user key
int length;
EthernetClient client;
int analogPin = 3; // analog input pin
int testButton = 3;
int testLed = 13;
int state =0;
void setup()
{
pinMode(3,INPUT);
digitalWrite(3, HIGH);
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");
analogReference(INTERNAL); // select internal 1.1 volt reference
}
void loop()
{
if ( digitalRead(3) == HIGH ) { // Button not pushed
digitalWrite(13, LOW ) ; // Turn off the LED
} else { // Button is pushed
digitalWrite(13,HIGH);
pushover("Test ");// Turn on the LED
}
int aval = analogRead(analogPin); // sample analog input
//Serial.println(aval);
if (aval == 1023) {
//pushover("OMG, Yes it works!!!");
pushover("CALL");
delay(8000);
}
}
byte pushover(char *pushovermessage)
{
String message = pushovermessage;
length = 81 + message.length();
if(client.connect(pushoversite,80))
{
client.println("POST /1/messages.json HTTP/1.1");
client.println("Host: api.pushover.net");
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("token=");
client.print(apitoken);
client.print("&user=");
client.print(userkey);
client.print("&message=");
client.print(message);
while(client.connected())
{
while(client.available())
{
char ch = client.read();
Serial.write(ch);
}
}
client.stop();
}
}