AppleScript Integration Strategies Wiki Page

Posted on
Thu Feb 22, 2018 11:26 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

AppleScript Integration Strategies Wiki Page

We have created a consolidated wiki page that discusses various strategies for integrating AppleScript with Indigo and we highly recommend that you read through those options (particularly in light of the AppleScript to Indigo Server deprecation in Indigo 7.4). That wiki page is in the developer section which means that anyone with write access to that section of the wiki can add things as well as new integration methods come up.

Let us know if you have some ideas for that page and we'll add you to the editor list.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 22, 2018 11:31 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: AppleScript Integration Strategies Wiki Page

I'm sure the answer is yes but this also impacts attachments and background scripts as well as UI based scripting, right?

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Thu Feb 22, 2018 11:55 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: AppleScript Integration Strategies Wiki Page

UI based scripting? Not following...

Indigo doesn't load background scripts automatically - users generally create Startup triggers to start them. Background scripts that don't target the Indigo Server and are started up via a Startup trigger will most likely still work (we've yet to determine if AppleScript external scripts will launch the same way they do now, but it seems likely).

Attachment AppleScript scripts will no longer be supported since Indigo will no longer support AppleScript directly in the server.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 22, 2018 12:08 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: AppleScript Integration Strategies Wiki Page

jay (support) wrote:
UI based scripting? Not following...

The scripting you do directly in Indigo, via an Action Group or whatever.

I suppose my work is cut out for me to finally translate my attachment script I've been running since Indigo 4. Sigh.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Thu Feb 22, 2018 12:25 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: AppleScript Integration Strategies Wiki Page

Colorado4Wheeler wrote:
The scripting you do directly in Indigo, via an Action Group or whatever.


Oh - thought you were talking about scripting the UI (which would be odd since the server has no UI).

Any script that targets the Indigo Server (including embedded AppleScripts) won't work. We're looking at how we'll handle embedded AppleScripts but don't know exactly what we'll do when we upgrade a DB that has them.

Colorado4Wheeler wrote:
I suppose my work is cut out for me to finally translate my attachment script I've been running since Indigo 4.


Should be a breeze for you given your Python chops...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 22, 2018 12:42 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: AppleScript Integration Strategies Wiki Page

jay (support) wrote:
Should be a breeze for you given your Python chops...

Theoretically yes, but I've kept the AS around because in a plugin the devices that I need to control seem to time out at random spots. I was thinking of this the other day and may try to run them in their own threads to see if that fixes it. I don't have any choice anyway, upgrade or die :shock: :D .

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Fri Feb 23, 2018 6:28 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: AppleScript Integration Strategies Wiki Page

Ok, I've mostly finished a plugin that now handles the situation I needed AppleScript for but have a question. What is the Py equivalent of:

Code: Select all
if value of variable "CurtainSideState" is "closed" as string then
   send insteon group instnTurnOff using name "Sectional Keypad LED 5"
else
   send insteon group instnTurnOn using name "Sectional Keypad LED 5"
end if


Synchronizing KPL's throughout my house is probably the single biggest thing I use AppleScript for. I think it's this but want to verify:

Code: Select all
acId = "com.perceptiveautomation.indigoplugin.InsteonCommands"
actionPlugin = indigo.server.getPlugin(acId)
if actionPlugin.isEnabled():
   actionPlugin.executeAction("setKPLLeds", props={'keypadlinc':'1435361545','button4':'leaveAlone'})


But I don't know the command to turn the button light on and off. And, if I go Py on this do I need to worry about adding names to the Manage Insteon PowerLinc Links screen (as you can see from the AS "Sectional Keypad LED 5" is a name created in that window)?

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Sat Feb 24, 2018 5:13 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: AppleScript Integration Strategies Wiki Page

So there are 2 different ways to turn individual KPL LEDs on and off. The fastest (because it is a group/scene command not an extended command) is to use a PowerLinc Group/Scene. The only downside is you have to add the scene to the PowerLinc beforehand. It looks like you've already done that though based on the AppleScript snippet you have posted. The Python equivalent would be:

Code: Select all
if indigo.variables["CurtainSideState"].value == "closed":
  indigo.insteon.sendSceneOff("Sectional Keypad LED 5")
else:
  indigo.insteon.sendSceneOn("Sectional Keypad LED 5")

The first arg to that function can also be an integer that is the group/scene number. There are a couple of optional arguments as well: sendCleanUps and suppressLogging.

If you want to take the other approach and use an extended INSTEON command (slower but no pre-configured PowerLinc scene needed), then you can use:

Code: Select all
indigo.relay.setLedState(devID_or_Name_or_Instance, 4, True)

Image

Posted on
Sat Feb 24, 2018 5:20 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: AppleScript Integration Strategies Wiki Page

Perfect, thank you Matt!

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests

cron