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



Are you using web sockets or event socket connection type?

The number of devices shouldn't matter (as much) with event sockets. I process loads of devices (100?} via event sockets in node red with no issues.


I'm using event sockets. Maybe even with it set to event the app it is still processing the http code at startup?

I know this is ridiculous, but everyone has a different way they are using the system... I have about 360 devices linked from the server hub to the remote one. They are a vast majority virtual devices being used in decision making for rule machine. If I go much above that number, it errors out.


Technically, when you select devices and then click the final Done, every device is pushed from one hub to the other. It takes almost no time to go through the list on the receiving hub and determine that a specific device exists already. BUT for new devices, it has to build the Virtual device and attach the driver, etc. An error on any one halts the process. I'd suggest they be added in more bite sized chunks.

I have 150 devices and @srwhite has over 500, Adding one or 10 more won't be an issue but adding 200 at one go...


Thanks for the response @csteele .
I just tried that, and I was able to add more devices, basically one by one, but it still ended up failing.
I'm not sure if time is an issue, but, in general, it appears about 10 seconds is the limit.
Just under 10 seconds from the last device status to subscribing.
And then adding a device or two:

Granted the 10 seconds isn't exact, as this one worked, but it isn't consistent. Probably a lot going on around that 10 second mark. But somewhere around there adding / deleting a couple devices makes a difference.

EDIT: I was looking at that last example wrong. It actually too was just barely under 10 seconds.


"Subscribing to device events" is an oAuth (http) message.

Event Socket:

oAuth (http):

Can you tell me what version you're using? "line 893 (updated)" isn't matching exactly with the current source.

Also, can you tell me what "app: 4963" and "app: 3947" are?


I'm going to check everything is up to date, but this is as it was with those error logs, hopefully accurate? Will report back.

4963 appears to be the server instance:

3947 appears to be the remote hub device:


While @srwhite is on extended vacation, I've published a couple of Hot Fixes. I don't have access to Steve's repo for the version values, so the "Latest" Column will be behind the times.


I just reimported the app for the server, server instance, and remote server. It still shows error on line 893. This is 893 on my system:

in case helpful:

and after re-importing, this is my version report (no change)

And like an idiot, I was manually counting devices! It works / fails right around this number for me personally, but I doubt the exact number of devices is important:


Thanks... as you know, with Hubitat, there's no requirement that anyone upgrade... so "What's your version?" is going to be a part of every debug session. :smiley:


This may be stupid...

But does it send the devices to the remote hub in groups, then wait for a response? So, dimmers, wait for response that they've been successfully added, switches, wait for response, etc.

Because the vast majority of my devices are switches (300+) and it seems that is where it is hanging. I'm wondering if I move 50 to 100 of those devices to another category (maybe a custom device that is the same as a switch? or change the virtual switches to virtual dimmers and ignore the level attribute), if it will then accept it?

I'll try tomorrow and see if that makes it go.

Also, in case I've messed anything up that is beyond repair, can I reinstall the app & components and then relink without deleting (or duplicating) the devices on the remote hub? I'm willing to fully reinstall, but it will be a mess if I have to manually delete (and then put back in rules/apps) all 300 devices. Not absolutely horrible, but probably a nights worth of work. I'll give this a try tomorrow as well (after making a backup!)


The backup path is what I'd do.

Make a backup and then after the testing, if you're not better off, then soft reset back to nothing and restore the backup.


@csteele Thanks for the help. I think I've found the solution specifically for me, though it is a hack.

I'm hoping it will help with debugging the code.

I added another device group, I called it "announcementSwitch", by copying two lines of code in the server instance..


Now the initial setup completes, with the number of devices in each category shown below. When all were in one category, the code failed as described in previous posts:



Also, as a side note - I tried creating a custom device for a second switch device and couldn't get it working. I could get the device to be added to the remote hub, and to display state changes from the server hub, but I could not get a change from the remote hub to be accepted by the server hub. The error was related to not being able to find the correct device ID.


I just wanted to take a minute and post my experience. I had lots of custom code running on my single hub. I was experiencing crashes frequently.

I now have a second hub running with all the custom code and a relatively clean hub running my z radio stuff. All connected with hubconnect.

I have experienced no lock ups in some time in either hub, despite the fact that I am running all the same stuff. I kind of expected to see problems on the non z radio hub. It however has been rock solid.

Thanks again to everyone for this app.


Hi, Thanks for this app. I've installed it and it's working well on my 2 HE hubs. I wanted to get some zigbee switches off my main hub, that I believe are not great repeaters.

Now I'm trying to move my home alarm. I've got it on the second hub, but am not sure how or where to modify the custom device driver under "custom devices" in order to get it onto my co-ordinator hub.

I need the device handler to set the alarm: strobe, off, arming, both.

Thanks in advance.

By the way, I have noticed my second hub is much faster in loading web pages than the first.


@csteele and @srwhite Ok, so I have found an issue with adding a group of bulbs to the RGB Bulbs group. The lights turn off and on and dim as expected but it does not sync the status back to the remote DH. I wouldn't care about this but the Echo device responds that the device isn't responding. If you need more info let me know. Thanks.


Groups and Scenes App ?? or does "group" mean "this recent batch of..." ??


How would I create device code for my custom device/attributes?


Stub Driver??

Stub drivers don't do a lot. They predominantly just capture the event and stuff it into the system...

Take the Siren universal driver as a sample.. it has the same Definition section as the real driver it mimics. The Capabilities, Attributes and Commands are defined the same. Then "on", "off", "strobe", "siren" and "both" are needed.. but all they do is send an event to the Parent (aka Remote-Client or Server-Instance) That event then gets sent to the connected hub and functions the same as pushing the same button in the Device Info page... causing the real device to do that action.


Thanks, not at home right now.

Do I need to create new devices on both parent and slave hub? The device in question is currently on the slave hub. I want to get the status of the device to the master hub.


Wow, that was pretty easy. Install device code on both hubs, and presto. Thanks