Notify My Android Integration

Description

As discussed in the Twitter topic, I have successfully integrated Notify My Android's (NMA) API in to ARC through EZ-Script. This will allow push notifications from ARC to your Android devices for instant remote warnings and information.

To set it up first you must have a Notify My Android account, there are free accounts or for a flat $4.99 fee you can upgrade. Free are fine if you send less than 5 notifications per day but for $5 it's worth upgrading...

Step 1

As discussed in the Twitter topic, I have successfully integrated Notify My Android's (NMA) API in to ARC through EZ-Script. This will allow push notifications from ARC to your Android devices for instant remote warnings and information.

To set it up first you must have a Notify My Android account, there are free accounts or for a flat $4.99 fee you can upgrade. Free are fine if you send less than 5 notifications per day but for $5 it's worth upgrading so you don't miss out on anything important.

To do this visit www.NotifyMyAndroid.com Click on Register Enter your desired username, password, email address and captcha.

To use the API you will need an API code. Once you have your NMA account and have logged in click on My Account Next click on Generate Key You should be given a long key on the page. User-inserted image

Next, you will need the NMA app on your device(s). It's free from Google Play Store. Click here to get it.

Open up the app and log in with your details - this is straight forward enough and self explanatory. User-inserted image

User-inserted image

User-inserted image

Now, open up ARC and load up your project. Add a new script with the following (you will need to add in your API key)


$apikey = ""
$event = "Notification"
$description = "Test message sent from within ARC via  EZ-Script commands"
$priority = "0"
$url = "http://www.ez-robot.com"

# Notify My Android call
HTTPGet("https://www.notifymyandroid.com/publicapi/notify?apikey=" + $apikey + "&application=EZ-Builder&event=" + $event + "&description=" + $description + "&priority=" + $priority + "&url=" + $url)

Once you have your API key added to the above code, test the script out by running it. You should receive a notification on your Android devices.

Now you have confirmed it is working edit the script. Remove lines 2, 3, 4 and 5


$event = "Notification"
$description = "Test message sent from within ARC via  EZ-Script commands"
$priority = "0"
$url = "http://www.ez-robot.com"

This is now your basic command for sending notifications. To use it, in any script where a notification is needed simply add the following code (fill in the event, description and priority variables to suit the notification). Note: Priority is -2, -1, 0, 1 or 2 with -2 being lowest and 2 being highest.


# NMA
# Set event and description for the notification
$event = ""
$description = ""
$priority = "0"
$url = ""
# Call the command
ControlCommand("Notify", ScriptStart)

The script should then start the notification script (mine is called Notify), pass the new Event and Description information to the url in the HTTPGet and your Android device(s) should receive the messages.

Use this code in any scripts and, provided you set the $event, $description, $priority and $url variables before running the ControlCommand the message will be tailored to suit the specific trigger or event.

Please ask any questions or ask for anything that is not clear to be clarified where necessary. If it will help I can add images to this to show everything however it shouldn't be necessary.

User-inserted image

User-inserted image

User-inserted image


ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming