In my plugin J_Harmony_UI7.js file that displays the Settings and other panels (so not the J_ALTUI_plugins.js equivalent) I want to know if the controller I am talking to is a Vera or openLuup so I can show/hide some settings as applicable to the target platform. I found how to check that the controller is UI5, but not seeing more options.
var controller = MultiBox.controllerOf(deviceObj.altuiid).controller;
var isUI5 = MultiBox.isUI5(controller);
But, how can I see it is openLuup vs. Vera. The same bit of javascript is loaded in ALTUI on openLuup for a local or briged device so I would like to see what I am talking to. Is there a clean way?
In my plugin J_Harmony_UI7.js file that displays the Settings and other panels (so not the J_ALTUI_plugins.js equivalent) I want to know if the controller I am talking to is a Vera or openLuup so I can show/hide some settings as applicable to the target platform. I found how to check that the controller is UI5, but not seeing more options.
var controller = MultiBox.controllerOf(deviceObj.altuiid).controller;
var isUI5 = MultiBox.isUI5(controller);
But, how can I see it is openLuup vs. Vera. The same bit of javascript is loaded in ALTUI on openLuup for a local or briged device so I would like to see what I am talking to. Is there a clean way?
Cheers Rene[/quote]
there is a method isOpenLuup on the VeraBox object so you can try ( not tested )
var controller = MultiBox.controllerOf(deviceObj.altuiid).controller;
return controller.isOpenLuup()
I could not figure out how to get from the MultiBox to the VeraBox so the IsOpenLuup becomes available. MultiBox.controllerOf does not seem to return a VeraBox object, but just a number.
So, I thought I could take a shortcut assuming openluup always has version 1.7.0;
var udObj = api.getUserData();
if (udObj.BuildVersion === "*1.7.0*") { bControllerIsVera = false; }
But that does not work. It always thinks it runs on openLuup.
I could not figure out how to get from the MultiBox to the VeraBox so the IsOpenLuup becomes available. MultiBox.controllerOf does not seem to return a VeraBox object, but just a number.
So, I thought I could take a shortcut assuming openluup always has version 1.7.0;
var udObj = api.getUserData();
if (udObj.BuildVersion === "*1.7.0*") { bControllerIsVera = false; }
But that does not work. It always thinks it runs on openLuup.
Cheers Rene[/quote]
yes it is a bit cumbersome but this should work
var altuiid = "0-2" // example
var ctrnum = MultiBox.controllerOf( altuiid ).controller
MultiBox.getControllers()[ ctrnum ].controller.isOpenLuup()
That still gives me the type of my local controller only and not the bridged. I now made the assumption that all bridged devices are Vera, but I know akbooer is making bridging to a second openLuup controller via the VeraBridge too. So now doing this:
var udObj = api.getUserData();
// We are running on openLuup locally, for now we assume if bridged then it is a Vera.
bControllerIsVera = !(Boolean((udObj.BuildVersion === "*1.7.0*") && (deviceObj.id_parent == 0)));
That still gives me the type of my local controller only and not the bridged. I now made the assumption that all bridged devices are Vera, but I know akbooer is making bridging to a second openLuup controller via the VeraBridge too. So now doing this:
var udObj = api.getUserData();
// We are running on openLuup locally, for now we assume if bridged then it is a Vera.
bControllerIsVera = !(Boolean((udObj.BuildVersion === "*1.7.0*") && (deviceObj.id_parent == 0)));
Cheers Rene[/quote]
ALTUI gives you the type of what it controls ( so tells you if the underlying platform it talks to is a vera or openluup )
but if you use a verabridge and you want to know if the bridged box is a vera or openluup, I would imagine this is a property that verabridge should expose as part of its own properties ( maybe as a variable of the device ? )