Using HubAction "callback" from device - headers encrypted?


(Douglas Mark Lindell) #1

I have a Raspberry Pi LAN device and in my DHT I have the following:

def parse(String description) {
	log.trace "parse($description)"
}

private subscribeAction(path, callbackPath="") {

log.trace "subscribe($path, $callbackPath)"

def hubip = device.hub.getDataValue("localIP")
def hubport = device.hub.getDataValue("localSrvPortTCP")

log.debug("hub: $hubip:$hubport")
	try {
    sendHubCommand(new physicalgraph.device.HubAction(
        method: "GET",
        path: path,
        headers: [ 
            HOST: "$ipaddress:$port", 
            Authorization: "$password",
            CALLBACK: "http://${hubip}:${hubport}/notify$callbackPath"
        ]
    ))
} catch (e) {
  message(e.message)
}

log.trace "SUBSCRIBE $path"

return result
}

But when the callback happens from my Pi, I see the following trace output:

trace parse(index:C0, mac:B827EBFC1FFD, headers:UE9TVCAvbm90aWZ5MSBIVFRQLzEuMQ0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi9qc29uDQpDb250ZW50LUxlbmd0aDogMTENCmhvc3Q6IDE5Mi4xNjguMS4yMTozOTUwMA0KQ29ubmVjdGlvbjogY2xvc2U=, body:eyJzdGF0ZSI6MH0=)

That is the mac address of my Pi device. Is this encrypted? How do I interpret?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Just a wild guess… It might just be base64 encoded?


(Bill Hinkle) #3

yep, you’re right:

Headers:
POST /notify1 HTTP/1.1
Content-Type: application/json
Content-Length: 11
host: 192.168.1.21:39500
Connection: close

Body:
{“state”:0}


(Douglas Mark Lindell) #4

You nailed it. Thanks.

Decodes to:
POST /notify1 HTTP/1.1
Content-Type: application/json
Content-Length: 11
host: 192.168.1.21:39500
Connection: close