mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-16 18:24:36 +00:00
Updating editing for Settings UI.
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.8d</version>
|
||||
<version>1.3.8e</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
|
||||
@@ -100,7 +100,7 @@ public class BridgeSettings extends BackupHandler {
|
||||
theBridgeSettings.setNestpwd(System.getProperty("nest.pwd"));
|
||||
}
|
||||
|
||||
if(theBridgeSettings.getUpnpConfigAddress() == null) {
|
||||
if(theBridgeSettings.getUpnpConfigAddress() == null || theBridgeSettings.getUpnpConfigAddress().equals("")) {
|
||||
try {
|
||||
log.info("Getting an IP address for this host....");
|
||||
Enumeration<NetworkInterface> ifs = NetworkInterface.getNetworkInterfaces();
|
||||
|
||||
@@ -4,8 +4,8 @@ import java.util.List;
|
||||
|
||||
public class BridgeSettingsDescriptor {
|
||||
private String upnpconfigaddress;
|
||||
private String serverport;
|
||||
private String upnpresponseport;
|
||||
private Integer serverport;
|
||||
private Integer upnpresponseport;
|
||||
private String upnpdevicedb;
|
||||
private IpList veraaddress;
|
||||
private IpList harmonyaddress;
|
||||
@@ -37,18 +37,24 @@ public class BridgeSettingsDescriptor {
|
||||
public void setUpnpConfigAddress(String upnpConfigAddress) {
|
||||
this.upnpconfigaddress = upnpConfigAddress;
|
||||
}
|
||||
public String getServerPort() {
|
||||
public Integer getServerPort() {
|
||||
return serverport;
|
||||
}
|
||||
public void setServerPort(String serverPort) {
|
||||
public void setServerPort(Integer serverPort) {
|
||||
this.serverport = serverPort;
|
||||
}
|
||||
public String getUpnpResponsePort() {
|
||||
public void setServerPort(String serverPort) {
|
||||
this.serverport = Integer.valueOf(serverPort);
|
||||
}
|
||||
public Integer getUpnpResponsePort() {
|
||||
return upnpresponseport;
|
||||
}
|
||||
public void setUpnpResponsePort(String upnpResponsePort) {
|
||||
public void setUpnpResponsePort(Integer upnpResponsePort) {
|
||||
this.upnpresponseport = upnpResponsePort;
|
||||
}
|
||||
public void setUpnpResponsePort(String upnpResponsePort) {
|
||||
this.upnpresponseport = Integer.valueOf(upnpResponsePort);
|
||||
}
|
||||
public String getUpnpDeviceDb() {
|
||||
return upnpdevicedb;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class HABridge {
|
||||
// sparkjava config directive to set ip address for the web server to listen on
|
||||
// ipAddress("0.0.0.0"); // not used
|
||||
// sparkjava config directive to set port for the web server to listen on
|
||||
port(Integer.valueOf(bridgeSettings.getBridgeSettingsDescriptor().getServerPort()));
|
||||
port(bridgeSettings.getBridgeSettingsDescriptor().getServerPort());
|
||||
// sparkjava config directive to set html static file location for Jetty
|
||||
staticFileLocation("/public");
|
||||
// setup system control api first
|
||||
|
||||
@@ -25,7 +25,7 @@ public class UpnpListener {
|
||||
|
||||
public UpnpListener(BridgeSettingsDescriptor theSettings, BridgeControlDescriptor theControl) {
|
||||
super();
|
||||
upnpResponsePort = Integer.valueOf(theSettings.getUpnpResponsePort());
|
||||
upnpResponsePort = theSettings.getUpnpResponsePort();
|
||||
httpServerPort = Integer.valueOf(theSettings.getServerPort());
|
||||
responseAddress = theSettings.getUpnpConfigAddress();
|
||||
strict = theSettings.isUpnpStrict();
|
||||
|
||||
@@ -517,6 +517,13 @@ app.controller('SystemController', function ($scope, $location, $http, $window,
|
||||
$scope.imgUrl = "glyphicon glyphicon-plus";
|
||||
$scope.visibleBk = false;
|
||||
$scope.imgBkUrl = "glyphicon glyphicon-plus";
|
||||
$scope.addVeratoSettings = function (newveraname, newveraip) {
|
||||
if($scope.bridge.settings.veraddress == null) {
|
||||
$scope.bridge.settings.veraddress = { devices: [] };
|
||||
}
|
||||
|
||||
$scope.bridge.settings.veraaddress.devices.push("{" +"\"name\":\"" + newveraname +"\",\"ip\":\"" + newveraip + "\"}");
|
||||
};
|
||||
$scope.saveSettings = function() {
|
||||
bridgeService.saveSettings();
|
||||
};
|
||||
|
||||
@@ -52,88 +52,123 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>config.file</td>
|
||||
<td>{{bridge.settings.configfile}}</td>
|
||||
<td>Configuration Path and File</td>
|
||||
<td><input id="bridge-settings-configfile" class="form-control" type="text"
|
||||
ng-model="bridge.settings.configfile" placeholder="data/ha-bridge.config"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>upnp.devices.db</td>
|
||||
<td>{{bridge.settings.upnpdevicedb}}</td>
|
||||
<td>Device DB Path and File</td>
|
||||
<td><input id="bridge-settings-upnpdevicedb" class="form-control" type="text"
|
||||
ng-model="bridge.settings.upnpdevicedb" placeholder="data/device.db"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>upnp.config.address</td>
|
||||
<td>{{bridge.settings.upnpconfigaddress}}</td>
|
||||
<td>UPNP IP Address</td>
|
||||
<td><input id="bridge-settings-upnpconfigaddress" class="form-control" type="text"
|
||||
ng-model="bridge.settings.upnpconfigaddress" placeholder="192.168.1.1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>server.port</td>
|
||||
<td>{{bridge.settings.serverport}}</td>
|
||||
<td>Web Server Port</td>
|
||||
<td><input id="bridge-settings-serverport" class="form-control" type="number"
|
||||
ng-model="bridge.settings.serverport" min="1" max="65535"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>upnp.response.port</td>
|
||||
<td>{{bridge.settings.upnpresponseport}}</td>
|
||||
<td>UPNP Response Port</td>
|
||||
<td><input id="bridge-settings-upnpresponseport" class="form-control" type="number"
|
||||
ng-model="bridge.settings.upnpresponseport" min="1" max="65535"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vera.address</td>
|
||||
<td>Vera Names and IP Addresses</td>
|
||||
<td><table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>IP</th>
|
||||
<th>Manage</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="vera in bridge.settings.veraaddress.devices">
|
||||
<td>{{vera.name}}</td>
|
||||
<td>{{vera.ip}}</td>
|
||||
<td><button class="btn btn-danger" type="submit"
|
||||
ng-click="removeVeratoSettings(vera.name, vera.ip)">Del</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input id="bridge-settings-next-vera-name" class="form-control" type="text"
|
||||
ng-model="newveraname" placeholder="A Vera"></td>
|
||||
<td><input id="bridge-settings-next-vera-ip" class="form-control" type="text"
|
||||
ng-model="newveraip" placeholder="192.168.1.2"></td>
|
||||
<td><button class="btn btn-success" type="submit"
|
||||
ng-click="addVeratoSettings(newveraname, newveraip)">Add</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>harmony.address</td>
|
||||
<td>Harmony Names and IP Addresses</td>
|
||||
<td><table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>IP</th>
|
||||
<th>Manage</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="harmony in bridge.settings.harmonyaddress.devices">
|
||||
<td>{{harmony.name}}</td>
|
||||
<td>{{harmony.ip}}</td>
|
||||
<td><button class="btn btn-danger" type="submit"
|
||||
ng-click="removeHarmonytoSettings(harmony.name, harmony.ip)">Del</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input id="bridge-settings-next-harmony-name" class="form-control" type="text"
|
||||
ng-model="newharmonyname" placeholder="A Harmony"></td>
|
||||
<td><input id="bridge-settings-next-harmony-ip" class="form-control" type="text"
|
||||
ng-model="newharmonyip" placeholder="192.168.1.3"></td>
|
||||
<td><button class="btn btn-success" type="submit"
|
||||
ng-click="addHarmonytoSettings(newharmonyname, newharmonyip)">Add</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>harmony.user</td>
|
||||
<td>{{bridge.settings.harmonyuser}}</td>
|
||||
<td>Harmony Username</td>
|
||||
<td><input id="bridge-settings-harmonyuser" class="form-control" type="text"
|
||||
ng-model="bridge.settings.harmonyuser" placeholder="someone@gmail.com"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>harmony.pwd</td>
|
||||
<td>{{bridge.settings.harmonypwd}}</td>
|
||||
<td>Harmony Password</td>
|
||||
<td><input id="bridge-settings-harmonypwd" class="form-control" type="password"
|
||||
ng-model="bridge.settings.harmonypwd" placeholder="thepassword"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>button.sleep</td>
|
||||
<td>{{bridge.settings.buttonsleep}} ms</td>
|
||||
<td>Button Press Sleep Interval (ms)</td>
|
||||
<td><input id="bridge-settings-buttonsleep" class="form-control" type="number" name="input"
|
||||
ng-model="bridge.settings.buttonsleep" min="100" max="9999"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>nest.user</td>
|
||||
<td>{{bridge.settings.nestuser}}</td>
|
||||
<td>Nest Username</td>
|
||||
<td><input id="bridge-settings-nestuser" class="form-control" type="text"
|
||||
ng-model="bridge.settings.nestuser" placeholder="someone@gmail.com"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>nest.pwd</td>
|
||||
<td>{{bridge.settings.nestpwd}}</td>
|
||||
<td>Nest Password</td>
|
||||
<td><input id="bridge-settings-nestpwd" class="form-control" type="password"
|
||||
ng-model="bridge.settings.nestpwd" placeholder="thepassword"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>upnp.strict</td>
|
||||
<td>{{bridge.settings.upnpstrict}}</td>
|
||||
<td>UPNP Strict Handling</td>
|
||||
<td><input type="checkbox" ng-model="bridge.settings.upnpstrict"
|
||||
ng-true-value=true ng-false-value=false> {{bridge.settings.upnpstrict}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>trace.upnp</td>
|
||||
<td>{{bridge.settings.traceupnp}}</td>
|
||||
<td>Trace UPNP Calls</td>
|
||||
<td><input type="checkbox" ng-model="bridge.settings.traceupnp"
|
||||
ng-true-value=true ng-false-value=false> {{bridge.settings.traceupnp}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dev.mode</td>
|
||||
<td>{{bridge.settings.devmode}}</td>
|
||||
<td>Harmony Development Mode</td>
|
||||
<td><input type="checkbox" ng-model="bridge.settings.devmode"
|
||||
ng-true-value=true ng-false-value=false> {{bridge.settings.devmode}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user