Any luck with iTach WF2IR?

I am trying to send IR command through iTach, unfortunately, it is not working.
My iTach is set with a fix IP address on my network (192.168.1.30). When I use the iTest App from Global Cache, I can see the small LED blink on the corresponding iTach IR port. This confirms that my unit is properly working (and IP is good). However, when I try to send the same command using the sendHubCommand, the LED is not blinking on the iTach. You will find below My SmartApp.
In summary, I have to IR commands I want to send (Open and Close for Shade). I bind the Open/Close IR command to a contact sensor. For troubleshooting, I also bind to a switch to make sure that it changes state (it does). Do you see any error in the code below or do you have any suggestion?

definition(
name: “Basic Shade Control”,
namespace: “iker.pryszo”,
author: “Iker Pryszo”,
description: “Basic Test for controlling shade”,
category: “SmartThings Labs”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
section(“When this sensor opens…”) {
input “myContact”, “capability.contactSensor”, title: “Which?”
}
section(“Miror light on…”) {
input “mySwitch”, “capability.switch”, multiple: false
}
}

def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}

def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}

def initialize() {
subscribe(myContact, “contact”, contactHandler)
}

def contactHandler(evt) {
log.trace “The event is: $evt.value: $evt”
//IP of the iTach is 192.168.1.30
def deviceNetworkId = “C0A8011E:1386"
def theCom
if (evt.value == ‘open’) {
log.trace “Contact Open"
theCom = “sendir 1:3,1,37878,1,1,48,16,48,16,16,48,48,16,16,3700\r"
sendHubCommand(new physicalgraph.device.HubAction(”””$theCom\r\n""", physicalgraph.device.Protocol.LAN, “${deviceNetworkId}”))
mySwitch.on()
} else {
if (evt.value == ‘closed’) {
log.trace “Contact Close"
theCom = “sendir 1:3,1,37993,1,1,48,16,48,16,16,48,48,16,16,48,16,48,16,48,48,16,16,48,16,48,16,48,16,1326,48,16,48,16,16,48,48,16,16,3700\r"
sendHubCommand(new physicalgraph.device.HubAction(””"$theCom\r\n""", physicalgraph.device.Protocol.LAN, “${deviceNetworkId}”))
mySwitch.off()
}
}
log.debug “Command should be sent”
}

What IR port is sending the signal to the shade? The first parameter in the sendir command is where you set that. Your code state 1:3 which means it is sending the IR signal from the 3rd port.

Yes, I am sending to the IR Blaster, so port 3 is the correct one.
However, I found the error in my code. I was sending a wrong command. I was missing a “,” in between “sendir” and the first value (a proper command for iTach should be “sendir,1:3,1,[…]”). Stupid me…

After doing this modification, I can now see that the LED on the iTach on top of port 3 is blinking (meaning that the command is being received properly and something is sent on the IR port).
I messed a little bit with the IR sequence codes and was able to open and close the e-rod!

Now, I need to clean up my code and write a new device. I will have to write a “stateless” device, as it is not possible to know (or remember) the current state of the curtain.

Well that’s not completely true. You can use state variables within a smart app, also by adding a real contact sensor or the like at one end of the rod, and incorporating that within the smart app as well to use to keep things in sync.

I have just got the iTach Wifi2IR and am struggling with this a bit!

Am I correct in thinking that we need to build a device type and a smartapp, and that the button presses in the device type trigger the command to be sent from the smart app?

Is that correct?

Anyone fancy donating a working example of both the smartapp and the device type - it would save considerable time!

Many thanks!

I am also interested in this, but for an Itach Flex.

Yes you do need a Smart App and a Device, but the device is setup as a dummy device. So simply create a new device and use the default for momentary button tile.

In order to configure the smart app you need to convert the IP address of the iTach to hex as well as using the iLearn software to capture the IR code.

Change the values in quotes to your IP address converted to HEX.
def deviceNetworkId = “0A00011B:1386”

Capture the IR code using the iLearn software and paste it after the 3rd value. The 1st value 1:2 references the IR port you are using on the device. I am using port 2.

Hope this helps

def theCom = “sendir,1:2,1,37993,1,1,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,684,6,280,6,184,6,184,6,184,6,184,6,184,6,185,6,185,6,185,6,185,6,280,6,3799\r”

// Automatically generated. Make future change here.
definition(
name: “Shade Control Up”,
namespace: “”,
author: “Cass Mieczakowski”,
description: “Shade Up”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
section(“When this switch is turned on, send the command.”) {
input “trigger”, “capability.switch”, title: “Which switch?”, required: true
}
}

def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}

def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}

def initialize() {
subscribe(trigger, “switch.on”, switchOnHandler)
}

def switchOnHandler(evt) {
def deviceNetworkId = “0A00011B:1386"
def theCom = “sendir,1:2,1,37993,1,1,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,684,6,280,6,184,6,184,6,184,6,184,6,184,6,185,6,185,6,185,6,185,6,280,6,3799\r"
sendHubCommand(new physicalgraph.device.HubAction(””"$theCom\r\n""", physicalgraph.device.Protocol.LAN, “0A00011B:1386”))

}

Hi everyone - thanks so much for posting that code @cassmie . I think I’ve done everything I was supposed to do, but my iTach isn’t receiving the commands. Would you mind taking a look at my code in case you can see what I’ve done wrong?

Here’s the SmartApp:

definition(
name: "Turn on heat",
namespace: "",
author: "Jake",
description: "Heat on",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")

preferences {
    section("When this switch is turned on, send the command.") {
    	input "trigger", "capability.switch", title: "Which switch?", required: true
    }
}

def installed() {
    log.debug "Installed with settings: ${settings}"
    initialize()
}

def updated() {
    log.debug "Updated with settings: ${settings}"
    unsubscribe()
    initialize()
}

def initialize() {
	subscribe(trigger, "switch.on", switchOnHandler)
}

def switchOnHandler(evt) {
    def deviceNetworkId = "C0A8000C"
    def theCom = "sendir,1:1,1,38226,1,1,125,62,16,16,16,16,16,47,16,16,16,47,16,16,16,16,16,16,16,47,16,47,16,16,16,16,16,16,16,47,16,47,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,47,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,47,16,16,16,16,16,16,16,16,16,47,16,47,16,47,16,47,16,47,16,47,16,47,16,47,16,16,16,16,16,47,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,47,16,47,16,16,16,16,16,47,16,16,16,16,16,16,16,47,16,47,16,47,16,16,16,47,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,47,16,16,16,47,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,47,16,16,16,16,16,16,16,47,16,16,16,47,16,16,16,47,16,16,16,16,16,3822"
    sendHubCommand(new physicalgraph.device.HubAction("""$theCom\r\n""", physicalgraph.device.Protocol.LAN, deviceNetworkId))
}

And I created a device that’s just a momentary push button as suggested, then installed the SmartApp and set it up with the push button as the trigger. When I push the button in the ST app, nothing is registered by the iTach.

I added:

log.debug "Sent the command."

to the switchOnHandler and sure enough the handler is running when I push the button… it’s just not getting to the iTach. According to the iHelp app, the iTach’s IP address is 192.168.0.12.

Can anyone see what I’ve done wrong, or are there any ideas what to try next? This is the first time I’ve made a SmartApp so please excuse the learning curve!

Jake

edit: I should add that I am able to successfully send the command to the iTach using Global Cache’s iTest app, so I know that the iTach works.

the device network id is the ip in hex, which you have then “:” and the port in hex, which you are missing.

Brilliant, thanks @Mike_Maxwell - doh!

Huge thanks to Cass and Mike_Maxwell - this thread was a lifesaver and allowed me to finally integrate my ESI/Somfy RQ-based shades over RS232 (through an ESI RQ Bridge).

I can confirm that this code allows SmartThings to control RS232 through an iTach IP2SL (or IP2SL-P) as well - just set the TCP port to 4999 instead (1387 hex) and use a command like:

def theCom = “sendir,1:1,!M7Bm00;\r” (where in this case ‘!M7Bm00;’ is the RS232 string)

Cheers!

Dave

thanks for the code, works great… one question: how can i make this work as a trigger … like i have a ‘turn off insteon lights’ app i made that makes the iTach send a turn off IR signal that turns off all my insteon lights… but since we are using momentary tiles you have to push the button to make it work.

how can i make it work with the ‘goodnight’ routine so it runs the app without having to push a tile button? so it triggers the app? would also be useful to know so i can set up proximity sensors for when i come/leave to send a signal to turn the lights on/off. i just need to know how i can trigger it without using the momentary tile. thanks!

Ok, so what is the best way to handle controlling different AV devices in ST? Should I create a SmartApp with the send codes and then have different devices to control each device? Or, should I just create one device to control all my devices?

I am pretty much just looking to turn on devices and maybe switch inputs on receiver.

2 Likes

Mclovin50, I have a similar question. I have a smartapp and device running to turn on my bose system via wf2ir, but I’d like to create a device handler with multiple tiles corresponding to multiple functions (vol up, vol down, tv on, etc…). I would rather not create a bunch of individual devices. I tried moving the below (which works within a smartapp) into a device handler event and through logging I can see it is triggering, but wf2ir is not working.

def volup() {
log.debug “volume up pressed"
def deviceNetworkId = “C0A85614:1386"
def theCom = “sendir,1:1,1,39000,1,1,349,172,21,21,21,65,21,21,21,65,21,65,21,65,21,21,21,65,21,21,21,21,21,21,21,21,21,21,21,65,21,21,21,65,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,21,21,174\r"
sendHubCommand(new physicalgraph.device.HubAction(”””$theCom\r\n""", physicalgraph.device.Protocol.LAN, “C0A85614:1386”))

Any idea what could be going on? Any help from anyone is appreciated.

I have not messed around with my iTach for a long time lol. I’ll try and work on it again soon. Strange how it works as a smart app and not device though.

Did you define the command at the top of the device handler?

I have this setup 1 smartapp with all the itach commands… multiple device handlers which each have a bespoke tile layout with all the controls you’d expect - volime, channel, etc

Thanks guys. @AdamV, I’m trying to do exactly what you did. Would you be willing to share your code for the device handler and smart app?

No problem - but I’m not sure how much it will help you - it’s very bespoke to my set up - and I’d probably have to talk you through it. I’ll put on github and if it helps you then great!

I appreciate it. I have all of the individual IR codes, IP address in HEX, etc… and have built and successfully tested a smartapp that can control one function at a time. I just am having trouble with the structure of the SmartApp and Device Handler to allow the multiple tiles.

Ok so here are the files. A word of warning - the quality of the code both in general and smartthings specifically is very very bad with these. This was one of the first things I ever did with smartthings, before I really understood how to code with it properly, and also before the days of CoRE - so a lot of what I did here could be made significantly better and easier to change - it works… so I’ve never bothered to tidy it up. Also - all the icons that I uploaded to a server to use got taken down - so all the tiles will probably not show their icons - they do for me… because the app cached the old lot! Anyhoo:

TV Device Handler:

TV Automation assigner app:

Projector Device Handler:

Projector Automation assigner:

AV Receiver Device Handler:

AV Receiver Automation Assigner:

Hard Coded Automation assigner:

1 Like