jcluo
(Jcluo)
September 14, 2015, 9:01pm
1
Hi, my SmartApp needs to send httpPost to IP address in LAN. It is getting timeout error. While I set port forward in my router to forward an external port and httpPort to the external WAN IP, there is no problem.
My question here is that is the SmartApp execute by cloud server or the hub? How can httpPost to a local LAN IP?
Thanks,
Daniel
sidjohn1
(sidjohn1)
September 14, 2015, 10:01pm
2
jcluo
(Jcluo)
September 15, 2015, 1:10am
3
I follow the GET example but the following code does not work.
def result = new physicalgraph.device.HubAction(
method: "POST",
path: "/rfoutlet/toggle.php",
headers: [HOST: "192.168.2.105"],
body: """Id=${rfid}&Status=ON"""
)
sendHubCommand(result)
Does anyone has working HubAction POST example code?
Thanks
Daniel
rfish8u
(Rob)
September 15, 2015, 2:17pm
4
I use a GET with HubAction. I think I tried POST and it worked but don’t remember for sure.
def on() {
def result = new physicalgraph.device.HubAction(
method: “GET”,
path: “/api/alarm/arm”,
headers: [
HOST: “$ip:$port”
//HOST: getHostAddress()
]
)
log.debug “response” : “Request to arm received”
//log.debug "arm"
sendEvent (name: “switch”, value: “on”)
return result
}
sidjohn1
(sidjohn1)
September 15, 2015, 2:33pm
5
There are several devicetypes that do, use the search icon to look up Roomba or generic ip camera. There are plenty others hiding under search.
jcluo
(Jcluo)
September 17, 2015, 1:58am
6
I still can’t get it work. I am calling hubAction from SmartApp. Does it only work for device type? I haven’t tried write a device type yet.