Updated math variable execution to use net.java.dev.eval package. Safer

and more robust than using JavaScript Engine Eval. Also, added checks if
a default vera address is uses , "1.1.1.1", that we ignore the vera
helpers to not throw errors.
This commit is contained in:
Admin
2015-10-12 16:34:21 -05:00
parent aebde7ee48
commit c5fbd5d1f0
14 changed files with 70 additions and 34 deletions

View File

@@ -120,6 +120,9 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
};
this.viewVeraDevices = function () {
this.state.error = "";
if(BridgeSettings.veraaddress == "1.1.1.1" || BridgeSettings.veraaddress == "")
return;
this.state.error = "";
return $http.get(this.state.base + "/vera/devices").then(
function (response) {
@@ -137,6 +140,8 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
this.viewVeraScenes = function () {
this.state.error = "";
if(BridgeSettings.veraaddress == "1.1.1.1" || BridgeSettings.veraaddress == "")
return;
return $http.get(this.state.base + "/vera/scenes").then(
function (response) {
self.state.verascenes = response.data;
@@ -227,6 +232,9 @@ app.controller('ViewingController', function ($scope, $location, $http, $window,
$scope.BridgeSettings = bridgeService.BridgeSettings;
bridgeService.viewDevices();
$scope.bridge = bridgeService.state;
$scope.showVera = true;
if(BridgeSettings.veraaddress == "1.1.1.1" || BridgeSettings.veraaddress == "")
$scope.showVera = false;
$scope.predicate = '';
$scope.reverse = true;
$scope.order = function(predicate) {
@@ -298,6 +306,9 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.vera = {base: "", port: "3480", id: ""};
$scope.vera.base = "http://" + BridgeSettings.veraaddress;
bridgeService.device = $scope.device;
$scope.showVera = true;
if(BridgeSettings.veraaddress == "1.1.1.1" || BridgeSettings.veraaddress == "")
$scope.showVera = false;
bridgeService.viewVeraDevices();
bridgeService.viewVeraScenes();
$scope.bridge = bridgeService.state;