1
Declined

Using Pushover with Arduino/ESP8266

I have been using Pushover successfully for my Arduino/ESP8266 devices for a while now and I'm very happy with the result so far (I'm including my code below for others who might find it useful). However, I never managed to add Priority and URL to my messages. Am I doing anything wrong or is it just not possible (and so i will stop trying! :)

My Arduino function is the following:

byte pushover(String 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);           //  enable/disable debug on console
      }
    }
    client.stop();

I have tried adding the following:

client.print("&priority=");
client.print(priority);
client.print("&retry=60");
client.print("&expire=3600");

and also:

client.print("&url=");
client.print("http://test/");
client.print("&url_title=");
client.print("Test Title");

but none of the above worked. I have tried slight variations of the above with no joy,

If anyone has any luck, please advise ;)

Cheers,

Marco

1 reply

A
length = 81 + message.length();
client.print("&priority=");
client.print(priority);

client.print("&priority=");

client.print("1");

length = 92

;-)

Topic is closed for comments