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.
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.
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...
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.
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”.
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.
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…