From a6bb1ae3aae49ae9c39f98da3e9653915457d6f7 Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 27 Jan 2016 16:54:23 -0600 Subject: [PATCH] Fixed the harmony button to be a label and not the name. Implementation of multi batch add completed. --- pom.xml | 2 +- src/main/resources/public/scripts/app.js | 38 +++++++++++++++---- .../resources/public/views/configuration.html | 4 +- .../resources/public/views/harmonydevice.html | 4 +- .../resources/public/views/veradevice.html | 16 ++++++-- 5 files changed, 50 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 325ae97..3390b21 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bwssystems.HABridge ha-bridge - 1.3.1b + 1.3.1c jar HA Bridge diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index 8563ddc..0c063d0 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -1,6 +1,4 @@ -var app = angular.module('habridge', [ - 'ngRoute' -]); +var app = angular.module('habridge', ['ngRoute']); app.config(function ($routeProvider) { $routeProvider.when('/#', { @@ -557,7 +555,6 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer $scope.clearDevice(); - bridgeService.device = $scope.device; $scope.vera = {base: "", port: "3480", id: ""}; $scope.vera.base = "http://" + BridgeSettings.veraaddress; bridgeService.viewVeraDevices(); @@ -566,12 +563,12 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer bridgeService.viewHarmonyDevices(); bridgeService.viewNestItems(); $scope.bridge = bridgeService.state; - $scope.device = bridgeService.state.device; $scope.imgButtonsUrl = "glyphicon glyphicon-plus"; $scope.buttonsVisible = false; $scope.predicate = ''; $scope.reverse = true; $scope.device_dim_control = ""; + $scope.bulk = { devices: [] }; $scope.order = function(predicate) { $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false; $scope.predicate = predicate; @@ -743,7 +740,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer $scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-on\"}"; $scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-auto\"}"; }; - + $scope.testUrl = function (device, type) { bridgeService.testUrl(device, type); }; @@ -769,7 +766,34 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer function (error) { } ); - } + + }; + + $scope.bulkAddDevices = function(dim_control) { + for(var i = 0; i < $scope.bulk.devices.length; i++) { + for(var x = 0; x < bridgeService.state.veradevices.length; x++) { + if(bridgeService.state.veradevices[x].id == $scope.bulk.devices[i]) { + $scope.buildDeviceUrls(bridgeService.state.veradevices[x],dim_control); + $scope.addDevice(); + } + } + } + $scope.bulk = { devices: [] }; + }; + + $scope.toggleSelection = function toggleSelection(deviceId) { + var idx = $scope.bulk.devices.indexOf(deviceId); + + // is currently selected + if (idx > -1) { + $scope.bulk.devices.splice(idx, 1); + } + + // is newly selected + else { + $scope.bulk.devices.push(deviceId); + } + }; $scope.toggleButtons = function () { $scope.buttonsVisible = !$scope.buttonsVisible; diff --git a/src/main/resources/public/views/configuration.html b/src/main/resources/public/views/configuration.html index e7f8813..b9066d1 100644 --- a/src/main/resources/public/views/configuration.html +++ b/src/main/resources/public/views/configuration.html @@ -24,11 +24,12 @@
-

Current devices

+

Current devices ({{bridge.devices.length}})

+ @@ -45,6 +46,7 @@ + diff --git a/src/main/resources/public/views/harmonydevice.html b/src/main/resources/public/views/harmonydevice.html index 825a323..e26f3ea 100644 --- a/src/main/resources/public/views/harmonydevice.html +++ b/src/main/resources/public/views/harmonydevice.html @@ -46,14 +46,14 @@ diff --git a/src/main/resources/public/views/veradevice.html b/src/main/resources/public/views/veradevice.html index 0cc1bd5..ad0fad5 100644 --- a/src/main/resources/public/views/veradevice.html +++ b/src/main/resources/public/views/veradevice.html @@ -10,13 +10,14 @@
-

Vera Device List

+

Vera Device List ({{bridge.veradevices.length}})

  • For any Vera Device, use the action buttons to generate the device addition information below automatically. Then you can modify the name to anything you want that will be the keyword for Alexa. Click the 'Add Bridge Device' to finish that selection setup. - The 'Already Configured Vera Devices' list below will show what is already setup for your Vera.

    Also, use this select menu for which type of dim + The 'Already Configured Vera Devices' list below will show what is already setup for your Vera.

    +

    Also, use this select menu for which type of dim control you would like to be generated:

    +

    Use the check boxes by the names to use the bulk addition feature. Select your items and dim control type if wanted, then click bulk add below. + Your items will be added with on and off or dim and off if selected with the name of the device from the Vera. +

Row ID
{{$index+1}} {{device.id}} {{device.name}} {{device.deviceType}}
+ - + + @@ -59,6 +65,10 @@
Row Name @@ -48,7 +53,8 @@
{{veradevice.name}}{{$index+1}} {{veradevice.name}} {{veradevice.id}} {{veradevice.category}} {{veradevice.room}}
+

+ +