Compare commits

..

2 Commits

Author SHA1 Message Date
Admin
c773477a43 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
2016-05-04 11:45:51 -05:00
BWS Systems
5d1f0ce3b6 update versions in unit file 2016-05-02 15:41:01 -05:00
11 changed files with 158 additions and 41 deletions

View File

@@ -35,7 +35,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/amazon-echo/data/habridge.config /home/pi/amazon-echo/ha-bridge-2.0.0.jar ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/amazon-echo/data/habridge.config /home/pi/amazon-echo/ha-bridge-2.0.3.jar
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId> <groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId> <artifactId>ha-bridge</artifactId>
<version>2.0.3</version> <version>2.0.4</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>HA Bridge</name> <name>HA Bridge</name>

View File

@@ -752,8 +752,10 @@ public class HueMulator implements HueErrorStringSet {
response = httpClient.execute(request); response = httpClient.execute(request);
log.debug((httpVerb == null?"GET":httpVerb) + " execute on URL responded: " + response.getStatusLine().getStatusCode()); log.debug((httpVerb == null?"GET":httpVerb) + " execute on URL responded: " + response.getStatusLine().getStatusCode());
if(response.getStatusLine().getStatusCode() >= 200 && response.getStatusLine().getStatusCode() < 300){ if(response.getStatusLine().getStatusCode() >= 200 && response.getStatusLine().getStatusCode() < 300){
theContent = EntityUtils.toString(response.getEntity(), Charset.forName("UTF-8")); //read content for data if(response.getEntity() != null ) {
EntityUtils.consume(response.getEntity()); //close out inputstream ignore content 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) { } catch (IOException e) {
log.warn("Error calling out to HA gateway: IOException in log", e); log.warn("Error calling out to HA gateway: IOException in log", e);

View File

@@ -47,7 +47,7 @@ app.run( function (bridgeService) {
app.service('bridgeService', function ($http, $window, ngToast) { app.service('bridgeService', function ($http, $window, ngToast) {
var self = this; 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) { this.displayWarn = function(errorTitle, error) {
var toastContent = errorTitle; var toastContent = errorTitle;
@@ -324,6 +324,7 @@ app.service('bridgeService', function ($http, $window, ngToast) {
this.bulkAddDevice = function (devices) { this.bulkAddDevice = function (devices) {
return $http.post(this.state.base, devices).then( return $http.post(this.state.base, devices).then(
function (response) { function (response) {
self.displaySuccess("Bulk device add successful.");
}, },
function (error) { function (error) {
self.displayWarn("Bulk Add new Device Error: ", 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); bridgeService.testUrl(device, type);
}; };
$scope.deleteDevice = function (device) { $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) { $scope.editDevice = function (device) {
bridgeService.editDevice(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.bridge = bridgeService.state;
$scope.device = $scope.bridge.device; $scope.device = $scope.bridge.device;
$scope.device_dim_control = ""; $scope.device_dim_control = "";
@@ -919,15 +954,17 @@ app.controller('VeraController', function ($scope, $location, $http, bridgeServi
}; };
$scope.deleteDeviceByMapId = function (id, mapType) { $scope.deleteDeviceByMapId = function (id, mapType) {
bridgeService.deleteDeviceByMapId(id, mapType); $scope.bridge.mapandid = { id, mapType };
bridgeService.viewDevices(); ngDialog.open({
bridgeService.viewVeraDevices(); template: 'deleteMapandIdDialog',
bridgeService.viewVeraScenes(); 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.bridge = bridgeService.state;
$scope.device = $scope.bridge.device; $scope.device = $scope.bridge.device;
bridgeService.viewHarmonyActivities(); bridgeService.viewHarmonyActivities();
@@ -996,15 +1033,17 @@ app.controller('HarmonyController', function ($scope, $location, $http, bridgeSe
}; };
$scope.deleteDeviceByMapId = function (id, mapType) { $scope.deleteDeviceByMapId = function (id, mapType) {
bridgeService.deleteDeviceByMapId(id, mapType); $scope.bridge.mapandid = { id, mapType };
bridgeService.viewDevices(); ngDialog.open({
bridgeService.viewHarmonyActivities(); template: 'deleteMapandIdDialog',
bridgeService.viewHarmonyDevices(); 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.bridge = bridgeService.state;
$scope.device = $scope.bridge.device; $scope.device = $scope.bridge.device;
bridgeService.viewNestItems(); bridgeService.viewNestItems();
@@ -1116,14 +1155,17 @@ app.controller('NestController', function ($scope, $location, $http, bridgeServi
}; };
$scope.deleteDeviceByMapId = function (id, mapType) { $scope.deleteDeviceByMapId = function (id, mapType) {
bridgeService.deleteDeviceByMapId(id, mapType); $scope.bridge.mapandid = { id, mapType };
bridgeService.viewDevices(); ngDialog.open({
bridgeService.viewNestItems(); 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.bridge = bridgeService.state;
$scope.device = $scope.bridge.device; $scope.device = $scope.bridge.device;
$scope.bulk = { devices: [] }; $scope.bulk = { devices: [] };
@@ -1168,7 +1210,7 @@ app.controller('HueController', function ($scope, $location, $http, bridgeServic
var devicesList = []; var devicesList = [];
for(var i = 0; i < $scope.bulk.devices.length; i++) { for(var i = 0; i < $scope.bulk.devices.length; i++) {
for(var x = 0; x < bridgeService.state.huedevices.length; x++) { 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]); $scope.buildDeviceUrls(bridgeService.state.huedevices[x]);
devicesList[i] = { devicesList[i] = {
name: $scope.device.name, name: $scope.device.name,
@@ -1217,9 +1259,12 @@ app.controller('HueController', function ($scope, $location, $http, bridgeServic
}; };
$scope.deleteDeviceByMapId = function (id, mapType) { $scope.deleteDeviceByMapId = function (id, mapType) {
bridgeService.deleteDeviceByMapId(id, mapType); $scope.bridge.mapandid = { id, mapType };
bridgeService.viewDevices(); ngDialog.open({
bridgeService.viewHueDevices(); template: 'deleteMapandIdDialog',
controller: 'DeleteMapandIdDialogCtrl',
className: 'ngdialog-theme-default'
});
}; };
}); });

View File

@@ -103,4 +103,14 @@
<button type="button" class="ngdialog-button ngdialog-button-primary" ng-click="setValue()">Set</button> <button type="button" class="ngdialog-button ngdialog-button-primary" ng-click="setValue()">Set</button>
</div> </div>
</script> </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>

View File

@@ -11,7 +11,7 @@
<li role="presentation"><a href="#/editor">Manual Add</a></li> <li role="presentation"><a href="#/editor">Manual Add</a></li>
</ul> </ul>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Harmony Activity List</h2> <h2 class="panel-title">Harmony Activity List</h2>
</div> </div>
@@ -75,7 +75,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Add a Bridge Device for a Harmony Activity</h2> <h2 class="panel-title">Add a Bridge Device for a Harmony Activity</h2>
</div> </div>
@@ -121,3 +121,13 @@
</li> </li>
</ul> </ul>
</div> </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>

View File

@@ -11,7 +11,7 @@
<li role="presentation"><a href="#/editor">Manual Add</a></li> <li role="presentation"><a href="#/editor">Manual Add</a></li>
</ul> </ul>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Harmony Device List</h2> <h2 class="panel-title">Harmony Device List</h2>
</div> </div>
@@ -96,7 +96,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Add a Bridge Device for Harmony Buttons</h2> <h2 class="panel-title">Add a Bridge Device for Harmony Buttons</h2>
</div> </div>
@@ -142,3 +142,13 @@
</li> </li>
</ul> </ul>
</div> </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>

View File

@@ -11,7 +11,7 @@
<li role="presentation"><a href="#/editor">Manual Add</a></li> <li role="presentation"><a href="#/editor">Manual Add</a></li>
</ul> </ul>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Hue Device List ({{bridge.huedevices.length}})</h2> <h2 class="panel-title">Hue Device List ({{bridge.huedevices.length}})</h2>
</div> </div>
@@ -36,7 +36,7 @@
</thead> </thead>
<tr ng-repeat="huedevice in bridge.huedevices | availableHueDeviceId"> <tr ng-repeat="huedevice in bridge.huedevices | availableHueDeviceId">
<td>{{$index+1}}</td> <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.device.uniqueid}}</td>
<td>{{huedevice.huename}}</td> <td>{{huedevice.huename}}</td>
<td> <td>
@@ -48,7 +48,7 @@
</scrollable-table> </scrollable-table>
<p> <p>
<button class="btn btn-success" type="submit" <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> </p>
</li> </li>
</ul> </ul>
@@ -75,7 +75,7 @@
<td>{{huedevice.huename}}</td> <td>{{huedevice.huename}}</td>
<td> <td>
<button class="btn btn-danger" type="submit" <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> </td>
</tr> </tr>
</table> </table>
@@ -83,7 +83,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Add Bridge Device for a Hue Device</h2> <h2 class="panel-title">Add Bridge Device for a Hue Device</h2>
</div> </div>
@@ -117,3 +117,13 @@
</li> </li>
</ul> </ul>
</div> </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>

View File

@@ -11,7 +11,7 @@
<li role="presentation"><a href="#/editor">Manual Add</a></li> <li role="presentation"><a href="#/editor">Manual Add</a></li>
</ul> </ul>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Nest Items List</h2> <h2 class="panel-title">Nest Items List</h2>
</div> </div>
@@ -97,7 +97,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Add a Bridge Device for a Nest Item</h2> <h2 class="panel-title">Add a Bridge Device for a Nest Item</h2>
</div> </div>
@@ -143,3 +143,13 @@
</li> </li>
</ul> </ul>
</div> </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>

View File

@@ -11,7 +11,7 @@
<li role="presentation"><a href="#/editor">Manual Add</a></li> <li role="presentation"><a href="#/editor">Manual Add</a></li>
</ul> </ul>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Vera Device List ({{bridge.veradevices.length}})</h2> <h2 class="panel-title">Vera Device List ({{bridge.veradevices.length}})</h2>
</div> </div>
@@ -24,7 +24,7 @@
control you would like to be generated: control you would like to be generated:
<select name="device-dim-control" id="device-dim-control" ng-model="device_dim_control"> <select name="device-dim-control" id="device-dim-control" ng-model="device_dim_control">
<option value="">none</option> <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.percent}">Percentage</option>
<option value="${intensity.math(X*1)}">Custom Math</option> <option value="${intensity.math(X*1)}">Custom Math</option>
</select> </select>
@@ -100,7 +100,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Add Bridge Device for a Vera Device</h2> <h2 class="panel-title">Add Bridge Device for a Vera Device</h2>
</div> </div>
@@ -155,3 +155,13 @@
</li> </li>
</ul> </ul>
</div> </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>

View File

@@ -11,7 +11,7 @@
<li role="presentation"><a href="#/editor">Manual Add</a></li> <li role="presentation"><a href="#/editor">Manual Add</a></li>
</ul> </ul>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Vera Scene List</h2> <h2 class="panel-title">Vera Scene List</h2>
</div> </div>
@@ -81,7 +81,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="panel panel-default bridgeServer" ng-if="!bridge.error"> <div class="panel panel-default bridgeServer">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Add a Bridge Device for a Vera scene</h2> <h2 class="panel-title">Add a Bridge Device for a Vera scene</h2>
</div> </div>
@@ -125,3 +125,13 @@
</li> </li>
</ul> </ul>
</div> </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>