-
+
+
Bridge settings
-
+
+
+
+
+ | Setting |
+ Value |
+
+
+
+ | upnp.config.address |
+ {{bridge.upnpconfigaddress}} |
+
+
+ | server.port |
+ {{bridge.serverport}} |
+
+
+ | upnp.devices.db |
+ {{bridge.upnpdevicedb}} |
+
+
+ | upnp.response.port |
+ {{bridge.upnpresponseport}} |
+
+
+ | vera.address |
+ {{bridge.veraaddress}} |
+
+
+
+
@@ -95,17 +142,85 @@
-
+
|
-
-
+
-
-
Add a new device
+
+
+
+
Vera Device List
+
+
+
+
+
+
Vera Scene List
+
+
+
+
+
+
Generate a new device
+
-
You can generate on/off URLs by filling in the Vera server URL, port, and
@@ -115,10 +230,14 @@
+
+
+
+
-
\ No newline at end of file
diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js
index d0fe47b..1eae50a 100644
--- a/src/main/resources/public/scripts/app.js
+++ b/src/main/resources/public/scripts/app.js
@@ -1,7 +1,7 @@
-angular.module('amazonechobridge', [])
+angular.module('habridge', [])
.service('bridgeService', ["$http", function ($http) {
var self = this;
- this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/configaddress", devices: [], error: ""};
+ this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", devices: [], error: ""};
this.viewDevices = function () {
this.state.error = "";
@@ -21,11 +21,51 @@ angular.module('amazonechobridge', [])
);
};
- this.viewConfigAddress = function () {
+ this.viewBridgeSettings = function () {
this.state.error = "";
return $http.get(this.state.upnpbase).then(
function (response) {
- self.state.upnpconfigaddress = response.data;
+ self.state.upnpconfigaddress = response.data.upnpconfigaddress;
+ self.state.serverport = response.data.serverport;
+ self.state.upnpdevicedb = response.data.upnpdevicedb;
+ self.state.upnpresponseport = response.data.upnpresponseport;
+ self.state.veraaddress = response.data.veraaddress;
+ },
+ function (error) {
+ if (error.data) {
+ self.state.error = error.data.message;
+ } else {
+ self.state.error = "If you're not seeing any address, you may be running into problems with CORS. " +
+ "You can work around this by running a fresh launch of Chrome with the --disable-web-security flag.";
+ }
+ console.log(error);
+ }
+ );
+ };
+
+ this.viewVeraDevices = function () {
+ this.state.error = "";
+ return $http.get(this.state.base + "/vera/devices").then(
+ function (response) {
+ self.state.veradevices = response.data;
+ },
+ function (error) {
+ if (error.data) {
+ self.state.error = error.data.message;
+ } else {
+ self.state.error = "If you're not seeing any address, you may be running into problems with CORS. " +
+ "You can work around this by running a fresh launch of Chrome with the --disable-web-security flag.";
+ }
+ console.log(error);
+ }
+ );
+ };
+
+ this.viewVeraScenes = function () {
+ this.state.error = "";
+ return $http.get(this.state.base + "/vera/scenes").then(
+ function (response) {
+ self.state.verascenes = response.data;
},
function (error) {
if (error.data) {
@@ -105,7 +145,9 @@ angular.module('amazonechobridge', [])
.controller('ViewingController', ["$scope", "bridgeService", function ($scope, bridgeService) {
bridgeService.viewDevices();
- bridgeService.viewConfigAddress();
+ bridgeService.viewBridgeSettings();
+ bridgeService.viewVeraDevices();
+ bridgeService.viewVeraScenes();
$scope.bridge = bridgeService.state;
$scope.deleteDevice = function (device) {
bridgeService.deleteDevice(device.id);
@@ -123,12 +165,10 @@ angular.module('amazonechobridge', [])
}])
.controller('AddingController', ["$scope", "bridgeService", function ($scope, bridgeService) {
-
- $scope.bridge = bridgeService.state;
$scope.device = {id: "", name: "", type: "switch", onUrl: "", offUrl: ""};
$scope.vera = {base: "", port: "3480", id: ""};
bridgeService.device = $scope.device;
-
+
$scope.buildUrls = function () {
if ($scope.vera.base.indexOf("http") < 0) {
$scope.vera.base = "http://" + $scope.vera.base;
@@ -141,6 +181,36 @@ angular.module('amazonechobridge', [])
+ $scope.vera.id;
};
+ $scope.buildDeviceUrls = function (veradevice, veraaddr) {
+ if ($scope.vera.base.indexOf("http") < 0) {
+ $scope.vera.base = "http://" + veraaddr;
+ }
+ $scope.device.name = veradevice.name;
+ $scope.device.onUrl = $scope.vera.base + ":" + $scope.vera.port
+ + "/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum="
+ + veradevice.id;
+ $scope.device.offUrl = $scope.vera.base + ":" + $scope.vera.port
+ + "/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum="
+ + veradevice.id;
+ };
+
+ $scope.buildSceneUrls = function (verascene, veraaddr) {
+ if ($scope.vera.base.indexOf("http") < 0) {
+ $scope.vera.base = "http://" + veraaddr;
+ }
+ $scope.device.name = verascene.name;
+ $scope.device.onUrl = $scope.vera.base + ":" + $scope.vera.port
+ + "/data_request?id=action&output_format=json&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="
+ + verascene.id;
+ $scope.device.offUrl = $scope.vera.base + ":" + $scope.vera.port
+ + "/data_request?id=action&output_format=json&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="
+ + verascene.id;
+ };
+
+ $scope.setVeraAddress = function (anAddress) {
+ $scope.vera.base = "http://" + anAddress;
+ };
+
$scope.testUrl = function (url) {
window.open(url, "_blank");
};
@@ -157,6 +227,7 @@ angular.module('amazonechobridge', [])
}
);
}
+
}])
.controller('ErrorsController', ["$scope", "bridgeService", function ($scope, bridgeService) {
diff --git a/src/test/java/demo/DemoApplicationTests.java b/src/test/java/demo/DemoApplicationTests.java
index 52e7037..9170ac6 100644
--- a/src/test/java/demo/DemoApplicationTests.java
+++ b/src/test/java/demo/DemoApplicationTests.java
@@ -1,6 +1,6 @@
package demo;
-import com.bwssytems.HABridge.AmazonEchoBridge;
+import com.bwssystems.HABridge.HABridge;
/*
* Dummy test holder