Author Topic: Here are some Tips for iTach, IR and UI7  (Read 241 times)

Offline rostmo

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Here are some Tips for iTach, IR and UI7
« on: March 01, 2017, 01:34:03 pm »
After trying for a long time to add a device to control an IR command, it suddenly dawned on me that that I actually don't want devices at such tasks. I don't want to have a device where I can lower the screen etc. Because Vera is not an extra remote, it's a "scene tool". The screen should be lowered based solely on a scene. Watching Netflix is a scene where many things happen, not a collection of devices. So here are my tips.

Tip 1.
Don't use devices for IR commands. Instead:
  • You don't need the Global Cache GC100 app for this. Actually, no app is needed on Vera for this to work.
  • Create a text file called "ircommand.lua" (see attachement), and saved it under "/usr/lib/lua".
    NOTICE: You MUST configure this file based on your needs and settings. See below.
  • Execute the command "luup.reload()".  From "Apps | Develop apps | Test luup code (LUA)"
Now you can send IR commands to the AV system using LUA in scenes. There are no need for any Vera devices. I put the LUA code into a scene like this example:

require "ircommand"
ircommand.benqon()
ircommand.screendown()
ircommand.stream()


This will lower the Screen, turn on the projector and turn on the AVR and activate the HDMI where Chromecast is connected. (Yes, I now use this method instead of an app for the AVR.)
I also have other devices configured normally in the same scene like turning off the lights etc.

About step 2:
You will need to adjust the IP address in the file. Only IP though, the port is correct. Look for this line:

c = assert(socket.connect("192.168.1.97", 4998))

The need for IR commands to end with ",\r" is handled in the code. Do not apply this at the end of your IR codes.
Add your IR codes based on your need and name the functions thereafter. The module name and the function name builds the command you will use in your scene.
The file I attached have some comments which might assist.

Tip 2.
When using iLearn to fetch IRs from the remote, set the Format to "GC Compressed" when learning. This will solve the problems reading long IR commands. E.g. I was not able to fetch any working code from my Onkyo AVR remote before using the compressed format. After iTach has read it, set the Format back to "Global Cache" before you press Edit. Then it will be copied correctly into the "Edit view" field, and is now ready to be copied to the file mentioned in Tip 1.

Tip 3.
Try the commands in "Apps | Develop apps | Test luup code (LUA)" before applying them to scenes. Remember to start with: require "ircommand".

If anyone see any issue in the LUA file, or suggestions to do it better please give feedback.

Hope this can be of help. (It would have been for me when first starting on the "iTach, IR and UI7" path  ;) )

Thanks to wilme2 for the code I reused here. See http://forum.micasaverde.com/index.php/topic,32420.msg299775.html#msg299775

Other resources used was:
https://www.globalcache.com/files/docs/API-iTach.pdf
http://lua-users.org/wiki/ModulesTutorial
« Last Edit: March 01, 2017, 02:23:25 pm by rostmo »

Offline Thomas1975

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Here are some Tips for iTach, IR and UI7
« Reply #1 on: March 12, 2017, 04:47:55 pm »
Worked really well and an elegant simple approach to Ir control with the iTach. Had spent 6 hours trying to add my devices and given up  :'(....thank you for sharing