Global Cache Plugin

Posted on
Mon Oct 10, 2011 3:00 pm
ChrisB offline
User avatar
Posts: 41
Joined: Sep 12, 2011

Global Cache Plugin

Note: This plugin has been open sourced and is now available on GitHub - look for the latest version there. There's a supported plugin for the Global Cache devices available elsewhere that is probably a better bet for most users.

About the Global Cache Plugin
This plugin interfaces Indigo 5 to a Global Cache GC-100 unit. It lets Indigo send IR commands to your audio/video equipment (or any other IR equipment) over a network. In addition, Indigo can set the states of relays on the relay module (available on GC-100-12/18/18R).

Required hardware/software
To use the Global Cache Plugin you'll need a Global Cache GC-100 connected to and configured for your network. You can purchase Global Cache Home Network Adapters from Amazon. You will need to purchase some IR emitters to connect to each device. Amazon has an inexpensive set of 4 Linear 2171-4’s that work great with the GC-100. Of course, you will also need the latest copy of Indigo 5.

Additional resources recommended
The Global Cache Plugin does not learn remote codes from existing remotes. In order to find and use the correct codes, you have a few options.

1. I like going to Remote Central and downloading a CCF for my equipment. From there I would use a program called CCF Export to retrieve the HEX code values. Once you have the HEX codes for the function you want, paste it into iConvert and you will have the code required to communicate through the Global Cache Plugin to your GC-100.

2. The second method would be to purchase a GC-IRL from Amazon and connect it to one of the RS232 ports on the GC-100 unit. The GC-IRL can also be connected to the Mac using an RS232 to USB adapter (according to the GC support website, the Keyspan is NOT supported. A tutorial on how to do it can be found here. You will also need to download a program called iLearn to capture the codes from the GC-IRL.

Future Functionality
- Add support for iTach units (WF2IR, IP2IR(-P), WF2CC and IP2CC(-P))
- Ability to configure and use more than one GC-100 and/or iTACH device
- Add support for IR learning through WF2IR and IP2IR(-P)
- Add serial(RS232) support for GC-100, WF2SL, and IP2SL(-P)
- Add support for on-board IR outputs as sensor inputs for GC-100, WF2IR and IP2IR(-IP). This will allow you to use the GC-SV1, GC-SP1 and GC-SC1.

Installation
1. Download the plugin from here
2. Unzip it and copy the GlobalCache.IndigoPlugin file to your /Library/Application Support/Perceptive Automation/Indigo 5/Plugins (Disabled)/ folder.
3. Restart the Indigo server.
4. Pull down the Plugins menu, select Global Cache, then Enable.
5. The plugin's config screen should pop up. Click Save to close the window.

Plugin config screen.png
Plugin config screen.png (39.49 KiB) Viewed 20280 times


6. To get started, create a Global Cache device. Enter the IP address and port number for your device. The default port number is 4998. If you have not configured your GC-100, you can use iHelp to locate the IP address of your unit.

Configure GC device.png
Configure GC device.png (78.77 KiB) Viewed 20280 times


7. You will need to create one GC IR Module device for each IR port you will use. Select the Global Cache Device you created above, followed by the module address and port number. If you are not sure what those are, look at the states for the Global Cache Device you created above. There you will find what the address is for each IR module (the first number).

The second number defines the number of IR ports in that module (each IR module has three ports). If you have a GC-100-06, you only have one IR module and it is located at address 2. All other GC-100’s come with two IR modules located at addresses 4 and 5.

Configure IR Module.png
Configure IR Module.png (85.38 KiB) Viewed 20280 times


8. If you plan to use the relay module, you will need to create one GC Relay Module device for each relay in the module. The GC-100-06 does not house a relay module and all other GC-100’s have one relay module located at address 3. The relay module has three relays that you can turn on/off. Select the Global Cache Device you created above, followed by the module address and relay number.

Configure Relay Module.png
Configure Relay Module.png (85.61 KiB) Viewed 20280 times



9. You can create triggers for the GC-100 device to track Connection State changes (Connected, Disconnected and Socket Error). You can create triggers on the IR module to track Connection State changes (Idle, Transmit, Receive). If you want, you can also fire off triggers for the Last IR Acknowledgement. Triggers can also be created for the Relay Module to track state changes (Changed, On, Off) and Last Relay Acknowledgement.

10. Creating actions is where everything happens. I would recommend creating the first action for an IR device and then duplicate it for each additional IR action (for the same device) you create. Make sure you select Plugin, Global Cache, Send IR Commands and then the device you created in step 7. Click Edit Action Settings to configure what to send to the GC-100 device.

a) The ID number is a unique number from 1 - infinity. This is used to get unique ID in the Last IR Acknowledgement state for the device. If you do not have a specific use for it, leave it at 1.

b) Whether you used step 1 or 2 in the Additional Resources recommend, you end up with a code that looks similar to this:

Code: Select all
sendir,4:2,1,38000,1,1,230,46,46,46,23,23,23,23,46,23,46,23,23,23,23,23,23,23,23,1157,
115,46,46,46,23,23,23,23,46,23,46,23,23,23,23,23,23,23,23,1157,115,46,46,46,23,23,23,23,46,
23,46,23,23,23,23,23,23,23,23,1157,115,46,46,46,23,23,23,23,46,23,46,23,23,23,23,23,23,23,
23,1157,115,46,46,46,23,23,23,23,46,23,46,23,23,23,23,23,23,23,23,1157,115,46,46,46,23,23,
23,23,46,23,46,23,23,23,23,23,23,23,23,46


Of course, your numbers and the amount of numbers will be different for each IR command. This particular one tell the DirecTV receiver to display the guide.

The sendir,4:2 is handled by the Global Cache Plugin. We are concerned with the numbers that follow those. The first number is the ID (1) we spoke about in a. above. c, e, and f below are given to you by iConvert or iLearn so you really don’t need to spend too much time trying to figure out how they work. Just know where to get those numbers from and where to put them in. If you would like to read more about the numbers, download the the 1.0 API from here or the 1.0d API from here.

c) The second number is the frequency (38000). Valid numbers are 20000 to 250000.

d) The next number is the Count (1). This tells the GC-100 how many times to repeat the IR command. Valid numbers are 0 to 31.

e) Following the Count, we have the Offset. If the count is greater than one, this is used to avoid repating the preamble during repeated IR timing patterns. Valid numbers are 1 to 511.

f) Everything after the Offset (excluding the comma) contains the actual IR string that sends the command to your device. Copy and paste it exactly as it appears:

Code: Select all
230,46,46,46,23,23,23,23,46,23,46,23,23,23,23,23,23,23,23,1157,115,46,46,46,23,23,23,
23,46,23,46,23,23,23,23,23,23,23,23,1157,115,46,46,46,23,23,23,23,46,23,46,23,23,23,23,23,
23,23,23,1157,115,46,46,46,23,23,23,23,46,23,46,23,23,23,23,23,23,23,23,1157,115,46,46,46,
23,23,23,23,46,23,46,23,23,23,23,23,23,23,23,1157,115,46,46,46,23,23,23,23,46,23,46,23,23,
23,23,23,23,23,23,46


Don’t worry if you can’t see all the numbers when you paste it -- I’ve tried it with many different lengths and it works like a charm.

Click save and test it out.

Action GCIR - DirecTV - Guide.png
Action GCIR - DirecTV - Guide.png (96.81 KiB) Viewed 20280 times


I created one Action Group for each IR command. See below:

IR Action Group List.png
IR Action Group List.png (130.18 KiB) Viewed 20170 times


11. The next step is to create your remote control pages. I took it a step further and created additional Action Groups that combined multiple IR action groups from above. For instance, when you hit the SAT button on the iPhone control page that I created below:

iPhone control page setup.png
iPhone control page setup.png (248.78 KiB) Viewed 20280 times


It will execute the IR Actions - Direct TV group and then change the control page to the long version of the DirecTV remote:

DirecTV Remote.png
DirecTV Remote.png (132.64 KiB) Viewed 20280 times


In order to accomplish this, I created the following Variables:

Variables.png
Variables.png (23.86 KiB) Viewed 20170 times


I wanted to make sure Indigo did not send a power on when the TV was already on and it wasn’t very productive to change the Source (mode) if it was already on the correct source -- so I decided to track the power/source states. Of course, if someone does not use Indigo to power the equipment on/off or change the sources, this becomes useless.
Last edited by ChrisB on Fri Oct 14, 2011 12:38 pm, edited 5 times in total.

Posted on
Mon Oct 10, 2011 5:44 pm
ChrisB offline
User avatar
Posts: 41
Joined: Sep 12, 2011

Global Cache Plugin for Indigo 5 available here

The next step is to create the Action Group. The code checks the variables to make sure Indigo is not sending IR commands to turn on the equipment if it's already tuned on. Also, I have added 3 second delays to give the TV and A/V Receiver time to power on before sending the source IR commands. Make sure you use the variableID's and actionID's and not the names in case you change the names in the future.

Switch to Direct TV.png
Switch to Direct TV.png (170.26 KiB) Viewed 20179 times


In order for this to work, you will need to change the proper variables when each IR action is executed. For example, when you turn the DirecTV power on, you will need to modify the variable, in this example IR_DirecTV, so add a second action to the Power On action group. Likeweise, when you turn it off it will need to modify the variable again. Do the same for all the power on/off states and the video sources.

Change variable power on.png
Change variable power on.png (57.31 KiB) Viewed 20179 times

Change variable power off.png
Change variable power off.png (57.67 KiB) Viewed 20179 times

Change variable source.png
Change variable source.png (60.16 KiB) Viewed 20179 times


If you decide to use relays, create actions for the relays ( GC-100-12 or above):

Action Relay 1.png
Action Relay 1.png (85.29 KiB) Viewed 20289 times


Additional notes:
When you add a new relay, the plugin will set the state to off and sync the relay on the GC-100. Also, when the plugin restarts, it will make sure Indigo and the GC-100 are in sync. The plugin does this by reading the state of the device in Indigo and setting the state of the relay in the GC-100 to the same.

A little background
I purchased Indigo on 9/11/11 and received my first Insteon products soon after. 95% of our home currently has Insteon devices installed. Our lights, our fans, our lamps, our garage doors, our DSC alarm and our thermostat are all connected to Indigo. If we had sprinklers, those would be connected too! In addition, we make everyday use of great plugins that Indigo and others have created (DSC Alarm, NOAA Weather, Find my iDevices, Airfoil, iTunes and Smartphone Radar).

The only thing we were missing was control of our audio/video equipment through Indigo. I happened to have a GC-100-12 that I picked up 6 years ago. Unfortunately, no one had a working plugins so I took on the challenge and now my wife and I enjoy controlling our A/V equipment from Indigo! Thanks for all the great support Matt and Jay!

If you find any bugs, please feel free to let me know. Also if you have any feature requests or suggestions on how to complete the Future Functionality items above, let me know.

~Chris

Change History

Version 1.0 (October 10, 2011):
Initial Public release of the Global Cache Plugin
Last edited by ChrisB on Fri Oct 14, 2011 12:37 pm, edited 3 times in total.

Posted on
Wed Oct 12, 2011 7:34 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Global Cache Plugin for Indigo 5 available here

Chris,

This is terrific -- thanks for sharing the plugin with everyone, and thanks for the step-by-step instructions.

You should modify your embedded scripts to use Python instead of AppleScript. :-)
Examples would be:

Code: Select all
if indigo.variables[1234].value == "false":
     indigo.actionGroup.execute(6789)

if indigo.variables[3333].value != "DirecTV":
     indigo.actionGroup.execute(4444)

Where the number 1234 and 6789 are the object numbers for the variable and action group. You can copy the numbers directly to the clipboard by right (ctrl)-clicking on the group/variable in the UI and choosing Copy ID. The IDs never change even if you rename the variables or action groups, so the scripts won't ever break.

Image

Posted on
Wed Oct 12, 2011 9:36 am
Korey offline
User avatar
Posts: 811
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Global Cache Plugin for Indigo 5 available here

This is Fantastic, I have been waiting for a plugin like this!

I wonder if this will work with the iTach family of products? They are supposed to be compatible with the GC100 series. Anyone have a iTach device that could try and report back?

Thanks Chris!

--
Korey

Posted on
Wed Oct 12, 2011 10:09 am
ChrisB offline
User avatar
Posts: 41
Joined: Sep 12, 2011

Re: Global Cache Plugin for Indigo 5 available here

Matt: Thanks! I was thinking about that while I was posting the pictures but I wasn't sure if everyone used python so I decided to go the Applescript way. I'll update the text to include both methods.

Korey: I was looking over the API for the ITach line and it seems to be similar to the GC-100. If someone has access to one and they know how to send a getdevices command to it, send me the output and I can add the functionality. Having one in my hands would be much better though! :-)

Posted on
Wed Oct 12, 2011 10:48 am
ChrisB offline
User avatar
Posts: 41
Joined: Sep 12, 2011

Re: Global Cache Plugin for Indigo 5 available here

Korey,

I just got off the phone with Global Cache and it looks like they might send me a WF2IR so I can extend the plugin to support the ITach family of products. I'll keep you updated - should know something in a few days.

Chris

Posted on
Wed Oct 12, 2011 10:59 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Global Cache Plugin for Indigo 5 available here

ChrisB wrote:
Matt: Thanks! I was thinking about that while I was posting the pictures but I wasn't sure if everyone used python so I decided to go the Applescript way. I'll update the text to include both methods.

I'd recommend just including Python example -- that is what we recommend for scripting Indigo Server now. Ultimately, it is going to be more robust and easier for us to extend than AppleScript. We are by no means dropping AppleScript support, but we won't be adding any new APIs to it either (minus a few possible exceptions, of course).

Image

Posted on
Wed Oct 12, 2011 11:04 am
Korey offline
User avatar
Posts: 811
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Global Cache Plugin for Indigo 5 available here

That's great news! Sounds like they are good guys!

--
Korey

Posted on
Wed Oct 12, 2011 11:05 am
ChrisB offline
User avatar
Posts: 41
Joined: Sep 12, 2011

Re: Global Cache Plugin for Indigo 5 available here

I'd recommend just including Python example -- that is what we recommend for scripting Indigo Server now. Ultimately, it is going to be more robust and easier for us to extend than AppleScript. We are by no means dropping AppleScript support, but we won't be adding any new APIs to it either (minus a few possible exceptions, of course).


Done.
Last edited by ChrisB on Fri Oct 14, 2011 1:55 pm, edited 1 time in total.

Posted on
Fri Oct 14, 2011 12:12 pm
ChrisB offline
User avatar
Posts: 41
Joined: Sep 12, 2011

Re: Global Cache Plugin for Indigo 5 available here

Korey wrote:
That's great news! Sounds like they are good guys!


They are shipping the iTach unit to me on Wednesday so as soon as I receive it, I'll start working on adding support. Do you currently have one? If so, which model and would you like to Beta test the next version?

Thanks,
Chris

Posted on
Fri Oct 14, 2011 8:54 pm
Korey offline
User avatar
Posts: 811
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Global Cache Plugin for Indigo 5 available here

ChrisB wrote:
Korey wrote:
That's great news! Sounds like they are good guys!


They are shipping the iTach unit to me on Wednesday so as soon as I receive it, I'll start working on adding support. Do you currently have one? If so, which model and would you like to Beta test the next version?

Thanks,
Chris



I have just ordered the WF2IR, I am also looking at getting a IP2SL, unless someone makes a serial plugin that can communicate via RS232 to my Pre Amp & TV from a Keyspan USB to serial converter. ;)

--
Korey

Posted on
Sat Oct 15, 2011 12:59 am
macpro offline
User avatar
Posts: 765
Joined: Dec 29, 2005
Location: Third byte on the right

Re: Global Cache Plugin for Indigo 5 available here

This is cool. Well done.
I'm using a GC-100 module to let my TV control Indigo (Yes, the other way arround!) but it's just a giant Python script.
Not a nice plugin like you made.

Posted on
Sat Oct 15, 2011 10:23 am
ChrisB offline
User avatar
Posts: 41
Joined: Sep 12, 2011

Re: Global Cache Plugin for Indigo 5 available here

Korey wrote:

I have just ordered the WF2IR, I am also looking at getting a IP2SL, unless someone makes a serial plugin that can communicate via RS232 to my Pre Amp & TV from a Keyspan USB to serial converter. ;)


Perfect, that is the exact unit I will be receiving. I haven't decided how to implement the RS232 code. I would expect it to be a little tricky considering every device that you connect to an RS232 would have unique commands. It would be great if there was a way to somehow make the serial ports available to the MAC --- that way they are available to Indigo and unique plugins can be made for individual a/v equipment.

When I update the plugin, if you would like to beta it, PM your e-mail address and I will send it when it is ready.

Chris

Posted on
Sat Oct 15, 2011 10:27 am
ChrisB offline
User avatar
Posts: 41
Joined: Sep 12, 2011

Re: Global Cache Plugin for Indigo 5 available here

macpro wrote:
This is cool. Well done.
I'm using a GC-100 module to let my TV control Indigo (Yes, the other way arround!) but it's just a giant Python script.
Not a nice plugin like you made.


Thanks! I saw what you did with the GC-100 in another post -- that was very creative! If you are willing to share the script, I'd love to take a look at it. Let me know and I'll PM you my e-mail address.

Take care,
Chris

Posted on
Sat Oct 15, 2011 10:30 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Global Cache Plugin for Indigo 5 available here

ChrisB wrote:
I haven't decided how to implement the RS232 code. I would expect it to be a little tricky considering every device that you connect to an RS232 would have unique commands. It would be great if there was a way to somehow make the serial ports available to the MAC --- that way they are available to Indigo and unique plugins can be made for individual a/v equipment.


At this point (no promises, of course), the plan is for the next beta to have a mechanism by which serial based plugins can connect to both local serial ports (like now) and remote TCP serial servers, including the GC-100. Note this does NOT include Indigo Server's native support of the PowerLinc, CM11s, etc., since those are not plugins.

Image

Who is online

Users browsing this forum: No registered users and 1 guest