The SmartApp does the authentication and retrieves tokens that it then passes down to the nodejs app - the nodejs app never gets the credentials (username and password) for security purposes - it only gets a token from the SmartApp that needs to be refreshed once in a while - it expires. The SmartApp is also responsible for managing the devices, creating new ones, and updating existing ones when events happen.
What it looks like to me is that the nodejs app is sending the even but it never reaches hubitat. I do see something received in the hubitat logs but I am pretty sure they aren't from the nodejs app because they occure even when I shut down nodejs.
The nodejs app works fine pointing at smartThings, and from what I can tell has nothing smartThings specific in it.
Here is an example of what is being received:
parsedEvent = [mac:001788227989, networkAddress:0A000102, deviceAddress:50, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788227989, ssdpTerm:urn:schemas-upnp-org:device:basic:1, ssdpNTS:null]
Later today I'll get this set up on smartThings again and capture a parsedEvent for comparison.
From SmartThings:
Received discovery event for module digitallife, device Rosiak Control Panel of type digital-life-controller, value null, data: [data-rules-set:application/json, data-dlc-control:0, data-dlc-status-bitmask:0, data-operation-mode:0, type:digital-life-controller, data-appliance-ip2:null, id:0, data-proxy-port:49156, data-timezone:CST6CDT, event:discovery, data-subscription-features:DLBASCPKG, name:Rosiak Control Panel, data-connectivity:3, data-livevideoonalarmtoken:Loukse7HBbXt44rguC1v74PEHavsB8Vr, data-header-ip:98.144.102.103, data-test-request:null, data-discovery-status:null, data-discovery:0, module:digitallife, data-dl-flags:23, data-policycaps:G=16,K=16,SP=1,T=1,IIWC=1,HP=2,N=1,RD=1,ER=4,AM=2,TMH=1,DTM=1,AQS=1,VE=1,SC=1,EVT=1,PE=1,REST=1,EndExitDelay=1, data-battery:100, data-change-rules-set-row:application/json, data-inbound-port:32000, data-livevideoonalarmpolicy:never, data-schedule:application/json, data-locale:en_US, data-location:0003013034, data-schedule-change:null, data-token:XW7pmWZAIWLIL4G5fqQKl7fXruIsVAJ4, data-power-source:AC, data-test-mode-expiry:,auto-dla, data-tampered-device-list:null, data-policyrules:10, data-proxy-ip:a-nps1-da.dlife.att.com, data-appliance-ip:10.0.1.44, data-status:0]
From Hubitat:
Nothing....
Here is the output from nodejs:
Aug 05 11:55:28 raspberrypi systemd[1]: Started Node.js Local Home Cloud Hub Server.
Aug 05 11:55:31 raspberrypi node[10517]: 8/5/2018, 11:55:31 AM [homecloudhub] Home Cloud Hub app v0.1
Aug 05 11:55:31 raspberrypi node[10517]: 8/5/2018, 11:55:31 AM [homecloudhub] ====================================================================================================
Aug 05 11:55:31 raspberrypi node[10517]: 8/5/2018, 11:55:31 AM [homecloudhub] Retrieved config with server at 10.0.1.46:39501
Aug 05 11:56:29 raspberrypi node[10517]: 8/5/2018, 11:56:29 AM [homecloudhub] Received init request
Aug 05 11:56:29 raspberrypi node[10517]: 8/5/2018, 11:56:29 AM [homecloudhub] Starting module digitallife
Aug 05 11:56:29 raspberrypi node[10517]: 8/5/2018, 11:56:29 AM [digitallife] Initializing...
Aug 05 11:56:29 raspberrypi node[10517]: 8/5/2018, 11:56:29 AM [digitallife] Successfully got tokens.
Aug 05 11:56:29 raspberrypi node[10517]: 8/5/2018, 11:56:29 AM [digitallife] Getting list of devices...
Aug 05 11:56:29 raspberrypi node[10517]: 8/5/2018, 11:56:29 AM [digitallife] Listening for events... token is 50d5f807d483f81296dec9e79941ff4d
Aug 05 11:56:29 raspberrypi node[10517]: (node:10517) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
Aug 05 11:56:29 raspberrypi node[10517]: 8/5/2018, 11:56:29 AM [digitallife] Connected and listening for events...
Aug 05 11:56:30 raspberrypi node[10517]: 8/5/2018, 11:56:30 AM [homecloudhub] Sending event to SmartThings: Discovered device "Living Window 1" <SD0A1664A7>
Aug 05 11:56:30 raspberrypi node[10517]: 8/5/2018, 11:56:30 AM [homecloudhub] Sending event to SmartThings: Discovered device "AlarmKeypad " <KP0200B9AC>
Aug 05 11:56:30 raspberrypi node[10517]: 8/5/2018, 11:56:30 AM [homecloudhub] Sending event to SmartThings: Discovered device "Play Room Window 2" <SD0A1946FA>
Aug 05 11:56:30 raspberrypi node[10517]: 8/5/2018, 11:56:30 AM [homecloudhub] Sending event to SmartThings: Discovered device "Living Window 4" <SD0A17E32F>
Aug 05 11:56:31 raspberrypi node[10517]: 8/5/2018, 11:56:31 AM [homecloudhub] Sending event to SmartThings: Discovered device "Living Window 3" <SD0A17E32D>
Aug 05 11:56:31 raspberrypi node[10517]: 8/5/2018, 11:56:31 AM [homecloudhub] Sending event to SmartThings: Discovered device "Play Room Window 1" <SD0A191E07>
Aug 05 11:56:31 raspberrypi node[10517]: 8/5/2018, 11:56:31 AM [homecloudhub] Sending event to SmartThings: Discovered device "Dining Window 2" <SD0A18018B>
Aug 05 11:56:31 raspberrypi node[10517]: 8/5/2018, 11:56:31 AM [homecloudhub] Sending event to SmartThings: Discovered device "Dining Window 3" <SD0A181A58>
Aug 05 11:56:32 raspberrypi node[10517]: 8/5/2018, 11:56:32 AM [homecloudhub] Sending event to SmartThings: Discovered device "Office Window 2" <SD0A203E53>
Aug 05 11:56:32 raspberrypi node[10517]: 8/5/2018, 11:56:32 AM [homecloudhub] Sending event to SmartThings: Discovered device "Weather " <XA002accu>
Aug 05 11:56:32 raspberrypi node[10517]: 8/5/2018, 11:56:32 AM [homecloudhub] Sending event to SmartThings: Discovered device "Patio Door" <SD0A1664A3>
Aug 05 11:56:33 raspberrypi node[10517]: 8/5/2018, 11:56:33 AM [homecloudhub] Sending event to SmartThings: Discovered device "Rosiak Control Panel" <0>
Aug 05 11:56:33 raspberrypi node[10517]: 8/5/2018, 11:56:33 AM [homecloudhub] Sending event to SmartThings: Discovered device "Digital Life System" <AM00000004>
Aug 05 11:56:33 raspberrypi node[10517]: 8/5/2018, 11:56:33 AM [homecloudhub] Sending event to SmartThings: Discovered device "Key Fob" <SK0E044FF6>
Aug 05 11:56:33 raspberrypi node[10517]: 8/5/2018, 11:56:33 AM [homecloudhub] Sending event to SmartThings: Discovered device "Entry Front Door" <SD0A15F1B8>
Aug 05 11:56:34 raspberrypi node[10517]: 8/5/2018, 11:56:34 AM [homecloudhub] Sending event to SmartThings: Discovered device "Siren " <SI030075F7>
Aug 05 11:56:34 raspberrypi node[10517]: 8/5/2018, 11:56:34 AM [homecloudhub] Sending event to SmartThings: Discovered device "Dining Window 1 " <SD0A17E333>
Aug 05 11:56:34 raspberrypi node[10517]: 8/5/2018, 11:56:34 AM [homecloudhub] Sending event to SmartThings: Discovered device "Entry Laundry Door" <SD0A166483>
Aug 05 11:56:34 raspberrypi node[10517]: 8/5/2018, 11:56:34 AM [homecloudhub] Sending event to SmartThings: Discovered device "Living Window 2" <SD0A1664AC>
Aug 05 11:56:35 raspberrypi node[10517]: 8/5/2018, 11:56:35 AM [homecloudhub] Sending event to SmartThings: Discovered device "Office Window 1" <SD0A1CF888>
Aug 05 11:56:35 raspberrypi node[10517]: 8/5/2018, 11:56:35 AM [homecloudhub] Sending event to SmartThings: Discovered device "Play Room Window 3" <SD0A126440>
Aug 05 11:56:35 raspberrypi node[10517]: 8/5/2018, 11:56:35 AM [homecloudhub] Sending event to SmartThings: Discovered device "Smoke Detector" <SU020095DC>
So it looks like Hubitat can communicate with nodejs but nodejs can't send data to hubitat. When I start the nodejs app it get to the point where it tries to communicate with hubitat and sits there. If I configure the hubitat app again, it connects to nodejs and then I get the AT&T devices found by homecloudhub. nodejs is then supposed to send that information to hubitat but it never reaches there.
Aug 05 12:15:40 raspberrypi node[10805]: 8/5/2018, 12:15:40 PM [homecloudhub] Home Cloud Hub app v0.1
Aug 05 12:15:40 raspberrypi node[10805]: 8/5/2018, 12:15:40 PM [homecloudhub] ====================================================================================================
Aug 05 12:15:40 raspberrypi node[10805]: 8/5/2018, 12:15:40 PM [homecloudhub] Retrieved config with server at 10.0.1.46:39501
Aug 05 12:15:40 raspberrypi node[10805]: 8/5/2018, 12:15:40 PM [homecloudhub] url: http://10.0.1.46:39501
Here is the section of code that homecloudhub get's to and just sits there:
doLoadConfig = function () {
node.fs.readFile(configFile, function read(err, data) {
if (!err) {
try {
config.server = JSON.parse(data);
if (config.server && config.server.ip && config.server.port) {
log({
info: 'Retrieved config with server at ' + config.server.ip + ':' + config.server.port
});
log({
info: 'url: http://' + config.server.ip + ':' + config.server.port
})
node.request.put({
url: 'http://' + config.server.ip + ':' + config.server.port,
headers: {
'Content-Type': 'application/json'
},
json: true,
body: {
event: 'init'
}
});
}
} catch (e) {
log({
error: 'Failed reading config file: ' + e
});
}
}
});
},