vint83
October 7, 2016, 9:40pm
104
@RBoy , funny thing but I wasn’t able to make it work with IP_HEX:PORT_HEX. In my small project it only works if DNI is set to MAC address without colons. e.g. DEEDBEEFFEED.
I mentioned more here:
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.
@FusionDawg
I was working on the same Garage project a while back and I made it work without virtual switches, IFTTT etc.
You can find my code here:
Works perfectly for me for many months now.
Direct communication ST - Arduino.
Arduino pushes events to ST.
ST can poll/refresh if needed.
Can detect if Arduino is offline - Will show Unknown state in ST.
I also attached temperature sensor to Arduino to know temperature in the garage. You can cut that part out.
Also I didn’t want plain REST APIs to open my garage and was experimenting with SHA256 encrypted password and it turned out pretty good.
Few notes on very important settings:
in Device Handler settings you have to input Arduino IP address, Port as well as MAC address. MAC address must be all uppercase with no columns. e.…
and my project:
2 Likes