httpPost to LAN ip

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

Sounds like you’re using the wrong command. Httppost is for wan/cloud devices. Hubaction is for lan.

http://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-lan-connected-device-types/index.html

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

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
}

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.

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.