Thursday, May 10, 2012

Pushingbox.com Web Service

Just discovered http://www.pushingbox.com. Man this is a great free service. As a matter of fact, I am not sure how long this service will be free. The website exposes an API that allows you to send emails or push notifications  to cell phones. The API can be called from CURL, php or a python script. I downloaded the CURL exe and tried it out with some simple VBScripts.


I wanted to setup a monitor to watch the indoor temperature on my house and send me an email notification. I will add other monitors using data from my weather station going forward, but just wanted to setup this quick test.


1. Sign up at the PushingBox.com web site. I just used my google sign in. One gripe about the site is that its a little slow


2. Click on My Services and Add a service. You can add email and such. I went ahead and download Notifry from the Google Play Store. Once you install Notifry you have to get it setup and they give you a big long API ID. You have to type that in on the add service page when you add Notifry



Pro Tip: make sure you disable the Autmoatic talk feature on Notifry…otherwise when you send your first test your phone will automatically read the message outloud upon receipt…that was a nice surprise when I first tried it.


3. Click on My Scenarios. Give your Scenario a name. I called my Indoor Temperature Monitor and click Create. Here you will be able to setup your message. I am using a variable in my message which is designated using the $variablename$ syntax. This is because I wanted my message to tell me how hot the house is. 



4. Once you have created a scenario you will be given a device ID. You will need this device id in the CURL call or whatever method you are using to call the API. Capture that DeviceID for later use.



5. Test the API by visiting the device id in a web page: http://api.pushingbox.com/pushingbox?devid=v1234567890&indoortemp=91


Replace the v1234567890 with your DeviceID and the indoortemp with your variable name.


If all works according to plan you should receive a push notification on your mobile device.


If that does not work, make sure you have your device setup correctly. Switch over to email on the services and try to test receiving an email.


6. Now you are ready to script it up. Again I used CURL but you can use PHP or Python or whatever.


Here is my VBScript:


set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.OpenTextFile("temp.txt",1,True)
Set WshShell = CreateObject("WScript.Shell")

while not f.AtEndOfStream
lineread = f.ReadLine
lineArray = Split(lineread,"|",-1)
currtemp = lineArray(1)

if currTemp > 80 then
Set oExec = WshShell.Exec("c:scriptscurl ""http://api.pushingbox.com/pushingbox?devid=v12345678990&indoortemp=" & currTemp & """")

Do While oExec.Status = 0
WScript.Sleep 100
Loop
end if
wend

I just hardcoded a test file in this case. I will play with my weather station output this evening. This will just check to see if the temperature in this text file is over 80 degrees. Here is a sample of the text file:


IndoorTemp|89


I will have to modify that to parse out the temperature text file…but you get the gist. So now if my house gets over 80 degrees I will get a push notification. Pretty cool.

Wednesday, May 2, 2012

Mount ISO AIX 6.1

To mount ISO


loopmount -i /iso/dvd.iso -l loop0 -o "-V cdrfs -o ro" -m /mnt/dvd

To umount ISO


loopumount -l loop0 -m /mnt/dvd

If you get a message stating that Specified Loopback device is not found in ODM then you can run this command to make a loopback device.


mkdev -c loopback -s node -t loopback