HubAction not sending http traffic when called from child device

I have a LAN device I’ve written that is a composite device. It implements the Switch capability and it creates a child device that also implements the Switch capability.

I have created an IFTTT applet that calls the child device handler’s on() method. This calls into the parent’s childOn() method, which calls another method to create a HubAction. Here’s the HubAction code:

def SendCommand(target, action, interval = “-1”) {
log.debug “Executing $action”
log.debug “/command?target=${target}&operation=${action}&interval=${interval}”
def hubip = device.hub.getDataValue(“localIP”)
def hubport = device.hub.getDataValue(“localSrvPortTCP”)
log.debug “IP Address: ${hubip} - Port: ${hubport}”
log.debug "Host address: " + getHostAddress()

def result = new physicalgraph.device.HubAction(
	method: "GET",
	path: "/command?target=${target}&operation=${action}&interval=${interval}",
	headers: [
    	HOST: getHostAddress()


The Http traffic is created when the On method in the parent device type is called. BUT the http traffic is not created when the child device calls into this method. Does anyone know why this would be the case?


When you call the On method from the child, does the parent’s log contain the first two log.debug strings?

If so, run a test where the On method called directly from parent and copy the log info. Then run the same case when calling the On method from the child. Compare the two logs. They should be essentially the same (within the limits of the system).

If not, then some error may be occuring in the child–>parent comms. You would need to look at (or create) log.debug statements in the child at the calling point and in the parent at the receiving point and assure there is a message in each device’s log.

Other items (some of which seem condescending, but I do not know your knowledge level):

Are you adding the child to the parent device?
Is the child call routine pointing to the parent method properly (i.e., “parent.On”)?

What device(s) are you trying to control? Are you going through an external hub? This is helpful because there is a lot of experience with a lot of devices in this forum and there may be explicit experience in exactly what you are trying to accomplish.

@COREZ , I am running into the same issue, did you ever figure it out?
But child function, calls parent function, parent returns hubAction object, child returns it as well, yet the http request is never issued.

Are you actually calling this method like def result = SendCommand(something, something, darkside) or just SendCommand(…)

in either case I would just force the command to run by using sendHubCommand(hubAction) in the method above instead of returning it to another method that might not be doing anything with it.

That is what I ended up doing. Seems creating it in parent and returning it in a child device does not work (true both for hubAction and for events. Better not to rely on internal mechanisms but sendEvent() and sendHubCommand() explicitly.