PAC fun and games via IFTTT


#1

Hi All,

Have you ever wanted to poke some PAC data into the cloud, for example, a temperature into a google doc spreadsheet?

At one point I had something mostly working to stick data directly into a google doc, but it was ugly (using a TCP comm handle), then google changed their API and it didn’t work anymore.

However, with fewer steps/less pain I was able to beam data up to a google doc spreadsheet through the magic of another free cloud service–IFTTT (click here for info).


The code in my strategy looked something like this:

// SUBJECT AND BODY
// Subject Line as defined in IFTTT, see ifttt.com for details, I created a "recipe" like:
// If (email) then (google drive)
stEmail_User_Body_Table[0]= "#cubetemp";  

// RECIPIENTS
stEmail_Recipients[0] = "trigger@ifttt.com"; 

// Data as a string in element [1]
FloatToString(aiCubicalTemperature, 10, 2, stEmail_User_Body_Table[1]);

// Send email without the attachement
nResult = SendEmail( stEmail_Server, stEmail_Recipients, stEmail_User_Body_Table );

Also see attached chart which you can import into your own strategy: SimpleEmailIFTTT.zip (3.07 KB)

IFTTT certainly isn’t perfect (I see “beta” at the bottom of their website, and I regularly get these mysterious "General Action Error"s). However, when I changed my data to the minute on my PAC, it looked like no data was getting missed (it must “catch up” after General Action has his error or three).



Also note, that while this particular recipe was relatively quick, according to the About section on the IFTTT website: “Most Personal Recipes check for new Trigger data [B]every 15 minutes[/B], some are even faster.”

I’m trying to get the “Phone Call” channel to work (so I could literally “phone home” and turn something on/off for example, maybe that iron? space heater?), stay tuned for updates…

Anyone else out there playing with IFTTT? Do share!

Thanks,
-OptoMary


#2

Update, I got my “phone” thing working, but it doesn’t understand my voice via my cell phone very well. Then again, I don’t have a very strong voice. Listen for yourself to what I said:

Here’s what IFTTT heard:
“Hey it’s 2 days 3 hey it’s 4 space 5 days 678910 alpha bravo.”

I’m still hopeful I’ll get something working here where my PAC reads in this text file that IFTTT wrote to my hard drive via dropbox…


#3

Now that I’ve read voice commands into my PAC through the magic of IFTTT (just need PROJECT! ENUNCIATE), next I’ll assign commands to turn on/off the fireplace (or whatever), then I can “phone home” while I’m driving and control the world!! … Or a least my little part of it.


Too much fun! Say what? What’s OptoMary talking about?

Here’s what I did,

  1. set up a "recipe" through IFTTT.com which connected a "Phone Call" to Dropbox
  2. wrote a little strategy to check for changes in that file (I used SoftPAC & groov Server for Windows)
  3. had groov display the command it got, in this case: "Test 12 test 12"

Here’s the IFTTT recording, not sure how long it’ll stay up on there servers…

IFTTT answers and records my phone call and does it’s best to convert my voice into text (recording on the link above). Then it writes that text with some other optional data, including the location of that recording and a timestamp, to a file in Dropbox.

Next up: make some standard voice commands like, I dunno: “party in 30 minutes” or “open gate” perhaps…

-OptoMary


#4

Great work Mary… And just in time!

Opto just got its set of Google Glasses.
They have been making their way around the company and its my turn to play with them for a few days.
I wanted to set myself the task of getting a message from the Google Glass onto the LED marque board I have in my garage (as you do).

Since the LED board is already hooked to a PAC Controller, I can log into my groov and type a message and it will get scrolled across a thousand or so LED’s.
The trick then is to link the Google Glass to that PAC Controller.

I figured Marys Dropbox trick was the go.
First thing I had to do was move the strategy off the PAC S controller and put it on a SoftPAC. The PAC S and PAC R controllers can not access a Dropbox, only the SoftPAC can do that (since its on the same computer as the Dropbox, its like its a local file).

Once I moved that, I made a recipe on IFTTT.
The recipe is that a text message to their phone number from my phone number will write a text file to my DropBox.
Since the Google Glass is linked to my phone, if I send a text from the Glass, it ends up as text on my Dropbox.
I tested it a few times, and it seems pretty quick and solid.

So, now to get the SoftPAC strategy to check the Dropbox file, and move it into a string, then delete the file.
Here is the code to do that.


// check the dropbox for any messages that may have come in from google glass or text.
// define 'file_dropbox' as the following in your strategy tree.....
// file:r,E:\dropbox\IFTTT\SMS\sms.txt
sms_status = OpenOutgoingCommunication(file_dropbox);

// If there is a file, then open it and get the guts of it.
if (sms_status == 0) then
  //pull the contents of the file into a table.
  sms_status = ReceiveStrTable(1, 0, sms_data_table, file_dropbox);

  // Ok, we got the file contents, delete the file so IFTTT can make the same file next time.
  sms_status = SendCommunicationHandleCommand(file_dropbox, "delete");

// now send the string to the LED sign.
  led_sign_string_from_web = sms_data_table[0];
endif

My Dropbox is on my E drive, so that’s why the drive letter is what it is (my C: drive is an SSD and it does not have the space for the Dropbox).

So, here is the process (I plan to make a little video of this over the weekend if I get time).
You wake up Google Glass by tapping the side or tilting your head back.
Say “Ok glass”.
“Send a message to”.
“If this” (I made a contact called ‘if this’ with their magic phone number in it).
“This is a test message for the led sign” (Or what ever you want scrolled).
At that point, you just wait about 5-8 seconds, and Bam. Your message scrolls.

Very cool.