diff --git a/README.md b/README.md index 7bab477..bf5c499 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ To customize and build it yourself, build a new jar with maven: ``` mvn install ``` -Otherwise go to http://www.bwssystems.com/apps.html to download the latest jar file. +Otherwise, downloads are available at https://github.com/bwssytems/ha-bridge/releases. ## Run Then locate the jar and start the server with: ``` @@ -22,6 +22,12 @@ The server defaults to running on port 8080. If you're already running a server The default location for the db to contain the devices as they are added is "data/devices.db". If you would like a different filename or directory, specify -Dupnp.devices.db=`/ or ` if it is the same directory. ### -Dupnp.response.port=`` The upnp response port that will be used. The default is 50000. +### -Dharmony.address=`` +The argument for the Harmony Hub address should be given as the system does not have a way to find the address. Supply -Dharmony.address=X.Y.Z.A on the command line to provide it. If a Harmony Hub is not used, do not set it. +### -Dharmony.user=`` +The user name of the MyHarmony.com account for the Harmony Hub. This needs to be given if you are using the Harmony Hub Features, provide -Dharmony.user=`` on the command line. +### -Dharmony.pwd=`` +The password for the user name of the MyHarmony.com account for the Harmony Hub. This needs to be given if you are using the Harmony Hub Features, provide -Dharmony.pwd=`` on the command line. ### -Dupnp.strict=`` Upnp has been very closed on this platform to try and respond as a hue and there is now a setting to control if it is more open or strict, Add -Dupnp.strict=`` to your command line to have the emulator respond to what it thinks is an echo to a hue or any other device. The default is upnp.strict=true. ### -Dtrace.upnp=`` diff --git a/pom.xml b/pom.xml index 68a8d45..ae5b873 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bwssystems.HABridge ha-bridge - 0.4.10 + 1.0.0 jar HA Bridge diff --git a/src/main/java/com/bwssystems/HABridge/BridgeSettings.java b/src/main/java/com/bwssystems/HABridge/BridgeSettings.java index 5bfe787..ab38394 100644 --- a/src/main/java/com/bwssystems/HABridge/BridgeSettings.java +++ b/src/main/java/com/bwssystems/HABridge/BridgeSettings.java @@ -6,6 +6,9 @@ public class BridgeSettings { private String upnpresponseport; private String upnpdevicedb; private String veraaddress; + private String harmonyaddress; + private String harmonyuser; + private String harmonypwd; private boolean upnpstrict; private boolean traceupnp; private boolean vtwocompatibility; @@ -41,6 +44,24 @@ public class BridgeSettings { this.veraaddress = veraAddress; } + public String getHarmonyAddress() { + return harmonyaddress; + } + public void setHarmonyAddress(String harmonyaddress) { + this.harmonyaddress = harmonyaddress; + } + public String getHarmonyUser() { + return harmonyuser; + } + public void setHarmonyUser(String harmonyuser) { + this.harmonyuser = harmonyuser; + } + public String getHarmonyPwd() { + return harmonypwd; + } + public void setHarmonyPwd(String harmonypwd) { + this.harmonypwd = harmonypwd; + } public boolean isUpnpStrict() { return upnpstrict; } @@ -66,4 +87,9 @@ public class BridgeSettings { return false; return true; } + public Boolean isValidHarmony() { + if(this.harmonyaddress.contains(Configuration.DEFAULT_HARMONY_ADDRESS)) + return false; + return true; + } } diff --git a/src/main/java/com/bwssystems/HABridge/Configuration.java b/src/main/java/com/bwssystems/HABridge/Configuration.java index a080cce..c07ceee 100644 --- a/src/main/java/com/bwssystems/HABridge/Configuration.java +++ b/src/main/java/com/bwssystems/HABridge/Configuration.java @@ -4,5 +4,8 @@ public class Configuration { public final static String DEVICE_DB_DIRECTORY = "data/device.db"; public final static String UPNP_RESPONSE_PORT = "50000"; public final static String DEFAULT_VERA_ADDRESS = "1.1.1.1"; + public final static String DEFAULT_HARMONY_ADDRESS = "1.1.1.1"; + public final static String DEFAULT_HARMONY_USER = ""; + public final static String DEFAULT_HARMONY_PWD = ""; public final static String DFAULT_WEB_PORT = "8080"; } diff --git a/src/main/java/com/bwssystems/HABridge/HABridge.java b/src/main/java/com/bwssystems/HABridge/HABridge.java index bfda0d6..7ad58e8 100644 --- a/src/main/java/com/bwssystems/HABridge/HABridge.java +++ b/src/main/java/com/bwssystems/HABridge/HABridge.java @@ -40,7 +40,7 @@ public class HABridge { String addressString; BridgeSettings bridgeSettings; - log.info("HA Bridge (v0.4.10) starting setup...."); + log.info("HA Bridge (v1.0.0) starting setup...."); //get ip address for upnp requests try { address = InetAddress.getLocalHost(); @@ -55,6 +55,9 @@ public class HABridge { bridgeSettings.setUpnpDeviceDb(System.getProperty("upnp.device.db", Configuration.DEVICE_DB_DIRECTORY)); bridgeSettings.setUpnpResponsePort(System.getProperty("upnp.response.port", Configuration.UPNP_RESPONSE_PORT)); bridgeSettings.setVeraAddress(System.getProperty("vera.address", Configuration.DEFAULT_VERA_ADDRESS)); + bridgeSettings.setHarmonyAddress(System.getProperty("harmony.address", Configuration.DEFAULT_HARMONY_ADDRESS)); + bridgeSettings.setHarmonyUser(System.getProperty("harmony.user", Configuration.DEFAULT_HARMONY_USER)); + bridgeSettings.setHarmonyPwd(System.getProperty("harmony.pwd", Configuration.DEFAULT_HARMONY_PWD)); bridgeSettings.setUpnpStrict(Boolean.parseBoolean(System.getProperty("upnp.strict", "true"))); bridgeSettings.setTraceupnp(Boolean.parseBoolean(System.getProperty("trace.upnp", "false"))); bridgeSettings.setVtwocompatibility(Boolean.parseBoolean(System.getProperty("vtwo.compatibility", "false"))); diff --git a/src/main/java/com/bwssystems/harmony/HarmonyActivities.java b/src/main/java/com/bwssystems/harmony/HarmonyActivities.java new file mode 100644 index 0000000..8b4de6f --- /dev/null +++ b/src/main/java/com/bwssystems/harmony/HarmonyActivities.java @@ -0,0 +1,5 @@ +package com.bwssystems.harmony; + +public class HarmonyActivities { + +} diff --git a/src/main/resources/public/index.html b/src/main/resources/public/index.html index 4faf09c..784e60f 100644 --- a/src/main/resources/public/index.html +++ b/src/main/resources/public/index.html @@ -36,7 +36,7 @@ diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index 8d3b264..e3b4493 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -4,8 +4,11 @@ var app = angular.module('habridge', [ app.config(function ($routeProvider) { $routeProvider.when('/#', { - templateUrl: 'views/configuration.html', + templateUrl: 'views/nonconfiguration.html', controller: 'ViewingController' + }).when('/show', { + templateUrl: 'views/configuration.html', + controller: 'ViewingController' }).when('/editor', { templateUrl: 'views/editor.html', controller: 'AddingController' @@ -18,8 +21,11 @@ app.config(function ($routeProvider) { }).when('/verascenes', { templateUrl: 'views/verascene.html', controller: 'AddingController' + }).when('/harmonyactivities', { + templateUrl: 'views/harmonyactivity.html', + controller: 'AddingController' }).otherwise({ - templateUrl: 'views/configuration.html', + templateUrl: 'views/nonconfiguration.html', controller: 'ViewingController' }) }); @@ -37,6 +43,7 @@ app.factory('BridgeSettings', function() { BridgeSettings.upnpdevicedb = ""; BridgeSettings.upnpresponseport = ""; BridgeSettings.veraaddress = ""; + BridgeSettings.harmonyaddress = ""; BridgeSettings.upnpstrict = ""; BridgeSettings.traceupnp = ""; BridgeSettings.vtwocompatibility = ""; @@ -60,6 +67,9 @@ app.factory('BridgeSettings', function() { BridgeSettings.setveraaddress = function(averaaddress){ BridgeSettings.veraaddress = averaaddress; }; + BridgeSettings.setharmonyaddress = function(aharmonyaddress){ + BridgeSettings.harmonyaddress = aharmonyaddress; + }; BridgeSettings.setupnpstrict = function(aupnpstrict){ BridgeSettings.upnpstrict = aupnpstrict; }; @@ -76,7 +86,7 @@ app.factory('BridgeSettings', function() { app.service('bridgeService', function ($http, $window, BridgeSettings) { var self = this; self.BridgeSettings = BridgeSettings; - this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", devices: [], device: [], error: "", showVera: false}; + this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", devices: [], device: [], error: "", showVera: false, showHarmony: false}; this.viewDevices = function () { this.state.error = ""; @@ -105,6 +115,7 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) { self.BridgeSettings.setupnpdevicedb(response.data.upnpdevicedb); self.BridgeSettings.setupnpresponseport(response.data.upnpresponseport); self.BridgeSettings.setveraaddress(response.data.veraaddress); + self.BridgeSettings.setharmonyaddress(response.data.harmonyaddress); self.BridgeSettings.settraceupnp(response.data.traceupnp); self.BridgeSettings.setupnpstrict(response.data.upnpstrict); self.BridgeSettings.setvtwocompatibility(response.data.vtwocompatibility); @@ -112,6 +123,10 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) { self.state.showVera = false; else self.state.showVera = true; + if(self.BridgeSettings.harmonyaddress == "1.1.1.1" || self.BridgeSettings.harmonyaddress == "") + self.state.showHarmony = false; + else + self.state.showHarmony = true; }, function (error) { if (error.data) { @@ -132,6 +147,14 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) { return; } + this.updateShowHarmony = function () { + if(self.BridgeSettings.harmonyaddress == "1.1.1.1" || self.BridgeSettings.harmonyaddress == "") + self.state.showHarmony = false; + else + self.state.showHarmony = true; + return; + } + this.viewVeraDevices = function () { this.state.error = ""; if(BridgeSettings.veraaddress == "1.1.1.1" || BridgeSettings.veraaddress == "") @@ -246,6 +269,7 @@ app.controller('ViewingController', function ($scope, $location, $http, $window, bridgeService.viewDevices(); $scope.bridge = bridgeService.state; bridgeService.updateShowVera(); + bridgeService.updateShowHarmony(); $scope.predicate = ''; $scope.reverse = true; $scope.order = function(predicate) { @@ -321,6 +345,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer bridgeService.viewVeraScenes(); $scope.bridge = bridgeService.state; bridgeService.updateShowVera(); + bridgeService.updateShowHarmony(); $scope.device = bridgeService.state.device; $scope.predicate = ''; $scope.reverse = true; @@ -397,6 +422,20 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer + verascene.id; }; + $scope.buildActivityUrls = function (harmonyactivity) { + if ($scope.vera.base.indexOf("http") < 0) { + $scope.vera.base = "http://" + $scope.vera.base; + } + $scope.device.deviceType = "scene"; + $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.testUrl = function (url) { if(type == "on") { if(device.httpVerb == "PUT") diff --git a/src/main/resources/public/views/configuration.html b/src/main/resources/public/views/configuration.html index c3a2c3b..e7ce2a2 100644 --- a/src/main/resources/public/views/configuration.html +++ b/src/main/resources/public/views/configuration.html @@ -2,72 +2,10 @@
  • Vera Devices
  • Vera Scenes
  • +
  • Harmony Activities
  • Manual Add
  • -
    -
    -

    Bridge settings

    -
    -
    - -
    -
    - - -
    - -
    - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SettingValue
    upnp.config.address{{BridgeSettings.upnpconfigaddress}}
    server.port{{BridgeSettings.serverport}}
    upnp.devices.db{{BridgeSettings.upnpdevicedb}}
    upnp.response.port{{BridgeSettings.upnpresponseport}}
    vera.address{{BridgeSettings.veraaddress}}
    upnp.strict{{BridgeSettings.upnpstrict}}
    trace.upnp{{BridgeSettings.traceupnp}}
    vtwo.compatibility{{BridgeSettings.vtwocompatibility}}
    -
    -
    -
    \ No newline at end of file +
    + +
    +
    + +

    Bridge settings

    +
    +
    + +
    +
    + + +
    + +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SettingValue
    upnp.config.address{{BridgeSettings.upnpconfigaddress}}
    server.port{{BridgeSettings.serverport}}
    upnp.devices.db{{BridgeSettings.upnpdevicedb}}
    upnp.response.port{{BridgeSettings.upnpresponseport}}
    vera.address{{BridgeSettings.veraaddress}}
    harmony.address{{BridgeSettings.harmonyaddress}}
    upnp.strict{{BridgeSettings.upnpstrict}}
    trace.upnp{{BridgeSettings.traceupnp}}
    vtwo.compatibility{{BridgeSettings.vtwocompatibility}}
    +
    +
    diff --git a/src/main/resources/public/views/editdevice.html b/src/main/resources/public/views/editdevice.html index 5e21f74..2db7b74 100644 --- a/src/main/resources/public/views/editdevice.html +++ b/src/main/resources/public/views/editdevice.html @@ -2,6 +2,7 @@
  • Configuration
  • Vera Devices
  • Vera Scenes
  • +
  • Harmony Activities
  • Manual Add
  • diff --git a/src/main/resources/public/views/editor.html b/src/main/resources/public/views/editor.html index 753eff5..906171e 100644 --- a/src/main/resources/public/views/editor.html +++ b/src/main/resources/public/views/editor.html @@ -2,10 +2,11 @@
  • Configuration
  • Vera Devices
  • Vera Scenes
  • +
  • Harmony Activities
  • -
    +

    Generate a new device/scene/control point

    diff --git a/src/main/resources/public/views/harmonyactivity.html b/src/main/resources/public/views/harmonyactivity.html new file mode 100644 index 0000000..7b4349a --- /dev/null +++ b/src/main/resources/public/views/harmonyactivity.html @@ -0,0 +1,158 @@ + + +
    +
    +

    Harmony Activity List

    +
    +
      +
    • +

      You can select a Harmony Activity and generate + the add activity box selections automatically.

      + + + + + + + + + + + + + + +
      + Name + + + Id + + Actions
      {{harmonyactivity.name}}{{harmonyactivity.id}} + +
      +
    • +
    +
    +
    +
    +

    Add a Harmony Activity

    +
    +
      +
    • +
      +
      + + +
      + +
      + +
      +
      +
      + + +
      + +
      +
      + +
      +
      +
      +
      + + +
      + +
      +
      + +
      +
      +
      +
      + + +
      + +
      +
      +
      +
      +
      + + +
      + +
      +
      +
      +
      +
      + + +
      + +
      +
      +
      +
      +
      +
      + + +
      + +
      +
      +
      +
      +
      +
    • +
    +
    diff --git a/src/main/resources/public/views/nonconfiguration.html b/src/main/resources/public/views/nonconfiguration.html new file mode 100644 index 0000000..3525ab9 --- /dev/null +++ b/src/main/resources/public/views/nonconfiguration.html @@ -0,0 +1,63 @@ + + +
    + +
    +
    +
    +

    Current devices

    +
    + + + + + + + + + + + + + + + +
    + ID + + Name + + Type + Actions
    {{device.id}}{{device.name}}{{device.deviceType}} + + + + +
    +
    +
    +
    + +

    Bridge settings

    +
    +
    \ No newline at end of file diff --git a/src/main/resources/public/views/veradevice.html b/src/main/resources/public/views/veradevice.html index 83755e8..f41f0f5 100644 --- a/src/main/resources/public/views/veradevice.html +++ b/src/main/resources/public/views/veradevice.html @@ -2,6 +2,7 @@
  • Configuration
  • Vera Scenes
  • +
  • Harmony Activities
  • Manual Add
  • diff --git a/src/main/resources/public/views/verascene.html b/src/main/resources/public/views/verascene.html index 7a6d7ae..fd32694 100644 --- a/src/main/resources/public/views/verascene.html +++ b/src/main/resources/public/views/verascene.html @@ -2,6 +2,7 @@
  • Configuration
  • Vera Devices
  • +
  • Harmony Activities
  • Manual Add
  • @@ -12,7 +13,7 @@
    • You can select a Vera scene and generate - the add device box selections automatically.

      + the add scene box selections automatically.