United Kingdom
Asked — Edited

Notify My Android Integration

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

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

United Kingdom
#1  

Reserved for Q&A/FAQ Etc.

#2  

Tested and approved ! I just had to change the ControlCommand line because my "Notify" script was in the Script Manager.

It is working great and it is much more efficient than my Dropbox RSS alert. Thanks for the tutorial.

United Kingdom
#3  

There is a dropbox plugin for it on the NMA website, I haven't looked at it I just noticed it when I was browsing the apps earlier.

The only downside (currently, however there may be a way) is it wont push images to the device. However, you can send links. It's work in progress still, I'm sure I will want to make it better and easier to use for everyone but it's a start (and so very very flexible, supported by a lot of languages too)

United Kingdom
#4  

Update: Priority added in. Lowest priority being -2 and highest being 2.

#5  

You're an awesome dude Rich!

Thanks for your generous contributions...

United Kingdom
#6  

I wasn't happy with the tutorial so I just rejigged it all and added more images.

I also added in the url too, this is added after the notification so you can touch it and go to the website, perfect for any "unauthorised access detected" notifications to load up the http server and look at the camera.

#7  

You are the man. Just love what you do.

;););) ;)

J

#8  

"Rejigged". I love the way you all talk over on the other side of the big pond!

Nice work Rich.

#9  

That's really cool Rich. A great demonstration of what the EZB Platform can achieve.

#10  

Hi Rich, I saw your post & its good but I want something that is compatible to all devices, not just Android

Singapore
#11  

Rich , which api is it referring to? Is it NMA or my mobile device and where can I get it?

United Kingdom
#12  

It's the NMA API and you don't "get it", it's web based. You send the requests to it.

Singapore
#13  

Oh wait I got it. I went to My Accounts page and clicked on Generate New Key. Is that the one?

United Kingdom
#14  

Yes, you will need your API key.

As described, it needs to be entered in to this script;

$apikey = ""

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

It goes on the first line between the quotes.

Save that script as "Notify" or something as meaningful. Set the other variables as required and call the notify script.

It's advised you follow closely what I wrote in post #1, it is all explained and will avoid receiving any errors.

Singapore
#15  

I did as followed but the error I get is unable to http get www.notifymyandroid.com

United Kingdom
#16  

I'm not sure if it was the forum which added in a semi-colon or if it needed it but they look out of place. I'm not home right now so can't check but try without the semi-colons and see if that helps.

NMA's website is up as is the API, it should be working (it was at 7:40am this morning as my external PIR notified me that I was walking out of my house).