Thanks so much for this thread, especially @adam1010 for the sample SmartApp and Device Handler code that you posted here. This was very helpful to me in my project to connect a few wired contact sensors & a motion sensor to SmartThings via a NodeMCU ESP8266 board. I basically copied your SmartApp code
Works like a charm. Here are some details of my project if anyone is interested:
The OAuth part was a little tricky. I used the Advanced REST Client chrome app to manually make the HTTP Post to obtain the OAuth token. As @adam1010 suggested, once you have the OAuth token, you can just code that into your RaspPi or NodeMCU to sign every request with it.