[RELEASE] HubConnect - Share Devices across Multiple Hubs (no longer SmartThings!)

I've removed the ST instance from my hub.

I'll drag my C-7 out and do an install from there...

Admittedly, I've done these steps more than 50 times in the past year or two. But I installed code on the C-7 (3 pieces - two Apps, one driver) then added the User app. Next I clicked "Connect a hub" and picked:

Screen Shot 2020-08-02 at 12.04.30 PM

If you click the "Is there a Smartthings Hub?" it results in two offerings... oAuth, which is what you'd get if you didn't have a ST Hub powered on, or HubAction, which allows for mostly local communications with the ST hub.

Screen Shot 2020-08-02 at 1.04.46 PM

I chose HubAction.. :smiley: Then I pause there and grab the key and transfer it to where I've got ST open.

I've gone through Marketplace to add the App, then in Automation, the App doesn't appear, but I click "+ Add SmartApp" and pick and scroll to HubConnect, of course. :slight_smile:

Connect to Server hub... and paste in the Key.

It chews for a minute then the 'paste key' screen appears with the Key "hidden" and the IP defined and even a Name. I click Done. and click Save. I get the green banner saying it;s running.

Now back over to Hubitat, where the Verify button is waiting for me... Works, it's Connected. Done on out and...

Screen Shot 2020-08-02 at 1.14.25 PM

That is the "highway portion"

5 pieces of code.. 2 apps on Hubitat and a Driver, with 1 app and 1 driver on ST.

2 Likes

Great!

Just so I get the order correct (assuming it matters...)

  1. Install Hubconnect drivers on Hubitat - Done
  2. Install apps on Hubitat (Hubconnect server and Hubconnect instance), and ST (Hubconnect remote client for ST) - Done
  3. Start Hubconnect server and copy connection code
  4. Install and run Hubconnect app on ST classic and paste in the connect code to establish the connection
  5. Return to Hubitat app to verify connection
  6. Back to ST Hubconnect app to select devices to mirror on Hubitat

I tried above steps, all apps have OAuth enabled. Using the 2.x versions for all apps.

I'm actually having worse results than before...after getting the connection key from the HubConnect app on Hubitat, when I go to the ST Hubconnect app I get in an endless loop trying to connect. Screen shots below...there is never a real connection attempt as far as I can tell, when I hit Next it drops to the following screen w/no pause. I never get past the screens below, It just keeps looping through these screens. Like a kind of Twilight Zone episode. :wink: I tried both Classic and New ST app, both are pretty much the same.

Really appreciate any help you can provide.

Thanks! I've been choosing the OAuth option, as that seemed like the "obvious" choice.

What is the driver you're installing on ST? There is no mention of a ST driver that I saw/remember on the ST part of the install steps...I'll go look again.

Found 'em, did not see/reliaze that drivers need to be installed on ST as well. Will install HubConnect drivers and try again.

I did try to connect again just now using the HubAction connection type, and went into the same screen loop as above. Hopefully the drivers will help.

UPDATE: Same results (as I expected) after installing all of the HubConnect drivers on ST as well. So I have two apps (HubConnect Server and HubConnect Server and HubConnect Server Instance on the Hubitat, and all of the drivers. ST has HubConnect ST app and all of the drivers.

Similar loop through the ST app screen in both the classic and the new app...new app screens below. Both Hubitat and ST hubs are online and function perfectly in other ways. I've added a device and my Hue bridge to the Hubitat hub and those function w/out issue...so the hub is connected and communicating. I am also using the hubitat EWS obviously, to add the apps and drivers, etc.

Maybe it's me doing something dumb here, but I can't figure it out...

Hub connect says below that it's discovered the hub:

Then asks to continue:

And then it loses the hub...

Not sure if this is a bug with HE Alexa skill or a issue with how the Hubconnect contact sensor is coded but I have a contact sensor is both a temp and contact sensor and Alexa chooses it to be a temperature sensor and there is no way to change that in Alexa. Can this be fixed somehow ?

thank you - this works great for me! loving the integration!
Screen Shot 2020-08-05 at 12.37.22 PM

1 Like

You are talking about exactly what I'm wanting to do. Based on what Bruce wrote I'm thinking the way to do it is to make a backup of HUB A and restore to new HUB C. Then follow bruce's instructions of renaming the DNI... and finally renaming it back once imported. I'd say it can't hurt to try it with one device. What I'm not sure if is what would be the proper hubconnect sequence..as you'll have two remote hubs (A and C) wanting to send the same info to the server.

I actually tried to do this and succeeded, i.e. no change to the rules.

  1. at the present time I have all my real devices on one c5 hub, and another c5 hub has all my rules.
  2. in order to test out the procedure, I shutdown my rules hub. I shut down my devices hub, after I excluded a device that I was replacing.
  3. I added the new device (physically). I brought up the devices hub, and did the inclusion for the new device. I used the same name, but the device had a new device number. (obviously).
  4. I brought up the rules hub, and went immediately into the "shadow" of the device that I had replaced. I changed there the DNI to the new device number.
    Presto! Everything works as before! No changes to any rules!

I am finding that very, very often, the devices on one of my connected hub are not properly synced - ie the status on the real device is different than the one on the virtual device.

Is anyone else seeing this?

For me, the only way to fix this is to go to "Connect to Remote Hub..." and enabling "Send connection key and automatically configure the remote hub?".

Is there some way to do this from Rule Machine?

I have tried enabling "Re-connect websocket daily at...*" on both hubs about 1 hour after my daily hub reboot to see if it would make a difference, but it doesn't. Not really sure actually what that does...

I clogged up this thread w/my posts a few days ago, and @csteele was really helpful, but I never got Hubconnect to work for reasons that are beyond me. I've stopped trying for now, and of course am a little frustrated that I couldn't figure out what the problem is.

If anyone has any suggestions of additional things to try (short of a hub reset) I'm all ears.

I have seen it. I had a virtual thermostat on a remote hub that never seemed to sync with the server hub, but lately it has been working.

The times I have seen it I could get them re-synced by selecting the remote hub on the master hub and using the device resynchronization under the admin section.

1 Like

I just followed your recommendation and tried it and it did sync some devices, but I have one in particular that is stuck... It's a temperature sensor and for some reason, it just won't update... I have also tried the "Sync" and "Initialize" buttons on the device side, but no luck...

Sorry to hear you never succeeded... yet. :slight_smile:

My impression from observing hundreds of installs is that there's a smiggen of 'get-home-itis' -- the rush to get to the end.

Again, I use the highway metaphor.. but really, it's more like a bridge over water... there's no driving cars and trucks til the bridge is built.

Building the bridge starts with making sure the structure is in place. You must add code for 2 Apps to the Hubitat Hub you've mentally designated the "Server". You also need to add code for a Driver. On the Hub designated "Remote", add code for 1 App and code for 1 Driver.

Once ALL the code is added, it must be Installed. THEN it's time to build the roadway of the bridge. Create a new Server Instance and answer the questions. IP address, connection method, etc. The result is a Key. Don't click Verify. Not at this point. Well.. yea, you can, but it will fail, so why bother :slight_smile:

On the Remote hub, paste in the key and Done all the way out. It SHOULD indicate connected. IF not, circle around and get it into 'connected'. I use:
Screen Shot 2020-08-06 at 9.02.31 AM when it doesn't work.

The Remote is saying Connected! and that means it's time to finally click Verify on the Server Instance. Then it says Connected! and you must Done out.. all the way.

Both Server and Remote should be showing the Apps list and show HubConnect is Online.

As a further check, both Server and Remote should have a Device using the HubConnect Remote Hub driver. Look in each, verify the Current States are correct: On, Present and the Connection Type matches. If not, click the buttons On or Initialize.

If it's not correct, start over. :smiley: You cannot be successful mirroring devices if the connection is broken between hubs. :slight_smile:

USING HubConnect, once the road is built, is mostly a matter of making sure you have the Universal Driver installed on the opposite hub. "Real devices" on one hub, using "real" drivers; Universal Drivers on the opposite hub. 'Mirroring' can flow in either direction over the 'roadway', thus 'server' and 'remote' (terms used for building the roadway) are fuzzy. I think "real" and "mirrored" are more clear, because there's no anchor implied.

3 Likes

No, I've not seen this in the roughly 200 devices I'm 'mirroring' to my 5 Hubs. (3 Hubitat, Homebridge, SmartThings)

You're saying the 'real' device is always correct? That the 'mirrored' device doesn't match, an event is being dropped. Is that correct? If you flip a 'real' switch 10 times, the 'mirrored' device only sees 9, right? Or is it the other way?? You flip a 'mirrored' switch 10 times and the 'real' device sees only 9?

Thanks very much, @csteele, for the detailed info and patience.

I believe I have followed those exact, painstaking steps, but I also know that operator error is the most common issue w/technology not working. :slight_smile:

I'm going to remove everything related to hub connect and start again. one question - I had installed all the HubConnect drivers on both ST and HE during my ealier attempts. Do you believe that I need to remove all but one driver to increase my success chances? I was thinking that that the drivers don't come into play until I get the base connection in place, so having more than one driver won't be an issue. Let me know if I should remove all but one HubConnect device driver (e.g., leave only the contact sensor driver) on both platforms.

I've seen issues with v1.6 drivers on a v2.0 connection. Therefore, I'd check carefully that they are the correct version. No one's said it yet, but I think they're using the Import button, thinking it will import the new v2.0 drivers. It can't. Github vs HubConnect.to

Otherwise, yes, other than the HubConnect Remote Hub driver specifically, the Universal Drivers are not used by the 'build a Highway' portion. :slight_smile: and can remain.

Essentially, yes. The issues I am seeing are with my shared sensors. The temperature on one in particular is -9,2 on the device ans -12,3 on the mirror. Though in today’s case, the presence status updated but not the temperature... I also have some contact sensors and often, they won’t update to the correct status on the mirror devices. Typically all at the same time.

Anything you would recommend I try to get to the source of the issue?

Thanks! Of course I'm "sure" I only have the 2.0 drivers, but I will carefully re-confirm before starting anew. All HubConnect drivers were installed on ST via the IDE, and in Hubitat via the driver/copy-paste code and save.

My question was less about the type of device vs directionality.. is it predominantly A --> B or B <-- A. Or is it both?

HubConnect is really quite simple at the 'cars and trucks' level. :slight_smile:

Each end of a connected pair of hubs listens to Events and just jams them into the Platform. It doesn't 'inspect' the Event. It's the inner most loop and therefore as streamlined as possible. (For coders, look at the 'wsSendEvent' code in Server Instance or Remote-Client... it's ONE line.)

My thinking so far is around a dropped Event. Which then cascades into Where did it drop? and so on. :slight_smile:

OK, verified I have all 2.x on both Hubitat and ST hubs.

Installed on ST hub, OAuth enabled:


And a bunch of drivers (this doesn't show all of them):

Installed on Hubitat hub:
2020-08-06 11_37_50-Apps

Apps (server and server instance created from code paste, and OAuth enabled)

Bunch of drivers, including the Remote Hub driver:
2020-08-06 11_38_16-Drivers Code

I launch the app, choose connection to ST hub, choose hubaction connection option (based on your previous suggestion to use that) and copy the code that appears in Hubitat into the app on SmartThings app. Connection never happens...this screen below from the ST app seems to be the point at which it is telling me it can't find the Hubitat server.

The "Not connected: Error: Remote Hub Device Missing" message. Does that mean it's missing a device on the SmartThings hub, or a device on the Hubitat (remote) hub? Not totally clear what the message means...I have only a HubConnect app and HubConnect device drivers on the SmartThings app. I don't have to change the drivers for my devices on SmartThings to the HubConnect drivers, do I? I don't remember seeing any requirement to do that...

I love your explanation of how the system works. I feel like one of the cars is going by, and sometimes it leaves behind some of its passengers... Sometimes the highway seems to be broken, and re-sending the token (fixing a bridge?) works. I assume there isn't a way to automate this via RM?

Right now the issue seems uni-directional. Some States are accurate and others are not.

Here is a screenshot of the device I am currently trying to figure out... Earlier today, its presence was "not present". Then I was able to bring it back on-line and it reported "present" on both the device and the mirror hub. It went back to "not present" a little while back (screenshot) but through all that, the temperature and some of the other parameters remained different...


And just now, I went through the process again of bringing it on-line and everything synched-up... It all matches... Makes it very hard to debug!!! :crazy_face:

Note: I also have other devices - switched outlets - that I almost never have any issues with.