mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 16:17:30 +00:00
Vera device and scene creation testing and added Copy capability to add
an already configured device with a different name. Fixes #32 Fixes #38
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>1.3.6.a</version>
|
||||
<version>1.3.7</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
|
||||
@@ -38,7 +38,7 @@ app.run( function (bridgeService) {
|
||||
|
||||
app.service('bridgeService', function ($http, $window) {
|
||||
var self = this;
|
||||
this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", huebase: window.location.origin + "/api", backups: [], devices: [], device: [], settings: [], error: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""};
|
||||
this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", huebase: window.location.origin + "/api", backups: [], devices: [], device: [], settings: [], olddevicename: "", error: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""};
|
||||
|
||||
this.viewDevices = function () {
|
||||
this.state.error = "";
|
||||
@@ -386,6 +386,7 @@ app.service('bridgeService', function ($http, $window) {
|
||||
|
||||
this.editDevice = function (device) {
|
||||
self.state.device = device;
|
||||
self.state.olddevicename = device.name;
|
||||
};
|
||||
|
||||
this.testUrl = function (device, type) {
|
||||
@@ -507,6 +508,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
$scope.device.contentType = null;
|
||||
$scope.device.contentBody = null;
|
||||
$scope.device.contentBodyOff = null;
|
||||
$scope.bridge.olddevice.name = "";
|
||||
};
|
||||
|
||||
$scope.buildUrlsUsingDevice = function (dim_control) {
|
||||
@@ -700,6 +702,27 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
|
||||
};
|
||||
|
||||
$scope.copyDevice = function () {
|
||||
if($scope.device.name == "" && $scope.device.onUrl == "") {
|
||||
$scope.clearDevice();
|
||||
return;
|
||||
}
|
||||
|
||||
if($scope.device.name == $scope.bridge.olddevicename) {
|
||||
$scope.clearDevice();
|
||||
return;
|
||||
}
|
||||
$scope.device.id = null;
|
||||
bridgeService.addDevice($scope.device).then(
|
||||
function () {
|
||||
$scope.clearDevice();
|
||||
},
|
||||
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++) {
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<button class="btn btn-info" type="submit"
|
||||
ng-click="testUrl(device, 'off')">Test OFF</button>
|
||||
<button class="btn btn-warning" type="submit"
|
||||
ng-click="editDevice(device)">Edit</button>
|
||||
ng-click="editDevice(device)">Edit/Copy</button>
|
||||
<button class="btn btn-danger" type="submit"
|
||||
ng-click="deleteDevice(device)">Delete</button>
|
||||
</td>
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Edit a device</h2>
|
||||
<h2 class="panel-title">Edit/Copy a device</h2>
|
||||
</div>
|
||||
<p class="text-muted">This screen allows the modification of many fields the bridge uses. Please use care when
|
||||
updating these fields as you may break the settings used by the bridge to call a specific end point device.</p>
|
||||
<p>When copying, update the name and select the "Add Bridge Device" Button.</p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<form class="form-horizontal">
|
||||
@@ -26,7 +27,7 @@
|
||||
<input type="text" class="form-control" id="device-name"
|
||||
ng-model="device.name" placeholder="Device Name">
|
||||
</div>
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary" ng-click="addDevice()">
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-success" ng-click="addDevice()">
|
||||
Update Bridge Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -37,8 +38,8 @@
|
||||
<input type="text" class="form-control" id="device-target"
|
||||
ng-model="device.targetDevice" placeholder="default">
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
<button class="btn btn-primary" ng-click="copyDevice()">
|
||||
Add Bridge Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
@@ -56,6 +57,8 @@
|
||||
<option value="nestThermoSet">Nest Thermostat</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="device.mapType" class="form-group">
|
||||
|
||||
Reference in New Issue
Block a user