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”
}