Pushover is a simple messaging platform for receiving real-time notifications. MegunoLink’s Pushover integration lets your Arduino sketch send notifications that can be received on any Pushover client. Clients are available for iOS, Android and desktop computers.
To send notifications from your Arduino sketch to Pushover:
- create a Pushover account (if you don’t have one already),
- add your Pushover user key to MegunoLink, and
- create a
Pushover
variable and use itsSend
method in your Arduino sketch.
You can customize the notification message, sound and alert level when sending Pushover notifications from your Arduino sketch.
Getting Started
You’ll need a Pushover account and at least one client application. Follow the Pushover‘s instructions to set up your account and client application.
Add your Pushover user key to MegunoLink so MegunoLink can pass on notifications from your Arduino program. Log in to your Pushover account to find your user key, which looks like a random mix of letters and numbers about 30 characters long. Copy the user key and paste it into the MegunoLink Pushover Settings dialog (⚙ → Pushover Settings). Make sure the Allow serial commands to send Pushover messages is checked and click OK to apply the settings. Pushover settings are stored within the MegunoLink project file, so you can use different settings for each project.
Install our Arduino library to send Pushover commands to MegunoLink.
Create a Pushover
variable in your Arduino sketch and use its methods to send notifications:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#include "MegunoLink.h" void SendJobsDone() { Pushover Notifier; Notifier.Send(F("Job's done!")); } void SendTaskFailed() { Pushover Notifier; Notifier.Send(F("Job failed!"), Pushover::BugleSound, Pushover::HighPriority); } |
Arduino library reference
Create a Pushover
variable in your sketch to use our Arduino library to send Pushover notifications with MegunoLink. Add #include "MegunoLink.h"
at the top of your sketch to make the library available.
Methods
A Pushover
variable has the following methods:
- Pushover(), Pushover(Destination)
- Send(Message), Send(Message, NotificationSound), Send(Message, NotificationSound, Priority)
Method Descriptions
Pushover Constructor
Creates a Pushover
variable, which can be used to send commands to MegunoLink to send Pushover notifications.
Pushover(Print &Destination = Serial);
Name | Type | Required? | Description |
---|---|---|---|
Destination | Print & | No | Sets the serial connection to use for sending messages to MegunoLink. Defaults to Serial , the default Arduino RS232 port. |
1 2 3 4 |
#include "MegunoLink.h" Pushover Notifier1; // send commands to MegunoLink using default (Serial) port. Pushover Notifier2(Serial1); // send commands to MegunoLink using Serial1 port. |
Send
Sends a command to MegunoLink to have it send a Pushover notification.
Send(const char* Message);
Send(const char* Message, ENotificationSound AlertSound);
Send(const char* Message, ENotificationSound AlertSound, EPriority PriorityLevel);
Send(const __FlashStringHelper* Message);
Send(const __FlashStringHelper* Message, ENotificationSound AlertSound);
Send(const __FlashStringHelper* Message, ENotificationSound AlertSound, EPriority PriorityLevel);
Name | Type | Required? | Description |
---|---|---|---|
Message | const char*, const __FlashStringHelper* | Yes | The message to include in the notification. |
AlertSound | ENotificationSound | No | The sound to play on the client device when it receives the notification (see below). |
PriorityLevel | EPriority | No | The priority of the notification (see below). |
MegunoLink supports the following Pushover notification sounds (ENotificationSound
): DefaultSound
, PushoverSound
, BikeSound
, BugleSound
, CashRegisterSound
, ClassicalSound
, CosmicSound
, FallingSound
, GamelanSound
, IncomingSound
, IntermissionSound
, MagicSound
, MechanicalSound
, PianobarSound
, SirenSound
, SpaceAlarmSound
, TugboatSound
, AlienSound
, ClimbSound
, PersistentSound
, EchoSound
, UpdownSound
, NoSound
.
The following priority levels (EPriority
) are supported: DefaultPriority
, LowestPriority
, LowPriority
, NormalPriority
, HighPriority
, EmergencyPriority
.
1 2 3 4 |
Notifier1.Send("So long and thanks for all the fish"); Notifier1.Send(F("Job's done")); Notifier1.Send(F("Missile detected"), Pushover::IncomingSound, Pushover::EmergencyPriority); Notifier1.Send(F("We are out of milk"), Pushover::EchoSound); |
Pushover Bridge Reference
MegunoLink provides a bridge to enable embedded devices to send notifications using Pushover Internet services. You may like to use the Pushover API directly if your embedded device has an Internet connection of its own.
MegunoLink’s Pushover bridge is configured using the Pushover Bridge Settings dialog. To open the settings dialog, select Pushover Settings from the Gear menu (⚙) in MegunoLink;
Enable/disable bridge
MegunoLink will only process serial commands to send Pushover notifications when the Allow serial commands to send Pushover messages option is checked. Uncheck the option to disable notifications.
API Key
A trial Pushover API key is bundled with MegunoLink so you can easily test Pushover notifications. However, notifications using the trial key are limited to ensure MegunoLink doesn’t abuse Pushover services. You can send up to 10 notifications in a day but no more than 1 notification every five minutes.
Obtain your own key from Pushover’s website if you need to send messages more frequently. You can obtain your own API key by following these instructions for creating a new Pushover application. After registering, Pushover will provide you with an API token for your application. Copy the token and paste it into the Custom key field in MegunoLink’s Pushover bridge settings. The key is saved in your MegunoLink project file, so you can use different API keys for different projects.
Use the Minimum message interval option to help ensure a bug in your sketch doesn’t quickly use up your Pushover credit by sending too many notifications. Any commands to send notifications more frequently than the interval selected will be ignored.
Setting the Notification Recipient
Paste the user key from the Pushover account that MegunoLink should send notifications too. When Send to all devices is selected, MegunoLink will send notifications to all devices registered with the user key. To send notifications to only one device, select Send to and enter the name of the name of the device that should receive notifications. You’ll find the name in the Pushover settings on your device, or in the account page on the Pushover website.
Notification Properties
Set the Default priority and Default sound options to the priority and alert sound that MegunoLink should use when your Arduino sketch doesn’t supply this information.