Page 1 of 1

exio2x4 analog and applescript

PostPosted: Sat Mar 15, 2008 9:24 am
by anode
Can applescript change the ON/OFF values of the analog inputs?

Re: exio2x4 analog and applescript

PostPosted: Sat Mar 15, 2008 6:58 pm
by matt (support)
anode wrote:
Can applescript change the ON/OFF values of the analog inputs?

All of the EZIO device input states are read-only since they are inputs. The outputs can be changed, which will cause Indigo to send a command to the EZIO to turn the output on or off. But the EZIO doesn't let you set the input values, so Indigo has those AppleScript fields marked as read-only.

You can read the input values out as either binary or analog. Here is a binary example:
Code: Select all
set secondBinaryInput to item 2 of (get binary inputs of device "EZIO8T")

And here is an analog (integer) example:
Code: Select all
set firstAnalogInput to item 1 of (get analog inputs of device "EZIO8T")

Regards,
Matt

Re: exio2x4 analog and applescript

PostPosted: Wed Mar 19, 2008 1:24 pm
by anode
support wrote:
You can read the input values out as either binary or analog. Here is a binary example:

And here is an analog (integer) example:
Code: Select all
set firstAnalogInput to item 1 of (get analog inputs of device "EZIO8T")

Regards,
Matt


I did a copy-n-paste. I'm getting a 'can not get device' error.

I also used "EXIO82X4" (what indigo sees/calls it) "LyncIO" (name I gave it in indigo), and 09.FE.D7, the address

Re: exio2x4 analog and applescript

PostPosted: Wed Mar 19, 2008 1:31 pm
by matt (support)
How are you executing the AppleScript? If it is from the Script Editor application, then you need to add a:
Code: Select all
tell app "IndigoServer"

and:
Code: Select all
end tell

around the set firstAnalogInput ... line.

You should be changing "EZIO8T" to the name of the device you entered in the Device dialog (what you choose to call it). The name must be exactly the same for it to work, and should have quotes around it. If you still get an error, then let me know exactly what the error text is.

Regards,
Matt

PostPosted: Wed Mar 19, 2008 3:55 pm
by anode
Yup brain fart and that worked.

but another prob. Heres my code. I'm running it locally (form script editor until finished) It does not update the variable unless I go to the Home window and 'get IO stats' then it reads the value from there.

Code: Select all
using terms from application "IndigoServer"
   tell application "IndigoServer"
      set firstAnalogInput to item 1 of (get analog inputs of device "LyncIO")
      set (value of variable "LyncTEMP1") to firstAnalogInput
      set firstAnalogInput to item 2 of (get analog inputs of device "LyncIO")
      set (value of variable "LyncTEMP2") to firstAnalogInput
   end tell
   
end using terms from


PostPosted: Wed Mar 19, 2008 3:58 pm
by matt (support)
That is correct. You'll want to create a Time/Date Action that periodically sends the Status Request command to the EZIO. That will then poll out the analog input values, which you will then be able to read via your script below.

Alternatively, you can send the status request command from AppleScript. But you will have to add a few second delay before you try to read the analog inputs, as it takes a few seconds for all the INSTEON commands to poll the input states out of the EZIO.

Regards,
Matt

Re: exio2x4 analog and applescript

PostPosted: Fri Apr 12, 2019 10:41 am
by cjbarker
I recently tried this with Indigo 7,2 on Mojave and I'm getting an error code -10810 on the "analog inputs" attribute. I've tried several different attributes and they all return the same error. Here is the line of code:
set firstAnalogInput to item 2 of (get sensor inputs of device "LightSensor")

Note that "sensor inputs" or whatever I put in that spot shows upon purple in Script Editor, in case that has significance.

Re: exio2x4 analog and applescript

PostPosted: Fri Apr 12, 2019 12:23 pm
by jay (support)
What happens when you do this:

Code: Select all
tell application "IndigoServer"
    get device "LightSensor"
end tell


A quick search seems to indicate that -10810 errors indicate that there's something going on with your Mac - a RAM/memory issue, a process count issue or something not related to Indigo itself. Try rebooting the Mac to see if that clears it up.

Note, AppleScript will be deprecated this year so you might want to take this opportunity to do whatever it is in a Python script instead. Feel free to post your AppleScript in the Help Converting from AppleScript forum for help with that conversion.

Re: exio2x4 analog and applescript

PostPosted: Fri Apr 12, 2019 2:15 pm
by cjbarker
I didn’t realize AppleScript support was on it’s way out until after I posted this. I have started reading up on using Python with Indigo, so I guess this is OBE. Thanks for the reply.