Integration with AT&T digital life

yes, they are on the same network.

When I start Home Cloud Hub and go into the app it finds my server, I enter in the login creds and I get the prompt that Home Cloud Hub is setup and automating. I then can’t get out of the app. It doesn’t take me out at all and using the back arrow seems to wipe out part of the configuration.

I am using an iPhone just incase that matters.

Eventually Home Cloud Hub times out and exits.

Let me explain a little:

The server was initially designed to work with external access to the hub, that is, the SmartApp was using regular HTTP requests to the homecloudhub.com server and the server would reply to it using the regular endpoint mechanism via smartthings’ servers. Since you’re most likely to run that PI2 at home (just as anyone would probably do), it makes more sense to avoid using smartthings’ servers to communicate with a device that’s essentially feet away. That is when I switched to using LAN connections. That replaced the HTTP requests from the SmartApp with sendHubCommand and HubAction, which allows direct LAN communication between the hub and whatever device is in the LAN. Similarly, the server had to replace the physical.graph.smartthings.com endpoint communication system and replace it with requests to the local IP of the hub. Not sure if all hubs listen on port 39500 or even if the port persists after a restart. Chances are they all do listen on 39500 as it would be quite a logistical nightmare for other devices to communicate with the hub. I’ve made sure I don’t hardcode the port number though, just to account for such situations.

When you first fire up the SmartApp and choose the local server option, it performs a SSDP search in the LAN and lists whatever IP it finds. Once you select the IP, it makes a HTTP request with path /ping to that IP, if it gets a pong back, it confirms that’s a HCH server. Once you finish installing the app, it sends a /init request with cookies and tokens for the selected modules, allowing the HCH server to start its job.

Hmmm… anything on the Mac? Does the hch server output anything? How about the Live Logging in SmartThings?

3/21/2016, 1:22:57 PM [homecloudhub] Home Cloud Hub app v0.1
3/21/2016, 1:22:57 PM [homecloudhub] ====================================================================================================
3/21/2016, 1:22:57 PM [homecloudhub] Retrieved config with server at 192.168.1.97:39500
events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: connect ETIMEDOUT 192.168.1.97:39500
     at Object.exports._errnoException (util.js:890:11)
     at exports._exceptionWithHostPort (util.js:913:20)
     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1065:14)




24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:39 PM CDT: info Successfully connected to AT&T Digital Life
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:38 PM CDT: info Logging in to AT&T Digital Life...
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:35 PM CDT: trace Pinging local server at xx.xx.xx.xx
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:35 PM CDT: info Successfully contacted local server
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:30 PM CDT: info Successfully connected to AT&T Digital Life
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:29 PM CDT: info Logging in to AT&T Digital Life...
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:29 PM CDT: trace Pinging local server at xx.xx.xx.xx
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:29 PM CDT: info Successfully contacted local server
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:28 PM CDT: trace Looking for local HCH server...
24dff282-1caf-4a94-a635-6aa99e75d2be  1:32:25 PM CDT: trace Looking for local HCH server...

I also can not uninstall the app.

Something is fishy. Can you check your Devices in smartthings, go to the hub and check its IP? Mine runs on 192.168.1.97 - what are the chances yours has the very same IP… plus the timeout means the server is barking up the wrong tree, sorry, IP.

Make sure /var/node/homecloudhub.local/config/homecloudhub.json is writable by whatever user it is you are running the server app under. I’ll check the code to make sure.

I think I found the problem. There are two hubs, THE hub and a Virtual Hub. All examples point to getting the IP with location.hubs[0].localIP but if that hubs[0] refers to the Virtual Hub… making sure I find the real hub, will update the HomeCloudHub SmartApp.

Try updating the HomeCloudHub SmartApp from the repo and publish it. Let me know how that works.

I fixed that too. The uninstall is conditional on a variable state.installed which was not set upon initialization. Run the install again and then it should have the Remove button the next time you go to the app.

Still no good. So I get through adding credentials hit next, I get to the screen that says Congratulations and press done.
The next screen is the “Add Modules” Screen which has “done” as well. The first time I clicked done it said it was ready and automating. Each time after that it throws “failed to save page: perfModules”.

Now I have 3 apps I can’t delete.

Go to the smart app and find the first pref dialog that says uninstall: !!state.installed
Replace !!state.installed with true and publish. That should allow all three apps to be removed. Sorry about that.

Then update the app from the repo and try installing again, but only one time. Watch the log on the mac to make sure IP is no longer 192.168.1.97 - it may be in the same range, whatever your hub’s IP is.

Anything in the Live Logging when that error happens?

Note: I just removed my app from the SmartThings and reinstalled it. Worked fine from getgo.

24dff282-1caf-4a94-a635-6aa99e75d2be 2:17:36 PM CDT: error java.lang.NullPointerException: Cannot get property 'authorities' on null object @ line 531

Oh, silly error - createAccessToken() does not work if OAuth is not enabled for the SmartApp, which is not needed in local mode.

Update from repo and try again please.

I get this error now:

2:28:30 PM CDT: error java.lang.NullPointerException: Cannot get property ‘useLocalServer’ on null object @ line 524

Oh snap, used the variable before it was set a few lines below that. Sorry, rushed to fix it and messed up.

Please update from repo, publish and try again. Sorry for the trouble :frowning:

sorry man, still this when trying to remove it:

3a24bdf6-18aa-4b2f-9843-949e5e8a899f 2:36:53 PM CDT: error java.lang.NullPointerException: Cannot get property 'useLocalServer' on null object @ line 524

ok. I had to run through a successful setup on each of them before I could remove them.

I was able to remove them and now I see this message in the console:

3/21/2016, 2:38:39 PM [homecloudhub] Starting module digitallife
3/21/2016, 2:38:39 PM [homecloudhub] Error starting module: Error: Cannot find module ‘request’
3/21/2016, 2:38:39 PM [homecloudhub] Starting module myq
3/21/2016, 2:38:39 PM [homecloudhub] Error starting module: Error: Cannot find module ‘request’

Yeah, state.hch was not set due to the install failing. Fixed that too so that it won’t crash anymore.

Each of the three .js files contains the module.push.path thing. I see you’re using /usr/local/bin/node_modules and I have /usr/bin/node_modules on my PI. Make sure you update the digitallife.js and myq.js as well. Haven’t found a way to automatically handle that yet. As I said, that happens when you follow the instructions to make it a service - running it under a newly created user breaks there…

So digitallife.js was missing this line:

module.paths.push(’/usr/local/lib/node_modules’);

I added it and I see in the console the discovery of all of my sensors. However I don’t see the sensors in smartThings.