The standard event handler action to send an Alarm to the outside world is an Email. We run many processes unattended overnight and needed something more "Urgent" to get staff attention. Perhaps there is a better way, but what works for us is that a Notification gets send to one or a group mobile phones. On the phone the Notification pops up with a sound (even on a locked phone) and action can be taken.
You can run your own server or use something like OneSignal. All use API.
Enter HTTP Builder. Very powerful.
In Mango a global script has been created with all the authorization, etc variables and gets called in other scripts.
Global Script:
function OneSignalNotice(notice){
var url = "https://onesignal.com/api/v1/notifications";
var headers = {
"Content-Type": "application/json",
"Authorization": "Basic ZWY5NmUxZjctYjAyNC00MTg0LWxxxxxxxxx",
};
var parameters = {
"app_id" : "9b42d346-dd6f-4462-85a5-xxxxxxx",
"contents" : {"en": notice},
"included_segments" : "All"
};
HttpBuilder.post(url, headers, parameters).err(function(status, headers, parameters) {
throw "Script failed with HTTP status : " + status;
}).resp(function(status, headers, parameters) {
"Hallo"
}).execute();
}
I don't think Event Handler / Set Point / Set to scripted value is meant to be used this way, but it works:
// Send OneSignal Alarm Notice
OneSignalNotice("ALARM Harvest 1 Temperature is too HIGH at: " + JSON.stringify(p226.value));
.
I hope it will help someone.