Everything is done in DTH. there is no smartapp.
In DTH:
device.deviceNetworkId = settings.mac;
From my experiments I figured out how it works:
- you set device.deviceNetworkId = settings.mac; Now ST knows that your DTH is associated with physical device which MAC address is DEADBEEFFEED for example.
- Device (Arduino) issues a POST http request to hubIP:39500 with some data (I used JSON) (see sendNotify(EthernetClient client) in arduino code)
- ST Hub listens on port 39500 for any incoming http requests.
- ST Hub receives POST requests and determines that it is incoming from some device with MAC address DEADBEEFFEED for ex.
- Because DEADBEEFFEED is associated with our Garage DTH, ST parses and sends that request to parse() method of Garage DTH.
- Do your magic in parse() method.