Indigo - Keyboard Maestro Variables Syncing

Posted on
Tue Sep 14, 2021 1:35 pm
bulldogarf offline
Posts: 10
Joined: Aug 08, 2007
Location: Chicago, IL

Indigo - Keyboard Maestro Variables Syncing

I'm creating interfaces in Indigo for mobile that optimally will be used to both trigger and monitor processes controlled by Keyboard Maestro and AppleScript. I would like to be able to read/write variables to either system but as of yet, haven't found any methods to do this. It's easy to trigger KM via Python from Indigo but I don't yet know how to do the reverse or possibly sync variables that could be shared between the two.

Can anyone point me in the proper direction for this?

Posted on
Tue Sep 14, 2021 3:40 pm
jay (support) offline
Site Admin
User avatar
Posts: 17058
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Indigo - Keyboard Maestro Variables Syncing

KM can run python scripts, which in turn can call the Indigo REST API. For instance, I use this to toggle my desk lamp when a function key is pressed:

Code: Select all
#! /usr/bin/python2.7

import requests

url = 'https://MYREFLECTOR/devices/Office%20Lamp?toggle=1&_method=put'
requests.get(url, auth=requests.auth.HTTPDigestAuth('username', 'password'))

You could use the same method I think to get a variable value and return it from the script. KM would then get the value and store it into a KM variable. Likewise, it's probably likely that you can pass a KM variable to a Python script that could update the Indigo variable. I don't know specifically how to do either because I've never tried it, so you'll need to experiment with KM to figure it out.

Note: for this script to work you need to have the requests module installed in your Python environment.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest