Trigger Modules or Action Groups via Python from other apps

Posted on
Mon Mar 27, 2023 1:54 pm
bulldogarf offline
Posts: 14
Joined: Aug 08, 2007
Location: Chicago, IL

Trigger Modules or Action Groups via Python from other apps

I've been trying to find a way to very simply trigger Indigo modules and/or group actions via Python from another app that is capable of sending shell scripts. I was able to do this using AppleScript in the past until it was deprecated.

Is there a simple way of doing this that doesn't require deep understanding of Python? It's on my list of things to learn in depth, but I just don't have the time currently. Any direction is appreciated! :D

Posted on
Mon Mar 27, 2023 4:22 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Trigger Modules or Action Groups via Python from other a

If the app is literally sending shell scripts, then you should be able to find something useful here: REST API Conversion Examples

There are other methods of sending commands to Indigo, but it's hard to know what method to use without knowing how the individual app sends those commands.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Mar 27, 2023 5:09 pm
bulldogarf offline
Posts: 14
Joined: Aug 08, 2007
Location: Chicago, IL

Re: Trigger Modules or Action Groups via Python from other a

Hi Dave,

Thank you for the response. To be honest I don't have a clue what REST is so I'm totally in the dark but I'm going to try to put things together via this forum. As such, a few items...

1) Would I be using the following HTTP option for triggering a group?

curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.actionGroup.execute","objectId":123456789}' http://127.0.0.1:8176/v2/api/command

If so, my first obstacle is the "Authorization: Bearer YOUR-API-KEY" I noticed that the REST options referenced passwords so I'm assuming the API KEY is a security item?

2) The other software that I'm using is called Keyboard Maestro. I've been seeking answers from that side of things as well, but everyone I've chatted with needs more info from the Indigo perspective. If it's helpful, following is the main scripting page for their wiki:

https://wiki.keyboardmaestro.com/manual/Scripting

3) There might be better common options for triggering Indigo items listed on that page, but I have no clue as of yet.

Considering my absolute lack of understanding of shell basics and Python, etc, it's been like searching through dozens of haystacks to find the one or two needles that I probably only need for this to work. So I appreciate any direction that I can get and it all goes towards my bigger goal of starting with some scripting basics and building up from there.

-Troy

Posted on
Mon Mar 27, 2023 5:34 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Trigger Modules or Action Groups via Python from other a

Using curl would be fine from the Execute Shell Script action in Keyboard Maestro. You just need an API Key from your Indigo Account (at the bottom just click the Add API Key button). This same link is at the top of the page DaveL linked to you earlier.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Mar 27, 2023 5:40 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Trigger Modules or Action Groups via Python from other a

On the page I referred you to, there's some information right at the top that's very important.

The API Key is something that you'll need to set up to identify your app to your Indigo Server. It's recommended to create a new key for each app you want to use. Then replace "YOUR-API-KEY" with the actual key you created. Second, replace the action id "123456789" with the actual id of the action item you want to run. Third, replace "YOUR-REFLECTOR" with the actual name of your Indigo reflector. It'll look something like this:

Use this command from anywhere (preferred):
Code: Select all
curl -X POST -H "Authorization: Bearer abc123-abc123-abc123" -d '{"message":"indigo.actionGroup.execute","objectId":238475738}' https://YOUR-REFLECTOR.indigodomo.net/v2/api/command
Use this command on your local network:
Code: Select all
curl -X POST -H "Authorization: Bearer abc123-abc123-abc123" -d '{"message":"indigo.actionGroup.execute","objectId":238475738}' http://127.0.0.1:8176/v2/api/command

This is for sending shell scripts. I know it seems like a lot, but once you get the hang of it, it's really pretty simple as you only need to change a couple of pieces of information to work with another action group.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Mar 28, 2023 10:40 am
bulldogarf offline
Posts: 14
Joined: Aug 08, 2007
Location: Chicago, IL

Re: Trigger Modules or Action Groups via Python from other a

Success! It worked perfectly.

This solution is a small part of a custom photo center I built that uses an IR-controllable turntable and tethered DSLR camera. I use Keyboard Maestro (and AppleScript) for triggering the camera, turntable, lighting and video projection via MIDI and DMX. The one thing that I hadn't yet been able to do within it was simply turn on the Insteon appliance modules for the equipment power.

It's a small thing, but my entire studio uses 30+ Insteon devices and a Harmony Hub for AV control so this is just the beginning of different productive/creative options that I can picture even with just simple Indigo and KM bridges.

I can't thank you both enough. :D

-Troy

Posted on
Tue Mar 28, 2023 10:49 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Trigger Modules or Action Groups via Python from other a

Glad to hear that you found a solution that'll work for you.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sat Apr 29, 2023 6:55 pm
bulldogarf offline
Posts: 14
Joined: Aug 08, 2007
Location: Chicago, IL

Re: Trigger Modules or Action Groups via Python from other a

I'm now wondering if there's a way to send triggers to Indigo actions outside of API. I just temporarily canceled my up-to-date subscription for a bit, as this month and next are completely saturated with various large subscriptions that are now pushing $500 and I need to spread them out. But unfortunately this apparently has killed scripting functionality.

Any options for doing any of this sans-subscription?

Posted on
Mon May 01, 2023 11:55 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Trigger Modules or Action Groups via Python from other a

Yes, you can use the indigo-host command line to execute actions directly (or turn on/off devices, change Indigo variable values, etc.).

The scripting tutorial page here has lots of examples, but what might work for you is the Executing Indigo Commands Directly example. If you want to execute an Action Group the syntax would look like:

Code: Select all
indigo-host -e 'return indigo.actionGroup.execute(12345678)'

Note this has to be executed on the same Mac as the Indigo Server, although you can get around that by using SSH if needed.

Image

Posted on
Tue May 16, 2023 8:50 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Trigger Modules or Action Groups via Python from other a

bulldogarf wrote:
Success! It worked perfectly.

This solution is a small part of a custom photo center I built that uses an IR-controllable turntable and tethered DSLR camera. I use Keyboard Maestro (and AppleScript) for triggering the camera, turntable, lighting and video projection via MIDI and DMX. The one thing that I hadn't yet been able to do within it was simply turn on the Insteon appliance modules for the equipment power.

It's a small thing, but my entire studio uses 30+ Insteon devices and a Harmony Hub for AV control so this is just the beginning of different productive/creative options that I can picture even with just simple Indigo and KM bridges.

I can't thank you both enough. :D

-Troy
Dude, that is sick… care to share some of your set up?

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron