Created this sketch to send pushover.net messages directly from the arduino
Tought I share:
/*
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[] = "your30characterapitokenhere12";
char userkey [] = "your30characteruserkeyhere123";
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()
{
pushover("OMG, Yes it works!!!");
delay(60000);
}
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();
}
}
so basicly in your own code you just need this function:
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();
}
}
and then call the function with:
pushover("whatever message you want!");
you could also add the message priority to the function, by adding:
byte pushover(char *pushovermessage, int priority)
and change lenght = 81 to lenght = 93
and add this to the function:
client.print("&priority=");
client.print(priority);
then you call the function with:
pushover("whatever message",0); // change 0 to 1 or 2 for different message priorities
enjoy!