mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-16 18:24:36 +00:00
Added delete dialog for confirmation. Fixed bug with text in
intensity.byte for vera device tab. Fixed issue with parsing replies for http requests. Fixed Hue device bulk add. recommit Fixes #100 Fixes #102 Fixes #104 Fixes #105
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.bwssystems.HABridge</groupId>
|
||||
<artifactId>ha-bridge</artifactId>
|
||||
<version>2.0.3</version>
|
||||
<version>2.0.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
|
||||
@@ -752,8 +752,10 @@ public class HueMulator implements HueErrorStringSet {
|
||||
response = httpClient.execute(request);
|
||||
log.debug((httpVerb == null?"GET":httpVerb) + " execute on URL responded: " + response.getStatusLine().getStatusCode());
|
||||
if(response.getStatusLine().getStatusCode() >= 200 && response.getStatusLine().getStatusCode() < 300){
|
||||
theContent = EntityUtils.toString(response.getEntity(), Charset.forName("UTF-8")); //read content for data
|
||||
EntityUtils.consume(response.getEntity()); //close out inputstream ignore content
|
||||
if(response.getEntity() != null ) {
|
||||
theContent = EntityUtils.toString(response.getEntity(), Charset.forName("UTF-8")); //read content for data
|
||||
EntityUtils.consume(response.getEntity()); //close out inputstream ignore content
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.warn("Error calling out to HA gateway: IOException in log", e);
|
||||
|
||||
@@ -47,7 +47,7 @@ app.run( function (bridgeService) {
|
||||
|
||||
app.service('bridgeService', function ($http, $window, ngToast) {
|
||||
var self = this;
|
||||
this.state = {base: window.location.origin + "/api/devices", bridgelocation: window.location.origin, systemsbase: window.location.origin + "/system", huebase: window.location.origin + "/api", configs: [], backups: [], devices: [], device: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], olddevicename: "", logShowAll: false, isInControl: false, showVera: false, showHarmony: false, showNest: false, showHue: false, habridgeversion: ""};
|
||||
this.state = {base: window.location.origin + "/api/devices", bridgelocation: window.location.origin, systemsbase: window.location.origin + "/system", huebase: window.location.origin + "/api", configs: [], backups: [], devices: [], device: [], mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], olddevicename: "", logShowAll: false, isInControl: false, showVera: false, showHarmony: false, showNest: false, showHue: false, habridgeversion: ""};
|
||||
|
||||
this.displayWarn = function(errorTitle, error) {
|
||||
var toastContent = errorTitle;
|
||||
@@ -324,6 +324,7 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
||||
this.bulkAddDevice = function (devices) {
|
||||
return $http.post(this.state.base, devices).then(
|
||||
function (response) {
|
||||
self.displaySuccess("Bulk device add successful.");
|
||||
},
|
||||
function (error) {
|
||||
self.displayWarn("Bulk Add new Device Error: ", error);
|
||||
@@ -724,7 +725,12 @@ app.controller('ViewingController', function ($scope, $location, $http, $window,
|
||||
bridgeService.testUrl(device, type);
|
||||
};
|
||||
$scope.deleteDevice = function (device) {
|
||||
bridgeService.deleteDevice(device.id);
|
||||
$scope.bridge.device = device;
|
||||
ngDialog.open({
|
||||
template: 'deleteDialog',
|
||||
controller: 'DeleteDialogCtrl',
|
||||
className: 'ngdialog-theme-default'
|
||||
});
|
||||
};
|
||||
$scope.editDevice = function (device) {
|
||||
bridgeService.editDevice(device);
|
||||
@@ -789,7 +795,36 @@ app.controller('ValueDialogCtrl', function ($scope, bridgeService, ngDialog) {
|
||||
};
|
||||
});
|
||||
|
||||
app.controller('VeraController', function ($scope, $location, $http, bridgeService) {
|
||||
app.controller('DeleteDialogCtrl', function ($scope, bridgeService, ngDialog) {
|
||||
$scope.bridge = bridgeService.state;
|
||||
$scope.device = $scope.bridge.device;
|
||||
$scope.deleteDevice = function (device) {
|
||||
ngDialog.close('ngdialog1');
|
||||
bridgeService.deleteDevice(device.id);
|
||||
bridgeService.viewDevices();
|
||||
$scope.bridge.device = null;
|
||||
$scope.bridge.type = "";
|
||||
};
|
||||
});
|
||||
|
||||
app.controller('DeleteMapandIdDialogCtrl', function ($scope, bridgeService, ngDialog) {
|
||||
$scope.bridge = bridgeService.state;
|
||||
$scope.mapandid = $scope.bridge.mapandid;
|
||||
$scope.deleteMapandId = function (mapandid) {
|
||||
ngDialog.close('ngdialog1');
|
||||
bridgeService.deleteDeviceByMapId(mapandid.id, mapandid.mapType);
|
||||
bridgeService.viewDevices();
|
||||
bridgeService.viewVeraDevices();
|
||||
bridgeService.viewVeraScenes();
|
||||
bridgeService.viewHarmonyActivities();
|
||||
bridgeService.viewHarmonyDevices();
|
||||
bridgeService.viewNestItems();
|
||||
bridgeService.viewHueDevices();
|
||||
$scope.bridge.mapandid = null;
|
||||
};
|
||||
});
|
||||
|
||||
app.controller('VeraController', function ($scope, $location, $http, bridgeService, ngDialog) {
|
||||
$scope.bridge = bridgeService.state;
|
||||
$scope.device = $scope.bridge.device;
|
||||
$scope.device_dim_control = "";
|
||||
@@ -919,15 +954,17 @@ app.controller('VeraController', function ($scope, $location, $http, bridgeServi
|
||||
};
|
||||
|
||||
$scope.deleteDeviceByMapId = function (id, mapType) {
|
||||
bridgeService.deleteDeviceByMapId(id, mapType);
|
||||
bridgeService.viewDevices();
|
||||
bridgeService.viewVeraDevices();
|
||||
bridgeService.viewVeraScenes();
|
||||
$scope.bridge.mapandid = { id, mapType };
|
||||
ngDialog.open({
|
||||
template: 'deleteMapandIdDialog',
|
||||
controller: 'DeleteMapandIdDialogCtrl',
|
||||
className: 'ngdialog-theme-default'
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
app.controller('HarmonyController', function ($scope, $location, $http, bridgeService) {
|
||||
app.controller('HarmonyController', function ($scope, $location, $http, bridgeService, ngDialog) {
|
||||
$scope.bridge = bridgeService.state;
|
||||
$scope.device = $scope.bridge.device;
|
||||
bridgeService.viewHarmonyActivities();
|
||||
@@ -996,15 +1033,17 @@ app.controller('HarmonyController', function ($scope, $location, $http, bridgeSe
|
||||
};
|
||||
|
||||
$scope.deleteDeviceByMapId = function (id, mapType) {
|
||||
bridgeService.deleteDeviceByMapId(id, mapType);
|
||||
bridgeService.viewDevices();
|
||||
bridgeService.viewHarmonyActivities();
|
||||
bridgeService.viewHarmonyDevices();
|
||||
$scope.bridge.mapandid = { id, mapType };
|
||||
ngDialog.open({
|
||||
template: 'deleteMapandIdDialog',
|
||||
controller: 'DeleteMapandIdDialogCtrl',
|
||||
className: 'ngdialog-theme-default'
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
app.controller('NestController', function ($scope, $location, $http, bridgeService) {
|
||||
app.controller('NestController', function ($scope, $location, $http, bridgeService, ngDialog) {
|
||||
$scope.bridge = bridgeService.state;
|
||||
$scope.device = $scope.bridge.device;
|
||||
bridgeService.viewNestItems();
|
||||
@@ -1116,14 +1155,17 @@ app.controller('NestController', function ($scope, $location, $http, bridgeServi
|
||||
};
|
||||
|
||||
$scope.deleteDeviceByMapId = function (id, mapType) {
|
||||
bridgeService.deleteDeviceByMapId(id, mapType);
|
||||
bridgeService.viewDevices();
|
||||
bridgeService.viewNestItems();
|
||||
$scope.bridge.mapandid = { id, mapType };
|
||||
ngDialog.open({
|
||||
template: 'deleteMapandIdDialog',
|
||||
controller: 'DeleteMapandIdDialogCtrl',
|
||||
className: 'ngdialog-theme-default'
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
app.controller('HueController', function ($scope, $location, $http, bridgeService) {
|
||||
app.controller('HueController', function ($scope, $location, $http, bridgeService, ngDialog) {
|
||||
$scope.bridge = bridgeService.state;
|
||||
$scope.device = $scope.bridge.device;
|
||||
$scope.bulk = { devices: [] };
|
||||
@@ -1168,7 +1210,7 @@ app.controller('HueController', function ($scope, $location, $http, bridgeServic
|
||||
var devicesList = [];
|
||||
for(var i = 0; i < $scope.bulk.devices.length; i++) {
|
||||
for(var x = 0; x < bridgeService.state.huedevices.length; x++) {
|
||||
if(bridgeService.state.huedevices[x].id == $scope.bulk.devices[i]) {
|
||||
if(bridgeService.state.huedevices[x].device.uniqueid == $scope.bulk.devices[i]) {
|
||||
$scope.buildDeviceUrls(bridgeService.state.huedevices[x]);
|
||||
devicesList[i] = {
|
||||
name: $scope.device.name,
|
||||
@@ -1217,9 +1259,12 @@ app.controller('HueController', function ($scope, $location, $http, bridgeServic
|
||||
};
|
||||
|
||||
$scope.deleteDeviceByMapId = function (id, mapType) {
|
||||
bridgeService.deleteDeviceByMapId(id, mapType);
|
||||
bridgeService.viewDevices();
|
||||
bridgeService.viewHueDevices();
|
||||
$scope.bridge.mapandid = { id, mapType };
|
||||
ngDialog.open({
|
||||
template: 'deleteMapandIdDialog',
|
||||
controller: 'DeleteMapandIdDialogCtrl',
|
||||
className: 'ngdialog-theme-default'
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -103,4 +103,14 @@
|
||||
<button type="button" class="ngdialog-button ngdialog-button-primary" ng-click="setValue()">Set</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/ng-template" id="deleteDialog">
|
||||
<div class="ngdialog-message">
|
||||
<h2>Device to Delete?</h2>
|
||||
<p>{{device.name}}</p>
|
||||
<p>Are you Sure?</p>
|
||||
</div>
|
||||
<div class="ngdialog-buttons mt">
|
||||
<button type="button" class="ngdialog-button ngdialog-button-error" ng-click="deleteDevice(device)">Delete</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<li role="presentation"><a href="#/editor">Manual Add</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Harmony Activity List</h2>
|
||||
</div>
|
||||
@@ -75,7 +75,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Add a Bridge Device for a Harmony Activity</h2>
|
||||
</div>
|
||||
@@ -121,3 +121,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/ng-template" id="deleteMapandIdDialog">
|
||||
<div class="ngdialog-message">
|
||||
<h2>Device Map and Id?</h2>
|
||||
<p>{{mapandid.mapType}} with {{mapandid.id}}</p>
|
||||
<p>Are you Sure?</p>
|
||||
</div>
|
||||
<div class="ngdialog-buttons mt">
|
||||
<button type="button" class="ngdialog-button ngdialog-button-error" ng-click="deleteMapandId(mapandid)">Delete</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<li role="presentation"><a href="#/editor">Manual Add</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Harmony Device List</h2>
|
||||
</div>
|
||||
@@ -96,7 +96,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Add a Bridge Device for Harmony Buttons</h2>
|
||||
</div>
|
||||
@@ -142,3 +142,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/ng-template" id="deleteMapandIdDialog">
|
||||
<div class="ngdialog-message">
|
||||
<h2>Device Map and Id?</h2>
|
||||
<p>{{mapandid.mapType}} with {{mapandid.id}}</p>
|
||||
<p>Are you Sure?</p>
|
||||
</div>
|
||||
<div class="ngdialog-buttons mt">
|
||||
<button type="button" class="ngdialog-button ngdialog-button-error" ng-click="deleteMapandId(mapandid)">Delete</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<li role="presentation"><a href="#/editor">Manual Add</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Hue Device List ({{bridge.huedevices.length}})</h2>
|
||||
</div>
|
||||
@@ -36,7 +36,7 @@
|
||||
</thead>
|
||||
<tr ng-repeat="huedevice in bridge.huedevices | availableHueDeviceId">
|
||||
<td>{{$index+1}}</td>
|
||||
<td><input type="checkbox" name="bulk.devices[]" value="{{huedevice.id}}" ng-checked="bulk.devices.indexOf(huedevice.id) > -1" ng-click="toggleSelection(huedevice.id)"> {{huedevice.device.name}}</td>
|
||||
<td><input type="checkbox" name="bulk.devices[]" value="{{huedevice.device.uniqueid}}" ng-checked="bulk.devices.indexOf(huedevice.device.uniqueid) > -1" ng-click="toggleSelection(huedevice.device.uniqueid)"> {{huedevice.device.name}}</td>
|
||||
<td>{{huedevice.device.uniqueid}}</td>
|
||||
<td>{{huedevice.huename}}</td>
|
||||
<td>
|
||||
@@ -48,7 +48,7 @@
|
||||
</scrollable-table>
|
||||
<p>
|
||||
<button class="btn btn-success" type="submit"
|
||||
ng-click="bulkHueDevices()">Bulk Add ({{bulk.devices.length}})</button>
|
||||
ng-click="bulkAddDevices()">Bulk Add ({{bulk.devices.length}})</button>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -75,7 +75,7 @@
|
||||
<td>{{huedevice.huename}}</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" type="submit"
|
||||
ng-click="deleteDeviceByMapId(huedevice.uniqueid, 'hueDevice')">Delete</button>
|
||||
ng-click="deleteDeviceByMapId(huedevice.device.uniqueid, 'hueDevice')">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -83,7 +83,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Add Bridge Device for a Hue Device</h2>
|
||||
</div>
|
||||
@@ -117,3 +117,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/ng-template" id="deleteMapandIdDialog">
|
||||
<div class="ngdialog-message">
|
||||
<h2>Device Map and Id?</h2>
|
||||
<p>{{mapandid.mapType}} with {{mapandid.id}}</p>
|
||||
<p>Are you Sure?</p>
|
||||
</div>
|
||||
<div class="ngdialog-buttons mt">
|
||||
<button type="button" class="ngdialog-button ngdialog-button-error" ng-click="deleteMapandId(mapandid)">Delete</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<li role="presentation"><a href="#/editor">Manual Add</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Nest Items List</h2>
|
||||
</div>
|
||||
@@ -97,7 +97,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Add a Bridge Device for a Nest Item</h2>
|
||||
</div>
|
||||
@@ -143,3 +143,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/ng-template" id="deleteMapandIdDialog">
|
||||
<div class="ngdialog-message">
|
||||
<h2>Device Map and Id?</h2>
|
||||
<p>{{mapandid.mapType}} with {{mapandid.id}}</p>
|
||||
<p>Are you Sure?</p>
|
||||
</div>
|
||||
<div class="ngdialog-buttons mt">
|
||||
<button type="button" class="ngdialog-button ngdialog-button-error" ng-click="deleteMapandId(mapandid)">Delete</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<li role="presentation"><a href="#/editor">Manual Add</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Vera Device List ({{bridge.veradevices.length}})</h2>
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@
|
||||
control you would like to be generated:
|
||||
<select name="device-dim-control" id="device-dim-control" ng-model="device_dim_control">
|
||||
<option value="">none</option>
|
||||
<option value="${intensity..byte}">Pass-thru Value</option>
|
||||
<option value="${intensity.byte}">Pass-thru Value</option>
|
||||
<option value="${intensity.percent}">Percentage</option>
|
||||
<option value="${intensity.math(X*1)}">Custom Math</option>
|
||||
</select>
|
||||
@@ -100,7 +100,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Add Bridge Device for a Vera Device</h2>
|
||||
</div>
|
||||
@@ -155,3 +155,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/ng-template" id="deleteMapandIdDialog">
|
||||
<div class="ngdialog-message">
|
||||
<h2>Device Map and Id?</h2>
|
||||
<p>{{mapandid.mapType}} with {{mapandid.id}}</p>
|
||||
<p>Are you Sure?</p>
|
||||
</div>
|
||||
<div class="ngdialog-buttons mt">
|
||||
<button type="button" class="ngdialog-button ngdialog-button-error" ng-click="deleteMapandId(mapandid)">Delete</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<li role="presentation"><a href="#/editor">Manual Add</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Vera Scene List</h2>
|
||||
</div>
|
||||
@@ -81,7 +81,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Add a Bridge Device for a Vera scene</h2>
|
||||
</div>
|
||||
@@ -125,3 +125,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/ng-template" id="deleteMapandIdDialog">
|
||||
<div class="ngdialog-message">
|
||||
<h2>Device Map and Id?</h2>
|
||||
<p>{{mapandid.mapType}} with {{mapandid.id}}</p>
|
||||
<p>Are you Sure?</p>
|
||||
</div>
|
||||
<div class="ngdialog-buttons mt">
|
||||
<button type="button" class="ngdialog-button ngdialog-button-error" ng-click="deleteMapandId(mapandid)">Delete</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user