Page 1 of 5

iMessage/Messages/Siri Indigo Control Script

PostPosted: Sun Dec 23, 2012 11:45 am
by DVDDave
Hi all,

A few days ago I added a script to the User Contribution library called iMessage/Messages/Siri Indigo Control Script. This is actually a script for the Messages application that provides a link from Siri to Indigo. This allows Siri to send a text message (SMS or iMessage) to control Indigo in a very flexible way.

The script is working amazing well for me. I love being able, while driving home, to have Siri "Tell Indigo to raise the temperature". Or, when I get up in the morning to "Tell Indigo to turn on the Christmas Tree." The response is almost instantaneous; the script is executed by the time Siri announces that the message was sent. There is also no impact on CPU utilization that I can see.

It's very easy to modify the script and the changes take effect immediately. Commands can be generic actions to control devices and execute action scripts. Or the script can specify specific actions triggered by custom phrases. It's easy to add customize the commands for your setup simply by copying and changing the existing Applescript statements. I keep an alias of the file on my desktop and click on it whenever I think of something else I would like Siri to do.

Anyway, I'm curious whether anyone is interested in using this simple method to control Indigo from SMS/iMessages and Siri. If so, please let me know what does or doesn't work for you and I could modify the sample script and instructions as necessary to make it easier for others. I'm also curious if anyone has tried it with Indigo 6.

Thanks and happy holidays!

--Dave

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Sun Dec 23, 2012 11:49 am
by durosity
Brilliant.. i was thinking of doing something like this.. you’ve just saved me hours of headaches and hair pulling :D

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Sun Dec 23, 2012 5:07 pm
by ckeyes888
Love to try it. Looked thru the library but don't see it. Might you have a link?

Thanks,

Carl

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Sun Dec 23, 2012 5:14 pm
by durosity

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Sun Dec 23, 2012 9:19 pm
by davvi
This is fantastic! I have on issue though. I name all my devices with the name of the room before the name of the device so a bookshelf lamp in the office is "Office: Bookshelf Lamp". I don't want to rename all my devices as there are too many dependancies tied to the names. How can I get the script to recognize the devices?

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Sun Dec 23, 2012 10:08 pm
by ckeyes888
I assume this will not work using 10.5.8? I don't see a Messages folder anywhere
in the Library.

Thanks,

Carl

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Sun Dec 23, 2012 10:50 pm
by davvi

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Wed Jan 02, 2013 9:08 pm
by dmeeker@mac.com
Hey guys,

The functionality seems great, but I just can't get it to fire off when a message is received by imessage. I checked the console also, but see no errors.

Quick recap:

1) moved your script into the /Library/Scripts/Messages/ folder on my root.
2) Created an iMessage account
3) Told iMessage to fire that script when a message comes in

I can send messages from my iPhone to the account, and they show up correctly in iMessage. But nothing happens.

If I run the script manually, It runs, but when I typed "turn off kitchen lights" (which is the name of the kitchen lights in my Indigo database, I got a return "error turning off kitchen lights".

Do I need to edit the AppleScript's actions so that they match with what I want to do? I looked at your post, and reviewed the script quickly and it didn't appear so.

I'd love to get this working, so please let me know if you experienced any issues getting it running or if there is something simple I am simply not doing.

Thanks for the help in advance.

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Thu Jan 03, 2013 10:30 am
by dmeeker@mac.com
Quick Update, as I made a touch of progress.

I accidentally didn't have the script set to fire off when an incoming message was received. Instead I had it on login.
That seems to have fixed the first issue - of nothing happening with the script (... captain obvious!).

Now that that has been changed, I am seeing something else I am unsure about. When the message is sent to iMessage, the script pops up and I see the applescript dialog box pop up that reads "send a command to Indigo Remote Control". "status" is pre-populated.

Please let me know your thoughts.

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Thu Jan 03, 2013 7:48 pm
by bbruck
What a fantastic script! I've been telling my Christmas tree to turn on and off with delight!

Unfortunately, my devices also have prefixes - B-Office Lights for Basement, so I'll have to find a way around that as well, but for now, success!

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Thu Jan 03, 2013 8:07 pm
by davvi
Any ideas on modifying the script to work without renaming devices?

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Thu Jan 03, 2013 8:09 pm
by bbruck
In my case all my devices have a two character prefix - B- or M- or S- etc so I can prolly strip off two characters, but I may just rename the devices

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Fri Jan 04, 2013 1:03 pm
by dmeeker@mac.com
After more experimenting, I can get the script to run properly using "Late Night Software's Script Debugger".
It works like a champ if I just run it from the script debugger/editor.

I can't get it to run at all from iMessage though.

Stupid question - I am assuming that I message passes the value of the message to the script. And I assume that I should fire the script from i message "when a new message is received". Right?


Thanks!

dave

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Mon Jan 21, 2013 5:56 pm
by Randaulf
I am also having an issue running this script from iMessage. I can run it in script form (a box comes up and I type in what command) and everything works fine. When I run it i iMessage I again get the pop up message asking for my command and I also get another pop up box that says:

An error occurred while executing an AppleScript event handler.
Event: Message Received in Active Chat
File: Messages Indigio Control Script sample.scpt
Error: Error-1708


This could be user error, but like I said it seemed as if the script was working without the interjection of iMessage. Please let me know if there is anything that I should be trying in order to get this up and running.

Thanks!

Re: iMessage/Messages/Siri Indigo Control Script

PostPosted: Fri Feb 01, 2013 8:04 pm
by midd
where in the script do you list your devices?


I'm getting error 1708 also.

Thanks