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

I tried to take a screen cap of the Client page and wanted to be cool and have the key look the same... long long key string.. BUT I tabbed away and when I came back it didn't like the key and had killed my connection.

I had to restore from last night's auto backup of the DB (Thanks Hubitat!! Genuine thanks for giving me that option and ability.)

Not sure if this matters at all, but when I did mine, I had one on either screen.
I took the key, and pasted it in the Remote, but don't hit done, just wait.

On the Master, my Remote hub then showed as Online, only then did I hit done.
And it has to be the latest key provided. Admittedly I did struggle at first.

So where does "clientURL" come from? I don't see it in settings. I also see clientURI as a state variable and being defined locally from time to time.. (sendGetCommand() etc)

It comes during the OAuth exchange from Client to Server.

I'm out of the country for the day, but a quick suggestion for those experiencing issues with the Server Instance..

Try changing clientURL to state.clientURI and see if that fixes the issue.

1 Like

Yes that worked!

2 Likes

Outstanding. Sorry I couldn't get back here sooner. I will push the fix this evening.

You have done so much already for this community as well as @csteele - cannot thank you guys enough.

5 Likes

Well that's a chunk of code I never had reason to look at, before this morning.. I had drilled all the way back into remote-client -- I'm sure it wouldn't have taken me more than one more hour!!! :smiley:

2 Likes

Question for @csteele about clientURL - if the format is

clientURL is the assembly of the IP + api + token.

And there are clientURI's being defined elsewhere with the access token should we do something like this?

def clientURI = state.clientURI + "?access_token=" + state.clientToken

or def clientURL and use that instead?

I took that to be search/replace. clientURL goes away

Yeah and that's what I did.. but was just wondering if we needed the access token as a parameter for anything.. but all good!

One of the most important things I learned is.. "LET STEVE CODE IT" -- I made many suggestions and every time he came back with 'prettier' code. :smiley: And sadly, I'm not saying a little bit 'prettier' either... a LOT. :smiley:

I'm going to wait on his version :smiley: :smiley:

2 Likes

Thanks a bunch! That is working for me.

Though I'm again having problems on the (shocking, I know) ST side of things. It creates devices but the ST app doesn't show anything when I open them, which I suppose is because the DTH doesn't have tiles defined. If I click the "gear" icon on the device page, I get "Error fetching device. Please try again." The DTHs are indeed the same "universal drivers" I would have installed on Hubitat, right?

Yes. They need to be installed at the 'receiving' end of the connection. Pushing a device from ST to HE, the stub driver goes on the HE server Hub. Pushing a device from HE to ST, the stub driver goes on the ST end.

Perhaps I should have clarified that they were, indeed, installed. :slight_smile: (On both ends since I have four hubs total between the two platform and some have communication going both ways.) I also verified in the ST IDE that the correct DTH was selected. But since the DTH doesn't implement tiles, I don't see how the ST app will ever show much of a UI for it, which I don't think technically matters if it works, but I don't have a way to tell, and it doesn't look promising so far (lots of errors when I try a thermostat, and a dimmer does give me an on/off button on the device's "SmartApps" tab, something it must do by default for switch-capable devices). Any device gives the error I mentioned if I try to delete it from the app (have to use the IDE). I'll keep playing!

EDIT: Just tried to add two new dimmers from Hubitat to ST. One of them added an ST device. The other one did not. The Hubitat logs show the rather unhelpful:
groovyx.net.http.HttpResponseException: Internal Server Error on line 631 (updated), while ST is perhaps even less so: error groovy.lang.MissingMethodException: No signature of method: physicalgraph.app.AppStateCacheService.getAppState() is applicable for argument types: (java.lang.String, org.codehaus.groovy.grails.web.json.JSONObject) values: [718e64dc-f782-long-string-blah-blah, [values:[switch], bytes:[...], ...]] Possible solutions: getAppState(java.lang.String, java.lang.String), setAppState(java.lang.String, physicalgraph.app.cassandra.AppState) @line -1 (doCall) (if I knew where line -1 was, I'd get started :slight_smile: ).

Ohhh.. tiles, yes, I didn't read the Question that way.. You are correct, not much of a UI.

( I wonder if that dusty box with a ST hub in it would revive - I need 4 hubs - it would be good for generating random cloud delays as April Fools automations, right? :smiley: )

1 Like

I really want to get down to just two, my "lighting and Zigbee" hub for Hubitat and my "Z-Wave/coordinator hub" for Hubitat...but there are a couple things I'm still using ST for (thermostats on Alexa and, if I can get this working, Ring integration as a motion sensor). And as long as I want to keep tinkering, my third hub will be around, too. :slight_smile: (I know some people split their hubs by floor/zone, but my main desire was to make my lights as fast as possible, so getting Zooz's chatty Z-Wave devices not on that hub and dedicating it entirely to lighting...and other Zigbee devices I can now "push" to my "main" hub since I don't want to run a bunch of Zigbee networks and possibly run into other problems...is probably enough for me.)

I just edited my post above with specific errors I'm seeing.

Java, renowned for it's inciteful error messages is reaching for a new low water mark. :slight_smile:

This is great work. Thanks!

Quick question. I am getting started in slowly moving from Smart Things to Hubitat. I was able to create virtual devices from my Smart Things install to master Hubitat. I have 1 Lutron pico remote in Hubitat that I would like to expose to Smart Things. I think I'm missing a step on how to do that. Does anyone know how I can add it if even possible?