I have built a two door Garage Door controller using a Raspberry Pi. I can open close/doors using HubAction. It works well except I have to poll the status, what I need is real-time events when the door status changes.
On an event I want to make HTTP requests from the RPi to the Hub. Inbound HTTP Requests are mentioned very very briefly at the bottom here:
This gives me e.g. 192.168.0.101:39500 which does suggest that this port is ready to go. But when the RPi makes the HTTP status request a TCP SYN is sent, there is no ACK (checked with Wireshark) - it’s closed.
Why isn’t open? How do I open it?
Has anybody got HTTP events working? Or ideas? Or is there an example close to this that uses incoming HTTP requests?
UPnP events are sent as HTTP NOTIFY messages with SOAP payload. But I don’t think that the hub does any parsing. If true, then entire response should be base64-encoded and handed to the SmartApp in the location event. So with some luck you should be able to use GET or POST. Keep us posted (pun intended )
Thanks for the help. But in the end I gave up and did it via OAuth instead. It is a rather long winded way to move a message two inches across a shelf, but it’s relatively well documented and didn’t take long to integrate and get working.
Stumbled on this thread while I was banging my head against a brick wall trying to get Inbound HTTP to work! Anyway, I would appreciate it very much if you could post your code for how you got ST to listen to events from RPi. Thanks.
It’s not quite fit for human consumption, but it has been running perfectly since I last visited this thread. The latency from RPi > Smartthings > Hub is < 1 second so perfectly acceptable for this application.
garageController.js line 102 onwards is the OAuth notification.
Note: there are some hardcoded modifications in upnp-ssdp.