ESP32 library for Pushover.
Originally a fork of ArduinoHannover/Pushover, it has since been completely rewritten, and now support HTTPS and image attachments.
Initiate Pushover client:
Pushover pushoverClient(token, user);
Messages are encoded within the PushoverMessage struct:
struct PushoverMessage
{
public:
const char *message = "";
const char *title = "";
const char *url = "";
const char *url_title = "";
const char sound = "";
bool html = false;
uint8_t priority = 0;
uint32_t timestamp;
File *attachment = NULL;
};
To write a message, simply declare a PushoverMessage object and modify the properties you need.
PushoverMessage myMessage;
myMessage.title = "Message title";
myMessage.message = "Message body";
pushoverClient.send(myMessage);
The library supports sending image attachments as laid out in the Pushover API.
To send an image, simply use the PushoverMessage.attachment property:
PushoverMessage myMessage;
myMessage.title = "Message title";
myMessage.message = "Message body";
File photo = SD.open("/DCIM/123456789.jpg");
myMessage.attachment = &photo;
pushoverClient.send(myMessage);
Remark: Due to the absence of native multipart/form-data support in the arduino-esp32 framework, our current implementation relies on the creation of a tempfile (by default in SPIFFS) which contains the HTTP POST multipart request body. Please do let me know if you have a better way. In the meanwhile, please make sure there is enough available space for this tempfile, which is a hair larger than the attachment itself. If instead of SPIFFS you would prefer the tempfile to be stored elsewhere (say SD), simply pass a pointer to SD during initialization of the pushover class:
Pushover pushoverClient(token, user, &SD);