Device Handler Web Request Help


#1

I’ve been working on a generic network device handler that calls to a service hosted by my windows 10 machine. I’ve looked at several examples and still am not seeing any traffic come to my computer. Any suggestions?

Here is my handler: https://github.com/jorel13/LANCaller/blob/master/LANCaller.groovy

I can see my hub action created in the live logging:

cc6c47d2-2774-4d48-b269-4dd2383c6fc3 ‎3‎:‎47‎:‎32‎ ‎PM: debug POST /AnnouncerService/Beep HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 13.13.13.13:8000
Content-Type: application/json

But my computer that is hosting the service never receives it. I’ve checked firewall, urlacl settings, everything. Please Help!


#2

Is your Windows-server on the same subnet as the ST hub? You have to use httpPost() instead of HubAction() if you want to talk out of your subnet.

OK


#3

Both devices are wired into the same subnet.


#4

Did you get anywhere on this? I see by your code that the debug-statement is just printing the hubAction object you created, and not the actual call so at that point nothing has actually happened yet. Do this:

  • Print what you receive from the sendHubCommand() to make sure the syntax is okay (should be some kind of OK)
  • Add a callback to the sendHubCommand() (see sendHubCommand docs) call and in the corresponding callback function print what you get. That is where you will receive the reply from your web server.

OK