Getting Indigo to "control" an independent AppleScript

Posted on
Mon May 10, 2010 10:52 am
chrisn offline
Posts: 12
Joined: Oct 22, 2007

Getting Indigo to "control" an independent AppleScript

I faced a challenge and came up with a kludgey solution, but wonder if there is a more elegant answer.

I am working to integrate a bunch of non-insteon automation and a/v gear (for example, a Nuvo Grand Concerto whole-house system). I am working on an AppleScript that controls the Nuvo via Serial Bridge. But I want to be able to control the Nuvo from within an Indigo Control Page (e.g., click a "mute" icon and have the Nuvo mute).

I had already created a bunch of state variable inside my AppleScript, with a parallel set inside Indigo (with logic to have my script update the Indigo variables, as appropriate).

I had the idea to extend this concept into a "message bus" with three Indigo variables: "scriptReadyForCommand," "indigoWantsToSendCommand" and "Payload." The idea is to have the script poll Indigo as pat of its core polling loop (which mainly scans the serial ports looking for stuff from devices). Inside Indigo control pages, I assign an AppleScript to certain actions (like clicking the "mute" button) and then queue up the appropriate command via my "bus" variables. My standalone script "sees" this on the next polling cycle and pulls down the payload variable and parses/processes as appropriate.

I can't directly send bytes over the serial ports from within Indigo because only one script at a time can use a serial port. I also wanted to maintain at least a bit of an abstraction layer to streamline things.

The above seems to work fine, but I am wondering if I (due to inexperience) am approaching this all wrong and should be doing this in a better / more conventional way.

Any thoughts?

Thanks!

-Chris

Posted on
Mon May 10, 2010 2:17 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Getting Indigo to "control" an independent AppleScript

Hi Chris,

Your solution sound good to me.

We are, right now, working on an Indigo plug-in architecture that will make 2-way communication with hardware much simpler. It is Python based instead of AppleScript, but with the hooks we are adding (for Indigo 5.0) it will be much easier to accomplish the level of integration you need.

Image

Posted on
Tue May 11, 2010 9:06 am
chrisn offline
Posts: 12
Joined: Oct 22, 2007

Re: Getting Indigo to "control" an independent AppleScript

Sounds great. Can't wait. As an aside, you guys are awesome.

Posted on
Wed Jun 02, 2010 3:31 am
anode offline
Posts: 697
Joined: May 27, 2007
Location: NC

Re: Getting Indigo to "control" an independent AppleScript

support wrote:
Hi Chris,

Your solution sound good to me.

We are, right now, working on an Indigo plug-in architecture that will make 2-way communication with hardware much simpler. It is Python based instead of AppleScript, but with the hooks we are adding (for Indigo 5.0) it will be much easier to accomplish the level of integration you need.


You guys are still keeping AS though?

Posted on
Wed Jun 02, 2010 6:56 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting Indigo to "control" an independent AppleScript

Yes, we're definitely keeping AppleScript. We're just adding this plugin API as a way to add more native-like support for devices and actions.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests