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

This is my second time through (after reverting back). I followed step by step (or so I think I did). Same outcome.

@waynespringer79 I think I found a workaround thanks to what you said. I renamed my hub device on the server and then it worked.

1 Like

The live logs shows that it's trying to create the remote hub (on the server), but it already exists.

Have you tried deleting the hub device? It can’t create it since it has the same DNI

Yep, see above.

I thought you renamed it. I really mean delete it

I did so it could create it, to verify that it would work, and then deleted. All is good I guess. But it is a bug in the upgrade process.

1 Like

@srwhite
no have not touched the code

import groovy.transform.Field
import groovy.json.JsonOutput
definition(
name: "HubConnect Remote Client",
namespace: "shackrat",
author: "Steve White",
description: "Synchronizes devices and events across hubs..",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
)

Also likely an issue on my network but I can not import from
http://hubconnect.hubitatcommunity.com/import.php
but can from direct links
like this one:
https://raw.githubusercontent.com/HubitatCommunity/HubConnect/master/Hubitat/apps/HubConnect-Server-Instance.groovy

both these are minor issues not really affecting me.

I just tried again this time instead of copy/pasting the updated code, I followed the instructions using the "import" method at which I manually typed in all the drivers/apps address locations manually. They all imported and saved perfectly.

Upon completing the last step:

On the server hub go to Apps
Select HubConnect Server for Hubitat
HubConnect will alert that an update has been installed. (And it did) Click Done when prompted to do so (and I did)

The following errors ARE reported?

The logs show conflicting information. During intitialization HubConnect looks for a child device with a DNI of hub-ipaddress. If it does not find it, it then creates one. There should never be an instance where the hub device cannot be located and created because it already exists. When this happens it means one of a couple reasons..

  1. The Remote Hub child device has been disassociated with the server app due to a bug in Hubitat or database issue, etc.. This means that Hubitat does not consider the remote hub device to be a child device of HubConnect and does not make it available to the app. This is not a bug with HubConnect. Deleting the device is the only fix as HubConnect server will recreate it.

  2. The remote hub device was manually created by going to devices -> add virtual device. Again, the device wouldn't be associated with HubConnect app so it cannot find it during initialization. Since a device with the same DNI exists, HubConnect also cannot create a new one. Again the fix is the delete the remote hub device and let HubConnect recreate it.

1 Like

Your Remote Hub device is not available to HubConnect. They could be corrupt, etc. See my last post.

Make sure the correct driver code is imported first, them make sure the remote hub devices are deleted. Go back into each server instance and click Done. It will rebuild the remote hub devices.

1 Like

Could be disassociated.

It was not manually created.

I think that got it. Deleted the Hub "devices" AND the somehow had 2 Remote Hub drivers (had this issue earlier as well) and deleted the oldest one of those drivers. Then went back into the server instances and clicked done.

No errors so far 5 minutes now....great work!

I see one more way of getting into a situation like this:

  • HubConnect App is installed
  • Hub Device gets created
  • HubConnect App gets deleted
  • HubConnect App gets installed again
  • Hub Device can’t be created as the DNI is already existing however it is not associated to that App instance as it belonged to the previous App instance
2 Likes

This is very true. Forgetting to remove the virtual hub during uninstallation will certainly cause this to happen as well.

Edit: does anyone know if Hubitat supports the Uninstalled() method like SmartThings does. Seems like that would be a way to avoid this scenario.

4 Likes

Yes they do as I have used it on a few apps and drivers.

1 Like

Yes, it does. But it is NOT clear whether HE deletes all children before the parent app is deleted (ST seems to do this whether you explicitly delete them or not).

In other words, you may want to code the ENTIRE delete process into your uninstalled() method, just in case Hubitat "forgets" to remove a child...

I will add it to a future release just so the phantom devices don't get left behind... I've always thought, because SmartThings does, that all child devices will be deleted when an app is removed, assuming they're not used in automations. Apparently from others experience that's not a given.

HubConnect 1.5.2 has been released!

This release fixes an issue where custom drivers were missing on hubs running the HubConnect Remote Client following the upgrade to 1.5.

This release also adds the humidity attribute to custom drivers too.

If you use custom drivers please update right away. It's only 2 files (Server & Remote Client). If not, there's no need to install this patch unless you need to use humidity in a custom driver.

I wonder if this was my issue.
I will try again.
I haven't looked at the new instructions yet but for you guys that had issues, can you confirm what you checked for and deleted as a belt and braces before I try again as I always end up with issues after a soft reset.
Thanks