Need help with a send hub command


(Cass) #1

I have a send hub command that send out an IR command to raise and lower my shades and would like to create a button that would send that command. Any ideas? The goal is to add it to my Web Dashboard.

Thanks


(Chrisb) #2

Can you explain a little bit how it’s working right now? Is the IR blaster a device on SmartThings or is if more like a command sent from ST to the IR setup?

My initial thought would be to add a virtual momentary push button tile in ST. Then write a simple mobile app that when that button is pushed, send the command.


(Cass) #3

I am using global cache’s itach to perform the IR blast and ST as the timer. I had to get the IR commands using some globe cache’s utility.

That is ideally what I want is a tile that would perform the certain send hub command and have the ability to add it to a web dashboard.


(Chrisb) #4

Okay, so the “send hub” command… what is that? Is that like a http request?


(Cass) #5

so you define your network and your ir command then use the following

sendHubCommand(new physicalgraph.device.HubAction("""$theCom\r\n""", physicalgraph.device.Protocol.LAN, “0A000114:1386”))


(Chrisb) #6

Okay, that’s the command that would appear in a SmartApp? If so, then I’d just create a virtual momentary push button tile (do this in the IDE -> My Devices -> New Device (upper right hand side)).

Then we just need a simple SmartApp that when it sees this device turn on, it sends the command you listed above:

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) {
	sendHubCommand(new physicalgraph.device.HubAction("""$theCom\r\n""", physicalgraph.device.Protocol.LAN, "0A000114:1386"))
}

(Cass) #7

Thanks for all the help.

I am getting an error in the app itself, I keep getting unexpected error.

I created a new device with switch capability and then created a new smart app with the code you provided.

Not sure what to try.


(Cass) #8

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 = “0A000114:1386"
def theCom = “sendir,1:2,1,38109,1,1,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,18,20,685,6,280,6,185,6,185,6,185,6,185,6,185,6,185,6,185,6,185,6,185,6,280,6,3810\r"
sendHubCommand(new physicalgraph.device.HubAction(””"$theCom\r\n""", physicalgraph.device.Protocol.LAN, “0A000114:1386”))

}


(Cass) #9


(Cass) #10

I figured it out, had the wrong device type.

thanks again