This app is designed to allow 2 hubs to synchronize the values of hub variables, HSM Status, and Hub Mode. (Can have multiple copies of the app if running 3 or hubs.) Much of this functionality will, at some point be is now available via Hub Mesh for hubs on the same LAN segment, but this app will also allow the use of HE's cloud endpoints for hubs that are not on the same segment.
It will be in the Hub Mesh at some point, but this would also allow you to sync with hubs that aren't on the same LAN if desired (not the reason I wrote it though - I just had a few minutes and wanted to see if I could do it...)
Just dawned on me that's the difference. In the remote hub, I'm no longer using a Hub Variable, which I imagine has a performance disadvantage. Is that the point?
I'm trying to wrap my head around the advantage of this app over hub meshing the connector.
Couple less devices, and the fact that connectors will eventually go away creation of new connectors won't be supported when Hub Mesh does include the capability of sharing variables across (thinking this will be sooner rather than later). Probably not a real performance hit, but possibly a little slower using the connector and this allows me to make my rule changes now and look for something else to dig into.
v0.1.6 adds the capability of sending and receiving variable updates with nodeRed.
To send from nodeRed use an httpRequest node, with method = GET or POST, and a URL that looks similar to (most of the data is from the Local Server Information page in the app):
Recieving data into nodeRed requires an http In node with method *Post * and URL equal to the value you entered as the Node Red Endpoint path in the app. Some method of parsing the incoming value - a sample from a function node:
msg.payload = "received update for variable "+msg.payload.varName+" with value "+msg.payload.varValue+" and type "+ msg.payload.varType
return msg;
Can't get this to work. A quick examination of the code seems to indicate that manageSubscriptions() is never called.
I think it's never called because on a new installation, atomicState.priorList is null, and the test on line 105 fails, preventing the subscriptions from being set up and priorList from being updated.
Edit:
Confirmed, that's the problem. Add the test for a null priorList:
Maybe this isn't the best way to fix the problem, but it does confirm that manageSubscriptions() was not being called because priorList was null.
Perhaps just set priorLIst to an empty list in initialize(). Looks like you're trying to optimize away the call to manageSubscriptions() if the lists are equal but why bother, it's not something that's going to be called a zillion times in a loop.