mqtt-tools / mqttwarn

A highly configurable MQTT message router, where the routing targets are notification plugins, primarily written in Python.
https://mqttwarn.readthedocs.io/
Eclipse Public License 2.0
955 stars 183 forks source link

Pushover, with a priority of 2 doesn't work #28

Closed matbor closed 10 years ago

matbor commented 10 years ago

If I use the priority map of 2 the service doesn't seem to send the notification....

2014-02-27 23:06:30,290 pushover *** MODULE=services/pushover.pyc: service=pushover, target=cfaalerts 2014-02-27 23:06:30,290 pushover Sending pushover notification to cfaalerts [{'priority': 2, 'retry': 60, 'expire': 3600}]... 2014-02-27 23:06:31,399 pushover Error sending pushover notification to cfaalerts [{'priority': 2, 'retry': 60, 'expire': 3600}]: HTTP Error 400: Bad Request 2014-02-27 23:06:31,400 mqttwarn Notification of pushover for/notifications/cfaalerts' FAILED`

But if I change it back to a 1 it works fine......

2014-02-27 23:06:55,930 pushover *** MODULE=services/pushover.pyc: service=pushover, target=cfaalerts 2014-02-27 23:06:55,930 pushover Sending pushover notification to cfaalerts [{'priority': 1, 'retry': 60, 'expire': 3600}]... 2014-02-27 23:06:57,062 pushover Successfully sent pushover notification

I tired sending the same message with another python script I wrote with a priority of 2 and the same retry and expire times and it works fine.

Matt.

jpmens commented 10 years ago

I see "HTTP Error 400: Bad Request" in there which leads me to believe something's missing ... The docs say "Rather than periodically polling our receipts API, you may also include a callback parameter when submitting your emergency notification."

We don't support that. PR welcome.

matbor commented 10 years ago

Ok.

Just FYI, this is what I used to successfully test it, will have a look at how it can be changed tmr...

import httplib, urllib
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
  urllib.urlencode({
    "token": " insert key here ",
    "user": " insert user key here ",
    "title": "testing priority2",
    "message": "hello world",
    "priority": 2,
    "retry": 60,
    "expire": 3600,
  }), { "Content-type": "application/x-www-form-urlencoded" })
jpmens commented 10 years ago

Works here ...

2014-02-27 15:52:49,701 pushover *** MODULE=services/pushover.pyc: service=pushover, target=hippo
2014-02-27 15:52:49,701 pushover Sending pushover notification to hippo [{'priority': 2, 'retry': 60, 'expire': 3600}]...
2014-02-27 15:52:50,814 pushover Successfully sent pushover notification
jpmens commented 10 years ago

Are you sure your payload is plain text?

matbor commented 10 years ago

Weird, will try again in the morning, but the payload was the same message for both of the tests above. Used mqtt inspector to send it. All I changed was the priority in the mqttwarn.conf.

matbor commented 10 years ago

Strange working today! sorry about that.

kulbirsaini commented 1 year ago

Ok.

Just FYI, this is what I used to successfully test it, will have a look at how it can be changed tmr...

import httplib, urllib
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
  urllib.urlencode({
    "token": " insert key here ",
    "user": " insert user key here ",
    "title": "testing priority2",
    "message": "hello world",
    "priority": 2,
    "retry": 60,
    "expire": 3600,
  }), { "Content-type": "application/x-www-form-urlencoded" })

9 Years Later. Thank you!

kyrylchenko commented 8 months ago

To send an emergency-priority notification, the priority parameter must be set to 2 and the retry and expire parameters must be supplied.