Device Handler not receiving HubAction to parse()

I do not know that setting deviceID to ‘:’ is a good idea. This will work for one device, but violates the unique ID requirement for many. Also, current paradigm is NOT to use IP:Port as the DNI as this can change and if it does, it is difficult to rediscover the device.

I use the callback definition (versus parse), then parse in the callback. example, where “command” is a command string, and I use the headers to pass command data. This also works if you have a body to pass. The below are EDITS on running code.

Using headers:

private sendCmdtoServer(command, action){
def headers = [:]
headers.put(“HOST”, “$IP:$PORT”)
headers.put(“tplink-command”, command)
sendHubCommand(new physicalgraph.device.HubAction([
headers: headers],
device.deviceNetworkId,
[callback:cmdResponse]
))
}

def cmdResponse(response){
cmdResponse = response.headers[“cmd-response”]
PARSE FUNCTIONS.
}

Using BODY where command is the sent body and response is the received body.

private sendCmdtoServer(encrCmd, cmdResponse){
sendHubCommand(
new physicalgraph.device.HubAction([
body: encrCmd,
headers: [
HOST: “$IP:$PORT”,
]],
device.deviceNetworkId,
[callback: cmdResponse]
)
)
}

def cmdResponse(response){
def cmdResponse = parseJson(response.body)
PARSE DATA

}

hope this what you were looking for. The full code for the first example is for a TP-Link bulb, plug, or switch controlled through a PC bridge.