iTach IP2IR Driver Code Sample

I was able to create a driver for controlling my iTach IP2IR device. I use this to turn on/off televisions. For now I create a separate driver for each channel (1 - 3) of the device. It's not elegant but it works.

/**
 *  iTach IP2IR Control Device Type for Hubitat
 *  Carson Dallum (@cdallum)
 *  Originally based on: Mike Maxwell's and Allan Klein's code
 *
 *  Usage:
 *  1. Add this code as a device driver in the Hubitat Drivers Code section
 *  2. Create a device using iTach_IP2IR as the device handler
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */

metadata {
	definition (name: "iTach IP2IR (Family Room)", namespace: "cdallum", author: "Carson Dallum") {
	capability "Initialize"
    capability "Telnet"
    capability "Switch"
	}
}

// device commands
def on() {
	log.debug "Powering On Family Room Television"
	sendEvent(name: "switch", value: "on")
	def msg = "sendir,1:2,1,38000,1,1,172,172,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,64,22,64,22,21,22,21,22,64,22,21,22,64,22,64,22,21,22,21,22,64,22,64,22,21,22,1820"
	return new hubitat.device.HubAction("""$msg\r\n""",hubitat.device.Protocol.TELNET)
}

def off() {
	log.debug "Powering Off Family Room Television"
	sendEvent(name: "switch", value: "off")
	def msg = "sendir,1:2,1,38000,1,1,173,173,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,21,21,65,21,65,21,65,21,65,21,21,21,21,21,65,21,65,21,21,21,1832"
	return new hubitat.device.HubAction("""$msg\r\n""",hubitat.device.Protocol.TELNET)
}
    
// General App Events
def initialize(){
	telnetConnect("192.168.1.xxx", 4998, null, null)
	log.debug "Opening telnet connection"
}

def installed(){
	initialize()
}

def updated(){
	initialize()
}

@cdallum can I ask how you ‘learn’ your IR codes ?
I have a Yamaha CRX-N560 Receiver which I’d like to be able to control and I’m weighing up use big IR or LAN Control.
LAN Control would be more precise and is probably top of my choice list at this tome but it’ll likely be harder.

I'll second this one. I have an old ethernet itach device that I haven't used for years because I got tired of clunky phone apps (and went to Harmony). Would be great to find a way to integrate this some day.

And for something like this, doesn't need to be elegant! Just need to figure out how to find or learn IR codes.

I used iTach devices a lot when I was using HomeSeer. Very dependable devices. Looking forward to this code evolving to be able to use other buttons then just on and off. Need the Dashboard updated so we can choose other commands within the driver. ie. Volume, Input, Channels. In HomeSeer there are a couple great apps to store the codes and use them in their events engine.

Global Cache has a huge database of IR codes available.
https://irdb.globalcache.com/

and if you can't find a code. They make this little device to teach the system your remote codes. Works very well too.

3 Likes

Random thinking here...

Was thinking something like @stephack's new Virtual Container Driver. Would it be possible to use a customized version to make virtual devices that stores the codes for each device? Was thinking it would be best to use buttons rather than switches. That way they can be used in the Dashboard. Kinda like Pico buttons. Maybe have each device have 10 buttons, if possible? I guess we would also have to have a new SendIR command in the custom app (and RM?).

Living Room Stereo

  • On
  • Off
  • Vol Up
  • Vol Dn
  • Input

Living Room Cable Box

  • On
  • Off
  • Favorite Channel - NESN
  • Favorite Channel - ABC

Things like that.

Wow, this is WAY out of my league! lol But hopefully it inspires someone... @mike.maxwell, @bravenel :grin::grin::grin::grin::grin:

I've used both iTach (with Homeseer) and Harmony (with ST and now with HE) and can honestly say iTach (Global Caché) blows Harmony out of the water when done right. And....it would be 100% local!

EDIT: 10/14/18 - New app is coming along nicely! I should have something out soon...

1 Like

The Global Cache control tower @bptworld mentioned is what I used for my IR codes.

App and Driver now available!

Introducing 'Send IP2IR'

I want to do this IR control from Dashboard. Works only with Global Cache device, and is wired version the cheapest one? I have a Switchbot Hub IR Plus, assume that won't work here.

Download the Hubitat app