Finished implementation for multiple vera support. Tweaks to the UI.

Fixes #19
Fixes #21
Fixes #23
Fixes #26
Fixes #28
Fixes #30
Fixes #31
This commit is contained in:
Admin
2016-01-28 16:39:20 -06:00
parent a6bb1ae3aa
commit 2565183ee9
16 changed files with 236 additions and 147 deletions

View File

@@ -14,8 +14,8 @@ java -jar -Dupnp.config.address=A.B.C.D -Dvera.address=E.F.G.H -Dharmony.addres
## Available Arguments
### -Dupnp.config.address=`<ip address>`
The server defaults to the first available address on the host if this is not given. This default may NOT be the correct IP that is your public IP for your host on the network. It is best to set this parameter to not have discovery issues. Replace the -Dupnp.config.address=`<ip address>` value with the server ipv4 address you would like to use as the address that any upnp device will call after discovery.
### -Dvera.address=`<ip address>`
The argument for the vera address should be given as it the system does not have a way to find the address. Supply -Dvera.address=X.Y.Z.A on the command line to provide it. If a vera is not used, do not set it.
### -Dvera.address=`<ip address>` | `<{devices:[{name:avera,ip:x.y.w.z},{name:anothervera,ip:a.b.c.d}]}>`
The argument for the vera address should be given as it the system does not have a way to find the address. Supply -Dvera.address=X.Y.Z.A on the command line to provide it. If a vera is not used, do not set it. To provide multiple veras, use the json style notation outlined above to provide the list. This argument is backwards compatible.
### -Dserver.port=`<port>`
The server defaults to running on port 8080. If you're already running a server (like openHAB) on 8080, -Dserver.port=`<port>` on the command line.
### -Dupnp.device.db=`<filepath>`
@@ -306,7 +306,9 @@ comment | string | Comment configured with device. Not always present.
"status":"0",
"level":"0",
"state":"-1",
"comment":""
"comment":"",
"veraname":"default",
"veraddress":"192.168.1.2"
},
{
"name":"Couch Right Lamp",
@@ -320,6 +322,8 @@ comment | string | Comment configured with device. Not always present.
"level":"0",
"state":"-1",
"comment":""
"veraname":"default",
"veraddress":"192.168.1.2"
}]
```
### Get Vera Scenes
@@ -340,12 +344,16 @@ room | string | Room name assigned to scene.
"name":"AccentLightsOff",
"id":"27",
"room":"no room"
"veraname":"default",
"veraddress":"192.168.1.2"
},
{
"active":"0",
"name":"AccentLightsOn",
"id":"26",
"room":"no room"
"veraname":"default",
"veraddress":"192.168.1.2"
}]
```
### Get Harmony Activities

View File

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

View File

@@ -7,7 +7,7 @@ public class BridgeSettings {
private String serverport;
private String upnpresponseport;
private String upnpdevicedb;
private String veraaddress;
private IpList veraaddress;
private IpList harmonyaddress;
private String harmonyuser;
private String harmonypwd;
@@ -43,10 +43,10 @@ public class BridgeSettings {
public void setUpnpDeviceDb(String upnpDeviceDb) {
this.upnpdevicedb = upnpDeviceDb;
}
public String getVeraAddress() {
public IpList getVeraAddress() {
return veraaddress;
}
public void setVeraAddress(String veraAddress) {
public void setVeraAddress(IpList veraAddress) {
this.veraaddress = veraAddress;
}
public IpList getHarmonyAddress() {
@@ -110,7 +110,8 @@ public class BridgeSettings {
this.nestconfigured = isNestConfigured;
}
public Boolean isValidVera() {
if(this.veraaddress.contains(Configuration.DEFAULT_ADDRESS))
List<NamedIP> devicesList = this.veraaddress.getDevices();
if(devicesList.get(0).getIp().contains(Configuration.DEFAULT_ADDRESS))
return false;
return true;
}

View File

@@ -89,7 +89,19 @@ 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_ADDRESS));
IpList theVeraList;
try {
theVeraList = new Gson().fromJson(System.getProperty("vera.address", Configuration.DEFAULT_HARMONY_ADDRESS_LIST), IpList.class);
} catch (Exception e) {
try {
theVeraList = new Gson().fromJson("{devices:[{name:default,ip:" + System.getProperty("vera.address", Configuration.DEFAULT_ADDRESS) + "}]}", IpList.class);
} catch (Exception et) {
log.error("Cannot parse vera.address, Exiting with message: " + e.getMessage(), e);
return;
}
}
bridgeSettings.setVeraAddress(theVeraList);
IpList theHarmonyList;
try {

View File

@@ -24,6 +24,7 @@ import com.bwssystems.HABridge.dao.DeviceRepository;
import com.bwssystems.NestBridge.NestHome;
import com.bwssystems.harmony.HarmonyHome;
import com.bwssystems.luupRequests.Sdata;
import com.bwssystems.vera.VeraHome;
import com.bwssystems.vera.VeraInfo;
import com.google.gson.Gson;
@@ -35,7 +36,7 @@ public class DeviceResource {
private static final Logger log = LoggerFactory.getLogger(DeviceResource.class);
private DeviceRepository deviceRepository;
private VeraInfo veraInfo;
private VeraHome veraHome;
private Version version;
private HarmonyHome myHarmonyHome;
private NestHome nestHome;
@@ -43,7 +44,12 @@ public class DeviceResource {
public DeviceResource(BridgeSettings theSettings, Version theVersion, HarmonyHome theHarmonyHome, NestHome aNestHome) {
this.deviceRepository = new DeviceRepository(theSettings.getUpnpDeviceDb());
this.veraInfo = new VeraInfo(theSettings.getVeraAddress(), theSettings.isValidVera());
if(theSettings.isValidVera())
this.veraHome = new VeraHome(theSettings);
else
this.veraHome = null;
if(theSettings.isValidHarmony())
this.myHarmonyHome = theHarmonyHome;
else
@@ -53,6 +59,7 @@ public class DeviceResource {
this.nestHome = aNestHome;
else
this.nestHome = null;
this.version = theVersion;
setupEndpoints();
}
@@ -175,25 +182,23 @@ public class DeviceResource {
get (API_CONTEXT + "/vera/devices", "application/json", (request, response) -> {
log.debug("Get vera devices");
Sdata sData = veraInfo.getSdata();
if(sData == null){
if(veraHome == null){
response.status(HttpStatus.SC_NOT_FOUND);
return null;
}
response.status(HttpStatus.SC_OK);
return sData.getDevices();
return veraHome.getDevices();
}, new JsonTransformer());
get (API_CONTEXT + "/vera/scenes", "application/json", (request, response) -> {
log.debug("Get vera scenes");
Sdata sData = veraInfo.getSdata();
if(sData == null){
if(veraHome == null){
response.status(HttpStatus.SC_NOT_FOUND);
return null;
}
response.status(HttpStatus.SC_OK);
return sData.getScenes();
return veraHome.getScenes();
}, new JsonTransformer());
get (API_CONTEXT + "/harmony/activities", "application/json", (request, response) -> {

View File

@@ -13,6 +13,8 @@ public class Device {
private String level;
private String state;
private String comment;
private String veraname;
private String veraaddress;
public String getName() {
return name;
}
@@ -79,5 +81,17 @@ public class Device {
public void setComment(String comment) {
this.comment = comment;
}
public String getVeraname() {
return veraname;
}
public void setVeraname(String veraname) {
this.veraname = veraname;
}
public String getVeraaddress() {
return veraaddress;
}
public void setVeraaddress(String veraaddress) {
this.veraaddress = veraaddress;
}
}

View File

@@ -5,6 +5,8 @@ public class Scene {
private String name;
private String id;
private String room;
private String veraname;
private String veraaddress;
public String getActive() {
return active;
}
@@ -29,5 +31,17 @@ public class Scene {
public void setRoom(String room) {
this.room = room;
}
public String getVeraname() {
return veraname;
}
public void setVeraname(String veraname) {
this.veraname = veraname;
}
public String getVeraaddress() {
return veraaddress;
}
public void setVeraaddress(String veraaddress) {
this.veraaddress = veraaddress;
}
}

View File

@@ -0,0 +1,58 @@
package com.bwssystems.vera;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.BridgeSettings;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.luupRequests.Device;
import com.bwssystems.luupRequests.Scene;
public class VeraHome {
private static final Logger log = LoggerFactory.getLogger(VeraHome.class);
private Map<String, VeraInfo> veras;
public VeraHome(BridgeSettings bridgeSettings) {
veras = new HashMap<String, VeraInfo>();
if(!bridgeSettings.isValidVera())
return;
Iterator<NamedIP> theList = bridgeSettings.getVeraAddress().getDevices().iterator();
while(theList.hasNext()) {
NamedIP aVera = theList.next();
veras.put(aVera.getName(), new VeraInfo(aVera, bridgeSettings.isValidVera()));
}
}
public List<Device> getDevices() {
log.debug("consolidating devices for veras");
Iterator<String> keys = veras.keySet().iterator();
ArrayList<Device> deviceList = new ArrayList<Device>();
while(keys.hasNext()) {
String key = keys.next();
Iterator<Device> devices = veras.get(key).getSdata().getDevices().iterator();
while(devices.hasNext()) {
deviceList.add(devices.next());
}
}
return deviceList;
}
public List<Scene> getScenes() {
log.debug("consolidating scenes for veras");
Iterator<String> keys = veras.keySet().iterator();
ArrayList<Scene> sceneList = new ArrayList<Scene>();
while(keys.hasNext()) {
String key = keys.next();
Iterator<Scene> scenes = veras.get(key).getSdata().getScenes().iterator();
while(scenes.hasNext()) {
sceneList.add(scenes.next());
}
}
return sceneList;
}
}

View File

@@ -13,6 +13,7 @@ import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.luupRequests.Categorie;
import com.bwssystems.luupRequests.Device;
import com.bwssystems.luupRequests.Room;
@@ -25,13 +26,13 @@ public class VeraInfo {
private static final Logger log = LoggerFactory.getLogger(VeraInfo.class);
private HttpClient httpClient;
private static final String SDATA_REQUEST = ":3480/data_request?id=sdata&output_format=json";
private String veraAddressString;
private NamedIP veraAddress;
private Boolean validVera;
public VeraInfo(String addressString, Boolean isValidVera) {
public VeraInfo(NamedIP addressName, Boolean isValidVera) {
super();
httpClient = HttpClients.createDefault();
veraAddressString = addressString;
veraAddress = addressName;
validVera = isValidVera;
}
@@ -39,7 +40,7 @@ public class VeraInfo {
if(!validVera)
return new Sdata();
String theUrl = "http://" + veraAddressString + SDATA_REQUEST;
String theUrl = "http://" + veraAddress.getIp() + SDATA_REQUEST;
String theData;
theData = doHttpGETRequest(theUrl);
@@ -71,6 +72,8 @@ public class VeraInfo {
theDevice.setCategory(categoryMap.get(theDevice.getCategory()).getName());
else
theDevice.setCategory("<unknown>");
theDevice.setVeraaddress(veraAddress.getIp());
theDevice.setVeraname(veraAddress.getName());
}
ListIterator<Scene> theSecneIter = theSdata.getScenes().listIterator();
@@ -81,6 +84,8 @@ public class VeraInfo {
theScene.setRoom(roomMap.get(theScene.getRoom()).getName());
else
theScene.setRoom("no room");
theScene.setVeraaddress(veraAddress.getIp());
theScene.setVeraname(veraAddress.getName());
}
}

View File

@@ -36,63 +36,9 @@ app.run( function (bridgeService) {
bridgeService.getHABridgeVersion();
});
app.factory('BridgeSettings', function() {
var BridgeSettings = {};
BridgeSettings.upnpconfigaddress = "";
BridgeSettings.serverport = "";
BridgeSettings.upnpdevicedb = "";
BridgeSettings.upnpresponseport = "";
BridgeSettings.veraaddress = "";
BridgeSettings.harmonyaddress = "";
BridgeSettings.upnpstrict = "";
BridgeSettings.traceupnp = "";
BridgeSettings.devmode = "";
BridgeSettings.nestconfigured = "";
BridgeSettings.setupnpconfigaddress = function(aconfigaddress){
BridgeSettings.upnpconfigaddress = aconfigaddress;
};
BridgeSettings.setserverport = function(aserverport){
BridgeSettings.serverport = aserverport;
};
BridgeSettings.setupnpdevicedb = function(aupnpdevicedb){
BridgeSettings.upnpdevicedb = aupnpdevicedb;
};
BridgeSettings.setupnpresponseport = function(aupnpresponseport){
BridgeSettings.upnpresponseport = aupnpresponseport;
};
BridgeSettings.setveraaddress = function(averaaddress){
BridgeSettings.veraaddress = averaaddress;
};
BridgeSettings.setharmonyaddress = function(aharmonyaddress){
BridgeSettings.harmonyaddress = aharmonyaddress;
};
BridgeSettings.setupnpstrict = function(aupnpstrict){
BridgeSettings.upnpstrict = aupnpstrict;
};
BridgeSettings.settraceupnp = function(atraceupnp){
BridgeSettings.traceupnp = atraceupnp;
};
BridgeSettings.setdevmode = function(adevmode){
BridgeSettings.devmode = adevmode;
};
BridgeSettings.setnestconfigured = function(anestconfigured){
BridgeSettings.nestconfigured = anestconfigured;
};
return BridgeSettings;
});
app.service('bridgeService', function ($http, $window, BridgeSettings) {
app.service('bridgeService', function ($http, $window) {
var self = this;
self.BridgeSettings = BridgeSettings;
this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", huebase: window.location.origin + "/api", backups: [], devices: [], device: [], 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: [], error: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""};
this.viewDevices = function () {
this.state.error = "";
@@ -133,7 +79,7 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
}
this.updateShowVera = function () {
if(this.aContainsB(self.BridgeSettings.veraaddress, "1.1.1.1") || self.BridgeSettings.veraaddress == "" || self.BridgeSettings.veraaddress == null)
if(this.aContainsB(self.state.settings.veraaddress.devices[0].ip, "1.1.1.1") || self.state.settings.veraaddress == "" || self.state.settings.veraaddress == null)
this.state.showVera = false;
else
this.state.showVera = true;
@@ -141,7 +87,7 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
}
this.updateShowNest = function () {
if(self.BridgeSettings.nestconfigured == true)
if(self.state.settings.nestconfigured == true)
this.state.showNest = true;
else
this.state.showNest = false;
@@ -149,8 +95,8 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
}
this.updateShowHarmony = function () {
if(self.BridgeSettings.harmonyaddress.devices) {
if(this.aContainsB(self.BridgeSettings.harmonyaddress.devices[0].ip, "1.1.1.1") || self.BridgeSettings.harmonyaddress == "" || self.BridgeSettings.harmonyaddress == null)
if(self.state.settings.harmonyaddress.devices) {
if(this.aContainsB(self.state.settings.harmonyaddress.devices[0].ip, "1.1.1.1") || self.state.settings.harmonyaddress == "" || self.state.settings.harmonyaddress == null)
this.state.showHarmony = false;
else
this.state.showHarmony = true;
@@ -165,16 +111,7 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
this.state.error = "";
return $http.get(this.state.upnpbase).then(
function (response) {
self.BridgeSettings.setupnpconfigaddress(response.data.upnpconfigaddress);
self.BridgeSettings.setserverport(response.data.serverport);
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.setdevmode(response.data.devmode);
self.BridgeSettings.setnestconfigured(response.data.nestconfigured);
self.state.settings = response.data;
self.updateShowVera();
self.updateShowHarmony();
self.updateShowNest();
@@ -316,6 +253,8 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
this.state.error = "";
if(device.httpVerb != null && device.httpVerb != "")
device.deviceType = "custom";
if(device.targetDevice == null || device.targetDevice == "")
device.targetDevice = "Encapsulated";
if (device.id) {
var putUrl = this.state.base + "/" + device.id;
return $http.put(putUrl, {
@@ -345,8 +284,6 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
} else {
if(device.deviceType == null || device.deviceType == "")
device.deviceType = "custom";
if(device.httpVerb != null && device.httpVerb != "")
device.deviceType = "custom";
return $http.post(this.state.base, {
name: device.name,
mapId: device.mapId,
@@ -477,9 +414,8 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
};
});
app.controller('ViewingController', function ($scope, $location, $http, $window, bridgeService, BridgeSettings) {
app.controller('ViewingController', function ($scope, $location, $http, $window, bridgeService) {
$scope.BridgeSettings = bridgeService.BridgeSettings;
bridgeService.viewDevices();
bridgeService.viewBackups();
$scope.bridge = bridgeService.state;
@@ -536,49 +472,48 @@ app.controller('ViewingController', function ($scope, $location, $http, $window,
};
});
app.controller('AddingController', function ($scope, $location, $http, bridgeService, BridgeSettings) {
$scope.device = {id: "", name: "", deviceType: "custom", onUrl: "", offUrl: ""};
$scope.clearDevice = function () {
$scope.device.id = "";
$scope.device.mapType = null;
$scope.device.mapId = null;
$scope.device.name = "";
$scope.device.onUrl = "";
$scope.device.deviceType = "custom";
$scope.device.targetDevice = null;
$scope.device.offUrl = "";
$scope.device.httpVerb = null;
$scope.device.contentType = null;
$scope.device.contentBody = null;
$scope.device.contentBodyOff = null;
};
$scope.clearDevice();
$scope.vera = {base: "", port: "3480", id: ""};
$scope.vera.base = "http://" + BridgeSettings.veraaddress;
app.controller('AddingController', function ($scope, $location, $http, bridgeService) {
$scope.bridge = bridgeService.state;
$scope.device = $scope.bridge.device;
$scope.device_dim_control = "";
$scope.bulk = { devices: [] };
$scope.vera = {base: "http://" + $scope.bridge.settings.veraaddress, port: "3480", id: ""};
bridgeService.viewVeraDevices();
bridgeService.viewVeraScenes();
bridgeService.viewHarmonyActivities();
bridgeService.viewHarmonyDevices();
bridgeService.viewNestItems();
$scope.bridge = bridgeService.state;
$scope.imgButtonsUrl = "glyphicon glyphicon-plus";
$scope.buttonsVisible = false;
$scope.predicate = '';
$scope.reverse = true;
$scope.device_dim_control = "";
$scope.bulk = { devices: [] };
$scope.order = function(predicate) {
$scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
$scope.predicate = predicate;
};
$scope.buildUrlsUsingDevice = function (dim_control) {
$scope.clearDevice = function () {
$scope.device.id = "";
$scope.device.mapType = null;
$scope.device.mapId = null;
$scope.device.name = "";
$scope.device.onUrl = "";
$scope.device.deviceType = "custom";
$scope.device.targetDevice = null;
$scope.device.offUrl = "";
$scope.device.httpVerb = null;
$scope.device.contentType = null;
$scope.device.contentBody = null;
$scope.device.contentBodyOff = null;
};
$scope.buildUrlsUsingDevice = function (dim_control) {
if ($scope.vera.base.indexOf("http") < 0) {
$scope.vera.base = "http://" + $scope.vera.base;
}
$scope.device.deviceType = "switch";
$scope.device.targetDevice = $scope.bridge.settings.veraaddress;
$scope.device.mapType = "veraDevice";
$scope.device.mapId = $scope.vera.id;
if(dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)
@@ -601,6 +536,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.vera.base = "http://" + $scope.vera.base;
}
$scope.device.deviceType = "scene";
$scope.device.targetDevice = $scope.bridge.settings.veraaddress;
$scope.device.mapType = "veraScene";
$scope.device.mapId = $scope.vera.id;
$scope.device.onUrl = $scope.vera.base + ":" + $scope.vera.port
@@ -617,6 +553,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
}
$scope.device.deviceType = "switch";
$scope.device.name = veradevice.name;
$scope.device.targetDevice = veradevice.veraname;
$scope.device.mapType = "veraDevice";
$scope.device.mapId = veradevice.id;
if(dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)
@@ -640,6 +577,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
}
$scope.device.deviceType = "scene";
$scope.device.name = verascene.name;
$scope.device.targetDevice = verascene.veraname;
$scope.device.mapType = "veraScene";
$scope.device.mapId = verascene.id;
$scope.device.onUrl = $scope.vera.base + ":" + $scope.vera.port
@@ -681,6 +619,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.buildNestHomeUrls = function (nestitem) {
$scope.device.deviceType = "home";
$scope.device.name = nestitem.name;
$scope.device.targetDevice = nestitem.name;
$scope.device.mapType = "nestHomeAway";
$scope.device.mapId = nestitem.id;
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"away\":false,\"control\":\"status\"}";
@@ -690,6 +629,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.buildNestTempUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Temperature";
$scope.device.targetDevice = nestitem.location;
$scope.device.mapType = "nestThermoSet";
$scope.device.mapId = nestitem.id + "-SetTemp";
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"temp\",\"temp\":\"${intensity.percent}\"}";
@@ -699,6 +639,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.buildNestHeatUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Heat";
$scope.device.targetDevice = nestitem.location;
$scope.device.mapType = "nestThermoSet";
$scope.device.mapId = nestitem.id + "-SetHeat";
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"heat\"}";
@@ -708,6 +649,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.buildNestCoolUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Cool";
$scope.device.targetDevice = nestitem.location;
$scope.device.mapType = "nestThermoSet";
$scope.device.mapId = nestitem.id + "-SetCool";
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"cool\"}";
@@ -717,6 +659,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.buildNestRangeUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Range";
$scope.device.targetDevice = nestitem.location;
$scope.device.mapType = "nestThermoSet";
$scope.device.mapId = nestitem.id + "-SetRange";
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"range\"}";
@@ -726,6 +669,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.buildNestOffUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Thermostat";
$scope.device.targetDevice = nestitem.location;
$scope.device.mapType = "nestThermoSet";
$scope.device.mapId = nestitem.id + "-TurnOff";
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"range\"}";
@@ -735,6 +679,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.buildNestFanUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Fan";
$scope.device.targetDevice = nestitem.location;
$scope.device.mapType = "nestThermoSet";
$scope.device.mapId = nestitem.id + "-SetFan";
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-on\"}";
@@ -750,18 +695,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
return;
bridgeService.addDevice($scope.device).then(
function () {
$scope.device.id = "";
$scope.device.mapType = null;
$scope.device.mapId = null;
$scope.device.name = "";
$scope.device.onUrl = "";
$scope.device.deviceType = "custom";
$scope.device.targetDevice = null;
$scope.device.offUrl = "";
$scope.device.httpVerb = null;
$scope.device.contentType = null;
$scope.device.contentBody = null;
$scope.device.contentBodyOff = null;
$scope.clearDevice();
},
function (error) {
}
@@ -843,7 +777,7 @@ app.filter('availableVeraDeviceId', function(bridgeService) {
if(input == null)
return out;
for (var i = 0; i < input.length; i++) {
if(!bridgeService.findDeviceByMapId(input[i].id, null, "veraDevice")){
if(!bridgeService.findDeviceByMapId(input[i].id, input[i].veraname, "veraDevice")){
out.push(input[i]);
}
}
@@ -857,7 +791,7 @@ return function(input) {
if(input == null)
return out;
for (var i = 0; i < input.length; i++) {
if(bridgeService.findDeviceByMapId(input[i].id, null, "veraDevice")){
if(bridgeService.findDeviceByMapId(input[i].id, input[i].veraname, "veraDevice")){
out.push(input[i]);
}
}
@@ -871,7 +805,7 @@ app.filter('availableVeraSceneId', function(bridgeService) {
if(input == null)
return out;
for (var i = 0; i < input.length; i++) {
if(!bridgeService.findDeviceByMapId(input[i].id, null, "veraScene")){
if(!bridgeService.findDeviceByMapId(input[i].id, input[i].veraname, "veraScene")){
out.push(input[i]);
}
}
@@ -885,7 +819,7 @@ return function(input) {
if(input == null)
return out;
for (var i = 0; i < input.length; i++) {
if(bridgeService.findDeviceByMapId(input[i].id, null, "veraScene")){
if(bridgeService.findDeviceByMapId(input[i].id,input[i].veraname, "veraScene")){
out.push(input[i]);
}
}

View File

@@ -67,7 +67,7 @@
<div class="panel panel-default bridgeServer">
<div class="panel-heading">
<h1 class="panel-title">Bridge settings <a ng-click="toggle()"><span class={{imgUrl}} aria-hidden="true"></a></h1>
<h1 class="panel-title">Bridge Settings <a ng-click="toggle()"><span class={{imgUrl}} aria-hidden="true"></a></h1>
</div>
<div ng-if="visible" class="animate-if" class="panel-body">
@@ -95,43 +95,43 @@
</thead>
<tr>
<td>upnp.config.address</td>
<td>{{BridgeSettings.upnpconfigaddress}}</td>
<td>{{bridge.settings.upnpconfigaddress}}</td>
</tr>
<tr>
<td>server.port</td>
<td>{{BridgeSettings.serverport}}</td>
<td>{{bridge.settings.serverport}}</td>
</tr>
<tr>
<td>upnp.devices.db</td>
<td>{{BridgeSettings.upnpdevicedb}}</td>
<td>{{bridge.settings.upnpdevicedb}}</td>
</tr>
<tr>
<td>upnp.response.port</td>
<td>{{BridgeSettings.upnpresponseport}}</td>
<td>{{bridge.settings.upnpresponseport}}</td>
</tr>
<tr>
<td>vera.address</td>
<td>{{BridgeSettings.veraaddress}}</td>
<td>{{bridge.settings.veraaddress}}</td>
</tr>
<tr>
<td>harmony.address</td>
<td>{{BridgeSettings.harmonyaddress}}</td>
<td>{{bridge.settings.harmonyaddress}}</td>
</tr>
<tr>
<td>upnp.strict</td>
<td>{{BridgeSettings.upnpstrict}}</td>
<td>{{bridge.settings.upnpstrict}}</td>
</tr>
<tr>
<td>trace.upnp</td>
<td>{{BridgeSettings.traceupnp}}</td>
<td>{{bridge.settings.traceupnp}}</td>
</tr>
<tr>
<td>dev.mode</td>
<td>{{BridgeSettings.devmode}}</td>
<td>{{bridge.settings.devmode}}</td>
</tr>
<tr>
<td>nest.configured</td>
<td>{{BridgeSettings.nestconfigured}}</td>
<td>{{bridge.settings.nestconfigured}}</td>
</tr>
</table>
</div>

View File

@@ -21,6 +21,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('label')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -37,6 +38,7 @@
</tr>
</thead>
<tr ng-repeat="harmonyactivity in bridge.harmonyactivities | availableHarmonyActivityId | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{harmonyactivity.activity.label}}</td>
<td>{{harmonyactivity.activity.id}}</td>
<td>{{harmonyactivity.hub}}</td>
@@ -57,6 +59,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('label')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -73,6 +76,7 @@
</tr>
</thead>
<tr ng-repeat="harmonyactivity in bridge.harmonyactivities | unavailableHarmonyActivityId | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{harmonyactivity.activity.label}}</td>
<td>{{harmonyactivity.activity.id}}</td>
<td>{{harmonyactivity.hub}}</td>

View File

@@ -22,6 +22,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('label')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -40,6 +41,7 @@
</tr>
</thead>
<tr ng-repeat="harmonydevice in bridge.harmonydevices | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{harmonydevice.device.label}}</td>
<td>{{harmonydevice.device.id}}</td>
<td>{{harmonydevice.hub}}</td>
@@ -74,6 +76,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('name')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -94,6 +97,7 @@
</tr>
</thead>
<tr ng-repeat="device in bridge.devices | configuredButtons | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{device.name}}</td>
<td>{{device.id}}</td>
<td>{{device.targetDevice}}</td>

View File

@@ -21,6 +21,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('name')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -37,6 +38,7 @@
</tr>
</thead>
<tr ng-repeat="nestitem in bridge.nestitems | availableNestItemId | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{nestitem.name}}</td>
<td>{{nestitem.type}}</td>
<td>{{nestitem.location}}</td>
@@ -78,6 +80,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('name')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -94,6 +97,7 @@
</tr>
</thead>
<tr ng-repeat="device in bridge.devices | unavailableNestItemId | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{device.name}}</td>
<td>{{device.id}}</td>
<td>{{device.mapId}}</td>

View File

@@ -48,6 +48,10 @@
<th>
<a href="" ng-click="order('room')">Room</a>
<span class="sortorder" ng-show="predicate === 'room'" ng-class="{reverse:reverse}"></span>
</th>
<th>
<a href="" ng-click="order('vera')">Vera</a>
<span class="sortorder" ng-show="predicate === 'vera'" ng-class="{reverse:reverse}"></span>
</th>
<th>Actions</th>
</tr>
@@ -58,6 +62,7 @@
<td>{{veradevice.id}}</td>
<td>{{veradevice.category}}</td>
<td>{{veradevice.room}}</td>
<td>{{veradevice.veraname}}</td>
<td>
<button class="btn btn-success" type="submit"
ng-click="buildDeviceUrls(veradevice, device_dim_control)">Generate
@@ -79,6 +84,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('name')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -94,15 +100,21 @@
<th>
<a href="" ng-click="order('room')">Room</a>
<span class="sortorder" ng-show="predicate === 'room'" ng-class="{reverse:reverse}"></span>
</th>
<th>
<a href="" ng-click="order('vera')">Vera</a>
<span class="sortorder" ng-show="predicate === 'vera'" ng-class="{reverse:reverse}"></span>
</th>
<th>Actions</th>
</tr>
</thead>
<tr ng-repeat="veradevice in bridge.veradevices | unavailableVeraDeviceId | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{veradevice.name}}</td>
<td>{{veradevice.id}}</td>
<td>{{veradevice.category}}</td>
<td>{{veradevice.room}}</td>
<td>{{veradevice.veraname}}</td>
<td>
<button class="btn btn-danger" type="submit"
ng-click="deleteDeviceByMapId(veradevice.id, 'veraDevice')">Delete</button>

View File

@@ -21,6 +21,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('name')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -32,14 +33,20 @@
<th>
<a href="" ng-click="order('room')">Room</a>
<span class="sortorder" ng-show="predicate === 'room'" ng-class="{reverse:reverse}"></span>
</th>
<th>
<a href="" ng-click="order('vera')">Vera</a>
<span class="sortorder" ng-show="predicate === 'vera'" ng-class="{reverse:reverse}"></span>
</th>
<th>Actions</th>
</tr>
</thead>
<tr ng-repeat="verascene in bridge.verascenes | availableVeraSceneId | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{verascene.name}}</td>
<td>{{verascene.id}}</td>
<td>{{verascene.room}}</td>
<td>{{verascene.veraname}}</td>
<td>
<button class="btn btn-success" type="submit"
ng-click="buildSceneUrls(verascene)">Generate
@@ -57,6 +64,7 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th>
<a href="" ng-click="order('name')">Name</a>
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
@@ -68,14 +76,20 @@
<th>
<a href="" ng-click="order('room')">Room</a>
<span class="sortorder" ng-show="predicate === 'room'" ng-class="{reverse:reverse}"></span>
</th>
<th>
<a href="" ng-click="order('vera')">Vera</a>
<span class="sortorder" ng-show="predicate === 'vera'" ng-class="{reverse:reverse}"></span>
</th>
<th>Actions</th>
</tr>
</thead>
<tr ng-repeat="verascene in bridge.verascenes | unavailableVeraSceneId | orderBy:predicate:reverse">
<td>{{$index+1}}</td>
<td>{{verascene.name}}</td>
<td>{{verascene.id}}</td>
<td>{{verascene.room}}</td>
<td>{{verascene.veraname}}</td>
<td>
<button class="btn btn-danger" type="submit"
ng-click="deleteDeviceByMapId(verascene.id, 'veraScene')">Delete</button>