Jump to content

How do I pull a variable from ISY in simple terms?


ahwman

Recommended Posts

Hello,

 

Here's what I'm trying to accomplish:

 

Right now, I'm using MobiLinc with a geofence on my iPhone to execute a variety of programs on my ISY when I exit/return from my home. That said, I'd like to extend this functionality to my iMac/PC by looking for a change in variable state on my ISY whereby a program(s) is executed on my iMac/PC.

 

Is there a relatively simple way to accomplish this :?:

 

Thank you!

Link to comment
Use the REST API to poll the variable. http://wiki.universal-devices.com/index ... _Interface

 

Based on this documentation, it appears that this is the command I need to use to pull the variable? /rest/vars/get//

Retrieves a variable given by var-id

 

If so, how do I direct that towards my ISY – in other words the IP and login information what does that look like?

 

Could you give me an example of what the entire string looks like?

 

Thanks again...

Link to comment

Ultimately it will depend on what application or language you will program in.

 

Here is a example Linux bash script which uses WGET to interface with the REST API. You should be able to modify for variables.

https://gist.github.com/4052516

 

Also if you have the network ISY add on module, technically you should be able to program the ISY to execute or launch a remote program on your Mac from the ISY which would eliminate the necessity of polling the ISY

Link to comment
Ultimately it will depend on what application or language you will program in.

 

Here is a example Linux bash script which uses WGET to interface with the REST API. You should be able to modify for variables.

https://gist.github.com/4052516

 

Also if you have the network ISY add on module, technically you should be able to program the ISY to execute or launch a remote program on your Mac from the ISY which would eliminate the necessity of polling the ISY

 

I do have the network ISY add on module and would love to be able to directly integrate launching a program on my Mac based on a variable state change. Any idea how to accomplish this as it would be much more efficient than the other method?

 

Thanks so much for your time and expertise.

Link to comment

There are methods to remotely launch applications and applescripts from another Mac using Remote Apple Events protocol, but not using simple HTTP commands which the ISY network interfaces module would support.

 

Although I have not used it personally yet, I did find this application which would allow remote control using standard HTTP commands for both Mac OS X and Windows.

 

http://www.maccentric.com/dl_saywhat.php

 

Let me know if this is what you are looking for and have any luck with it.

Link to comment
There are methods to remotely launch applications and applescripts from another Mac using Remote Apple Events protocol, but not using simple HTTP commands which the ISY network interfaces module would support.

 

Although I have not used it personally yet, I did find this application which would allow remote control using standard HTTP commands for both Mac OS X and Windows.

 

http://www.maccentric.com/dl_saywhat.php

 

Let me know if this is what you are looking for and have any luck with it.

 

This is exactly what I was looking for! It works like a charm. Thank you so much!!

Link to comment
  • 9 months later...

Sorry to dig out an old thread...but I've been trying to set my Nest to AWAY mode based on a radius from the house (geofence), today I decided to just get it figured out!!  

 

So from the linux/mac command line you want to pull a variable from the ISY??

 

1 - log into the isy and figure out if the variable is a state or integer, also note the number of the variable.  In this example, I'm using my state variable #4.

2 - from your browser use http://192.168.1.30/rest/vars/get/2/4/ (insertyour isy's IP, leave the path alone, 1=integer 2=state, replace my 4 with the variable number)  keep playing with this until you get a xml formatted response that looks like this:

<var type="2" id="4">
<init>2</init>
<val>1</val>
<ts>20150305 18:24:12</ts>
</var>

3 - the "val" tag is all you want, so from command line, just run this (change the IP, 2, and 4 to match the URL you found in step 2):

echo `wget -qO- test.xml --user=YOURUSERNAME --password=YOURPASSWORD http://192.168.1.xx/rest/vars/get/2/4/`| cut -d'>' -f6 | cut -d'<' -f1

 

(the wget is the command line pull for a web request, normally it would save it to a file but the -qO- makes it quiet and echo it out, but then the two cut command trim the xml so that you just end up with your desired variable)

 

Why would you want to use:  from the command line, you can just drop the line any time and get the value of that variable.  For me, I am using the mobilinc app to set the variable based on me being a mile from my home - my results are a 0 (away) or 1 (home or close to home).  So then I am going to use the rest of my script to set the status of my NEST thermostat to Home or Away (save $$).  I can also shut off all the lights in the house (save $$), I can get a text that the garage is open (save my grill!!)... imagination is the limit here.

 

Thanks to elvisimprsntr for the interrogation script (https://gist.github.com/elvisimprsntr/4052516) that sped up the digging.

PS - big fan of elvisimprsntr, loved loved loved the work on the RaspPi SiriProxy - so wish we had it back.  Fingers crossed that the API for the Amazon Echo is worth the wait!!  I saw your work on the Homekit stuff, I'll look into it to see the state of /art/.  :wink:

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...