Skip to content

brunojoyal/PushoverESP32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PushoverESP32

ESP32 library for Pushover.

Originally a fork of ArduinoHannover/Pushover, it has since been completely rewritten, and now support HTTPS and image attachments.

Usage

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);

Attachments

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);

About

Pushover.net client for ESP32, with HTTPS & attachment support.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages