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

I think things are working (other than putting 97 devices back in their rooms). but this error does pop up on hubitat with the logging turned on:

`[app:322](http://192.168.20.22/logs#app322)2019-05-18 21:29:37.175 [error](http://192.168.20.22/installedapp/configure/322)org.apache.http.conn.HttpHostConnectException: Connect to 0.0.0.0:20009 [/0.0.0.0] failed: Connection refused (Connection refused) on line 888 (updated)`

that error only pops up after I hit done on the app. everything seems to be working though.

Try to set the parameter “local_ip” in you config.json to the IP address of your Homebridge. There was another use with the same problem and that fixed it. I am going to fix it in the code tomorrow.

I have control, but it isn’t updating when the lights are turned off and on by other means. And motion sensors and contact sensors aren’t updating. Logs all look empty.

If I take that literally, that you clicked On, for every HSM option in HubConnect, I think that just might be an infinite loop.

As I mentioned, I don't actually USE HSM (or modes) but I have them setup so that I can test and verify. Because of that, I cannot dispute that my setup could be so poor, that I am not seeing any bugs. However, here's what I have :slight_smile:

HSM is installed on 'coordinator' which I think is not where it wants to be. I think it probably needs to be closer to the action' by residing on a radio-active hub... a Remote. But I do have it enabled to send to one of the Remote hubs... so OK, it's backwards, but strictly for finding bugs, it's probably OK. My setup is 'unidirectional.' I will, for a specific set of tests, enable it to be sent to SmartThings.

This works without crashing.

For Homebridge...

Configuration of cached accessories not done, wait for a bit... 97
Configuration of cached accessories not done, wait for a bit... 97
Configuration of cached accessories not done, wait for a bit... 97
Configuration of cached accessories not done, wait for a bit... 97

(for a very long time) is normal, for me too. 97 = your count of devices sent to Homebridge, I'm showing 55. After 2-3 minutes it continues startup and everything is well.

I think when I tried messing with the local_ip it messed up my cache or something. Homebridge crashed afterward due to a json error. I removed my additions and it started back up, but now things aren’t updating.

edit: getting this error in my homebridge logs:

[5/19/2019, 5:38:59 AM] Homebridge is running on port 51827.
[5/19/2019, 5:38:59 AM] [Hubitat hhh:0.2.1] latest version on npmjs is 0.2.1
[5/19/2019, 5:38:59 AM] [Hubitat hhh:0.2.1] your version of the plugin is up2date
[5/19/2019, 5:38:59 AM] [Hubitat hhh:0.2.1] Configuration of cached accessories not done, wait for a bit... 99
[5/19/2019, 5:39:00 AM] [Hubitat hhh:0.2.1] Configuration of cached accessories not done, wait for a bit... 99
[5/19/2019, 5:39:01 AM] [Hubitat hhh:0.2.1] Configuration of cached accessories not done, wait for a bit... 99
[5/19/2019, 5:39:02 AM] [Hubitat hhh:0.2.1] Configuration of cached accessories not done, wait for a bit... 99
[5/19/2019, 5:39:03 AM] [Hubitat hhh:0.2.1] Configuration of cached accessories not done, wait for a bit... 99
[5/19/2019, 5:39:04 AM] [Hubitat hhh:0.2.1] Configuration of cached accessories not done, wait for a bit... 99
[5/19/2019, 5:39:05 AM] [Hubitat hhh:0.2.1] { InternalError
    at /usr/local/lib/node_modules/homebridge-hubitat-hubconnect/index.js:168:49
    at process._tickCallback (internal/process/next_tick.js:68:7)
  errorCode: 0,
  name: 'InternalError',
  additionalArguments: [ '' ],
  message: '',
  lastHttpRequest:
   { hostname: '192.168.20.22',
     port: 80,
     path: '/apps/api/322/devices/get',
     method: 'GET',
     headers:
      { Authorization: 'Bearer ea42db3f-5e41-425d-98ce-b8f699f12104' } } }
[5/19/2019, 5:39:05 AM] [Hubitat hhh:0.2.1] Going to exit here to not destroy your room assignments.
-U /homebridge -P /homebridge/node_modules -C
[5/19/2019, 5:39:07 AM] Loaded config.json with 0 accessories and 2 platforms.
[5/19/2019, 5:39:07 AM] ---

Ok, I just published a new plugin that corrects the whole 0.0.0.0 thing and improved a few of the log messages to help us get through this. Adding the "local_ip" setting can't mess with the cache. Homebridge will just quit even if the format in the config is wrong and the cache has no idea of that IP address. There must have been something else.

Please use the new version and see if that elevates your problems.

Yes I clicked On for every HSM option. They are all off now. :slight_smile:

Hmmm. after like 6 restarts, things seem to be working again. I do get this error after I hit done in the hubconnect app, but the devices seem to be responding in like they should in homekit.

`[app:322](http://192.168.20.22/logs#app322)2019-05-19 09:55:52.882 [error](http://192.168.20.22/installedapp/configure/322)Unable to create the Hub monitoring device: java.lang.IllegalArgumentException: A device with the same device network ID exists, Please use a different DNI. Support Data: [id: "hub-192.168.1.20", name: "HubConnect Hub", label: "Homebridge 2"]`

there's a clue within:

Unable to create the Hub monitoring device
A device with the same device network ID exists, Please use a different DNI

For every Hub Instance on the server, there's a Device using the HubConnect Remote Hub Driver. HubConnect believes a new one needs to be created but one already exists. You'll probably want to follow @dan.t 's advice:

I literally just did that. And just got through putting 99 devices back into their respective rooms and then something. happened and it started throwing this error again.

edit: also, like I said, it seems to be functioning normally.

OK, I ran into that same problem regarding the duplicate DNI.

I don't know how I did it, but I know exactly what's wrong. I cannot reproduce it but clearly it is possible to get it confused.

@csteele @srwhite

Any chance to check my post above, I can't figure out how to get any devices to show on the Custom Drivers list when selecting devices as mentioned above on this post: [RELEASE] HubConnect - Share Devices across Multiple Hubs (even SmartThings!)

Also, found my ceiling fan wasn't showing at all on the Groups app, could setlevel be added to the driver for fans? I added it manually and now I was able to select my ceiling fans as a dimmer would show.

Just upgraded to 1.4....

No issues, but SYNC on custom drivers still doesn't populate the state/variable data. :frowning:

any further ideas on that error? everything still seems to be working pretty well for me. I’m just scared of losing all my customization again.

I am using the “controller” app to do a backup of my homekit setup. I was thinking. - after the last big update to 2.0, I lost all my room preferences/settings and I used the controller app to try and restore them. It was shortly after that when my entire install got borked. could that have messed things up for hubconnect/homebridge?

I have no answers.. however, I do think I'm in the same boat. I think I might have been too successful at duplicating :slight_smile:

@dan.t

I’m now getting this error with 2.1.0. After restarting homebridge it works for a few minutes, until this error pops up.

[5/23/2019, 6:02:14 AM] [Hubitat hhh:0.2.2] Configuration of cached accessories not done, wait for a bit... 98,
(node:369) UnhandledPromiseRejectionWarning: ReferenceError: platform is not defined,
    at /usr/local/lib/node_modules/homebridge-hubitat-hubconnect/index.js:170:33,
    at process._tickCallback (internal/process/next_tick.js:68:7),
(node:369) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1),
(node:369) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.,
[5/23/2019, 6:02:15 AM] [Hubitat hhh:0.2.2] Configuration of cached accessories not done, wait for a bit... 98,
(node:369) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2),
[5/23/2019, 6:02:16 AM] [Hubitat hhh:0.2.2] Configuration of cached accessories not done, wait for a bit... 98

I take a look at that in a bit. Haven’t updated to 2.1.0 yet as I was out of town. Give me an hour or so

Just published a new version to correct that. Did that happen while you were applying the update and the hub was restarting?

your amazing! it seems to be working again. I'm not sure when it happened. I updated the hub last night, but didn't notice that homekit wasn't working until this AM.

1 Like

I assume that at some point you will get another error.... The error that you found here was in an area when I tried to log an error description, the logging failed. But there is an underlying error that I am trying to get the info on. So keep an eye on it. It might be connected with rebooting hubs which I am going to play with today.