https://www.dropbox.com/s/yfncdnbluet5haq/SATI-0-3-3.zip?dl=1
fSimple Applescript to Indigo (SATI) interface .
this should help with the situation when you have applescript error messages "application not running"
steps to install:
1. download zip file,
2. install SATI plugin,
3. select the frequency of interaction between this plugin and applescript in config (i.e. how often will the file be checked). 1 second is probably ok.
The plugin will create a directory SATI in ~/documents
how to use:
check out the included applescript file for an example how to use it...
you can
- get values of variables or device/states
- set value of a variable
- execute an action group
- execute any valid python command within indigo
use the following to execute in applescript:
set cmd to "\"getVariable;:;:;varName\" "
set cmd to "\"getDeviceState;:;:;devName;:;:;stateName\" "
set cmd to "\"setVariable;:;:;varName;:;:;value\" "
set cmd to "\"exeAction;:;:;877534\" "
set cmd to " \"getvariable;:;:;EnergyMonth2\" " -- this is the same as the next one in my installation EnergyMonth2 has indigo id = 1048490539
set cmd to " \"getvariable;:;:;1048490539\" "
set cmd to " \"EXECCMD;:;:;indigo.server.log('hallo') \" " -- will print "hallo" in the indigo logfile, you could put any command here, use wisely
set cmd to " \"EXECCMD;:;:;indigo.device.turnOn('GameRoomCeilingLights')\" " -- turns on the light in my game room
== the ";:;:;" is used as a delimiter between the commands and variable names etc. it is unlikely that ;:;:; is used in any variable name etc.
== devName and varName and actName can be strings or IDs
== upper and lowercase for commands can be used as you like
how does it work:
the plugin "listens" on 10 channels for commands -- we use files (~/documents/SATI/toIndigo-n) to get the message into the plugin they should contain e.g. : exeAction;:;:;877534
It gets the command, deletes the file, parses it, executes the requested command and writes the result to
~/documents/SATI/toAS-n where n is the channel number and it will contain e.g. ok or 123.5 ... or error missing arg ...
Each channel is independent of each other. If you use this interface in several applescript programs each needs to use its own channel or if you are doing things in parallel also use different channels.
the results are
- value/ result returned from indigo (get variable value)
- "error xxx" in case something went wrong
- "ok" if you e.g. set a variable, as there is no value to return
the example applescript has 2 subroutines:
on toIndigo(channel, cmd) and
on fromIndigo(channel)
they are called from the applescript example to send the command to indigo and get the result back.
instead of applescript file management I just took unix echo, ls, cat etc to write check for files and read files.
if you like you can change that yourself to pure applescript.
next functions could be:
switch device on
switch device off
dim device
and
subscribe to changes of a variable or device/state.
Again, this should be a SIMPLE interface, easy to use, but it will never supply all available functions of indigo.
Karl