mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-19 00:20:26 +00:00
Compare commits
5 Commits
v5.3.0RC10
...
v5.3.0RC13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d014240fba | ||
|
|
5c2d30e24b | ||
|
|
28d84f667a | ||
|
|
755533b30d | ||
|
|
53208ddabc |
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.bwssystems.HABridge</groupId>
|
<groupId>com.bwssystems.HABridge</groupId>
|
||||||
<artifactId>ha-bridge</artifactId>
|
<artifactId>ha-bridge</artifactId>
|
||||||
<version>5.3.0RC10</version>
|
<version>5.3.0RC13</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -376,6 +376,13 @@ public class BridgeSecurity {
|
|||||||
|
|
||||||
return newUser;
|
return newUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeHttpsSettings() {
|
||||||
|
securityDescriptor.setUseHttps(false);
|
||||||
|
securityDescriptor.setKeyfilePassword(null);
|
||||||
|
securityDescriptor.setKeyfilePath(null);
|
||||||
|
setSettingsChanged(true);
|
||||||
|
}
|
||||||
|
|
||||||
public void removeTestUsers() {
|
public void removeTestUsers() {
|
||||||
if (securityDescriptor.getWhitelist() != null) {
|
if (securityDescriptor.getWhitelist() != null) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.bwssystems.HABridge.upnp.UpnpSettingsResource;
|
|||||||
import com.bwssystems.HABridge.util.UDPDatagramSender;
|
import com.bwssystems.HABridge.util.UDPDatagramSender;
|
||||||
|
|
||||||
public class HABridge {
|
public class HABridge {
|
||||||
|
private static SystemControl theSystem;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This program is based on the work of armzilla from this github repository:
|
* This program is based on the work of armzilla from this github repository:
|
||||||
@@ -39,7 +40,6 @@ public class HABridge {
|
|||||||
UDPDatagramSender udpSender;
|
UDPDatagramSender udpSender;
|
||||||
UpnpSettingsResource theSettingResponder;
|
UpnpSettingsResource theSettingResponder;
|
||||||
UpnpListener theUpnpListener;
|
UpnpListener theUpnpListener;
|
||||||
SystemControl theSystem;
|
|
||||||
BridgeSettings bridgeSettings;
|
BridgeSettings bridgeSettings;
|
||||||
Version theVersion;
|
Version theVersion;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -112,7 +112,7 @@ public class HABridge {
|
|||||||
// start the upnp ssdp discovery listener
|
// start the upnp ssdp discovery listener
|
||||||
theUpnpListener = null;
|
theUpnpListener = null;
|
||||||
try {
|
try {
|
||||||
theUpnpListener = new UpnpListener(bridgeSettings.getBridgeSettingsDescriptor(), bridgeSettings.getBridgeControl(), udpSender);
|
theUpnpListener = new UpnpListener(bridgeSettings, bridgeSettings.getBridgeControl(), udpSender);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Could not initialize UpnpListener, exiting....", e);
|
log.error("Could not initialize UpnpListener, exiting....", e);
|
||||||
theUpnpListener = null;
|
theUpnpListener = null;
|
||||||
@@ -153,8 +153,14 @@ public class HABridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void theExceptionHandler(Exception e, Integer thePort) {
|
private static void theExceptionHandler(Exception e, Integer thePort) {
|
||||||
Logger log = LoggerFactory.getLogger(HABridge.class);
|
Logger log = LoggerFactory.getLogger(HABridge.class);
|
||||||
log.error("Could not start ha-bridge webservice on port [{}] due to: {}", thePort, e.getMessage());
|
if(e.getMessage().equals("no valid keystore") || e.getMessage().equals("keystore password was incorrect")) {
|
||||||
System.exit(0);
|
log.error("Https settings have been removed as {}. Restart system manually after this process exits....", e.getMessage());
|
||||||
}
|
log.warn(theSystem.removeHttpsSettings());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.error("Could not start ha-bridge webservice on port [{}] due to: {}", thePort, e.getMessage());
|
||||||
|
log.warn(theSystem.stop());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -598,7 +598,12 @@ public class SystemControl {
|
|||||||
log.warn("Error pinging listener. " + e.getMessage());
|
log.warn("Error pinging listener. " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String removeHttpsSettings() {
|
||||||
|
bridgeSettings.getBridgeSecurity().removeHttpsSettings();
|
||||||
|
return stop();
|
||||||
|
}
|
||||||
|
|
||||||
public String reinit() {
|
public String reinit() {
|
||||||
bridgeSettings.getBridgeControl().setReinit(true);
|
bridgeSettings.getBridgeControl().setReinit(true);
|
||||||
pingListener();
|
pingListener();
|
||||||
|
|||||||
@@ -201,11 +201,15 @@ public class GroupRepository extends BackupHandler {
|
|||||||
private String repositoryReader(Path filePath) {
|
private String repositoryReader(Path filePath) {
|
||||||
|
|
||||||
String content = null;
|
String content = null;
|
||||||
if(Files.notExists(filePath) || !Files.isReadable(filePath)){
|
if(Files.notExists(filePath)){
|
||||||
log.warn("Error reading the file: " + filePath + " - Does not exist or is not readable. continuing...");
|
log.debug("Error, the file: " + filePath + " - does not exist. continuing...");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!Files.isReadable(filePath)){
|
||||||
|
log.warn("Error, the file: " + filePath + " - is not readable. continuing...");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
content = new String(Files.readAllBytes(filePath));
|
content = new String(Files.readAllBytes(filePath));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.bwssystems.HABridge.BridgeControlDescriptor;
|
import com.bwssystems.HABridge.BridgeControlDescriptor;
|
||||||
import com.bwssystems.HABridge.BridgeSettingsDescriptor;
|
import com.bwssystems.HABridge.BridgeSettings;
|
||||||
import com.bwssystems.HABridge.Configuration;
|
import com.bwssystems.HABridge.Configuration;
|
||||||
import com.bwssystems.HABridge.api.hue.HueConstants;
|
import com.bwssystems.HABridge.api.hue.HueConstants;
|
||||||
import com.bwssystems.HABridge.api.hue.HuePublicConfig;
|
import com.bwssystems.HABridge.api.hue.HuePublicConfig;
|
||||||
@@ -34,82 +34,90 @@ public class UpnpListener {
|
|||||||
private BridgeControlDescriptor bridgeControl;
|
private BridgeControlDescriptor bridgeControl;
|
||||||
private String bridgeId;
|
private String bridgeId;
|
||||||
private String bridgeSNUUID;
|
private String bridgeSNUUID;
|
||||||
|
private String httpType;
|
||||||
private HuePublicConfig aHueConfig;
|
private HuePublicConfig aHueConfig;
|
||||||
private Integer theUpnpSendDelay;
|
private Integer theUpnpSendDelay;
|
||||||
private String responseTemplate1 = "HTTP/1.1 200 OK\r\n" +
|
private String responseTemplate1 = "HTTP/1.1 200 OK\r\n" +
|
||||||
"HOST: %s:%s\r\n" +
|
"HOST: %s:%s\r\n" +
|
||||||
"CACHE-CONTROL: max-age=100\r\n" +
|
"CACHE-CONTROL: max-age=100\r\n" +
|
||||||
"EXT:\r\n" +
|
"EXT:\r\n" +
|
||||||
"LOCATION: http://%s:%s/description.xml\r\n" +
|
"LOCATION: %s://%s:%s/description.xml\r\n" +
|
||||||
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
||||||
"HUE-BRIDGEID: %s\r\n" +
|
"hue-bridgeid: %s\r\n" +
|
||||||
"ST: upnp:rootdevice\r\n" +
|
"ST: upnp:rootdevice\r\n" +
|
||||||
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s::upnp:rootdevice\r\n\r\n";
|
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s::upnp:rootdevice\r\n\r\n";
|
||||||
private String responseTemplate2 = "HTTP/1.1 200 OK\r\n" +
|
private String responseTemplate2 = "HTTP/1.1 200 OK\r\n" +
|
||||||
"HOST: %s:%s\r\n" +
|
"HOST: %s:%s\r\n" +
|
||||||
"CACHE-CONTROL: max-age=100\r\n" +
|
"CACHE-CONTROL: max-age=100\r\n" +
|
||||||
"EXT:\r\n" +
|
"EXT:\r\n" +
|
||||||
"LOCATION: http://%s:%s/description.xml\r\n" +
|
"LOCATION: %s://%s:%s/description.xml\r\n" +
|
||||||
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
||||||
"HUE-BRIDGEID: %s\r\n" +
|
"hue-bridgeid: %s\r\n" +
|
||||||
"ST: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n" +
|
"ST: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n" +
|
||||||
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
|
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
|
||||||
private String responseTemplate3 = "HTTP/1.1 200 OK\r\n" +
|
private String responseTemplate3 = "HTTP/1.1 200 OK\r\n" +
|
||||||
"HOST: %s:%s\r\n" +
|
"HOST: %s:%s\r\n" +
|
||||||
"CACHE-CONTROL: max-age=100\r\n" +
|
"CACHE-CONTROL: max-age=100\r\n" +
|
||||||
"EXT:\r\n" +
|
"EXT:\r\n" +
|
||||||
"LOCATION: http://%s:%s/description.xml\r\n" +
|
"LOCATION: %s://%s:%s/description.xml\r\n" +
|
||||||
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
||||||
"HUE-BRIDGEID: %s\r\n" +
|
"hue-bridgeid: %s\r\n" +
|
||||||
"ST: urn:schemas-upnp-org:device:basic:1\r\n" +
|
"ST: urn:schemas-upnp-org:device:basic:1\r\n" +
|
||||||
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
|
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
|
||||||
|
|
||||||
private String notifyTemplate1 = "NOTIFY * HTTP/1.1\r\n" +
|
private String notifyTemplate1 = "NOTIFY * HTTP/1.1\r\n" +
|
||||||
"HOST: %s:%s\r\n" +
|
"HOST: %s:%s\r\n" +
|
||||||
"CACHE-CONTROL: max-age=100\r\n" +
|
"CACHE-CONTROL: max-age=100\r\n" +
|
||||||
"LOCATION: http://%s:%s/description.xml\r\n" +
|
"LOCATION: %s://%s:%s/description.xml\r\n" +
|
||||||
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
||||||
"NTS: ssdp:alive\r\n" +
|
"NTS: ssdp:alive\r\n" +
|
||||||
"HUE-BRIDGEID: %s\r\n" +
|
"hue-bridgeid: %s\r\n" +
|
||||||
"NT: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n" +
|
"NT: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n" +
|
||||||
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
|
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
|
||||||
|
|
||||||
private String notifyTemplate2 = "NOTIFY * HTTP/1.1\r\n" +
|
private String notifyTemplate2 = "NOTIFY * HTTP/1.1\r\n" +
|
||||||
"HOST: %s:%s\r\n" +
|
"HOST: %s:%s\r\n" +
|
||||||
"CACHE-CONTROL: max-age=100\r\n" +
|
"CACHE-CONTROL: max-age=100\r\n" +
|
||||||
"LOCATION: http://%s:%s/description.xml\r\n" +
|
"LOCATION: %s://%s:%s/description.xml\r\n" +
|
||||||
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
||||||
"NTS: ssdp:alive\r\n" + "HUE-BRIDGEID: %s\r\n" +
|
"NTS: ssdp:alive\r\n" +
|
||||||
|
"hue-bridgeid: %s\r\n" +
|
||||||
"NT: upnp:rootdevice\r\n" +
|
"NT: upnp:rootdevice\r\n" +
|
||||||
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s::upnp:rootdevice\r\n\r\n";
|
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s::upnp:rootdevice\r\n\r\n";
|
||||||
|
|
||||||
private String notifyTemplate3 = "NOTIFY * HTTP/1.1\r\n" +
|
private String notifyTemplate3 = "NOTIFY * HTTP/1.1\r\n" +
|
||||||
"HOST: %s:%s\r\n" +
|
"HOST: %s:%s\r\n" +
|
||||||
"CACHE-CONTROL: max-age=100\r\n" +
|
"CACHE-CONTROL: max-age=100\r\n" +
|
||||||
"LOCATION: http://%s:%s/description.xml\r\n" +
|
"LOCATION: %s://%s:%s/description.xml\r\n" +
|
||||||
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
|
||||||
"NTS: ssdp:alive\r\n" +
|
"NTS: ssdp:alive\r\n" +
|
||||||
"HUE-BRIDGEID: %s\r\n" +
|
"hue-bridgeid: %s\r\n" +
|
||||||
"NT: urn:schemas-upnp-org:device:basic:1\r\n" +
|
"NT: urn:schemas-upnp-org:device:basic:1\r\n" +
|
||||||
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
|
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
|
||||||
|
|
||||||
public UpnpListener(BridgeSettingsDescriptor theSettings, BridgeControlDescriptor theControl,
|
public UpnpListener(BridgeSettings theSettings, BridgeControlDescriptor theControl,
|
||||||
UDPDatagramSender aUdpDatagramSender) throws IOException {
|
UDPDatagramSender aUdpDatagramSender) throws IOException {
|
||||||
super();
|
super();
|
||||||
theUDPDatagramSender = aUdpDatagramSender;
|
theUDPDatagramSender = aUdpDatagramSender;
|
||||||
upnpMulticastSocket = null;
|
upnpMulticastSocket = null;
|
||||||
httpServerPort = Integer.valueOf(theSettings.getServerPort());
|
httpServerPort = Integer.valueOf(theSettings.getBridgeSettingsDescriptor().getServerPort());
|
||||||
upnpConfigIP = theSettings.getUpnpConfigAddress();
|
upnpConfigIP = theSettings.getBridgeSettingsDescriptor().getUpnpConfigAddress();
|
||||||
// strict = theSettings.isUpnpStrict();
|
// strict = theSettings.isUpnpStrict();
|
||||||
upnpOriginal = theSettings.isUpnporiginal();
|
upnpOriginal = theSettings.getBridgeSettingsDescriptor().isUpnporiginal();
|
||||||
traceupnp = theSettings.isTraceupnp();
|
traceupnp = theSettings.getBridgeSettingsDescriptor().isTraceupnp();
|
||||||
useUpnpIface = theSettings.isUseupnpiface();
|
useUpnpIface = theSettings.getBridgeSettingsDescriptor().isUseupnpiface();
|
||||||
theUpnpSendDelay = theSettings.getUpnpsenddelay();
|
theUpnpSendDelay = theSettings.getBridgeSettingsDescriptor().getUpnpsenddelay();
|
||||||
bridgeControl = theControl;
|
bridgeControl = theControl;
|
||||||
aHueConfig = HuePublicConfig.createConfig("temp", upnpConfigIP, HueConstants.HUB_VERSION,
|
aHueConfig = HuePublicConfig.createConfig("temp", upnpConfigIP, HueConstants.HUB_VERSION,
|
||||||
theSettings.getHubmac());
|
theSettings.getBridgeSettingsDescriptor().getHubmac());
|
||||||
bridgeId = aHueConfig.getBridgeid();
|
bridgeId = aHueConfig.getBridgeid();
|
||||||
bridgeSNUUID = aHueConfig.getSNUUIDFromMac();
|
bridgeSNUUID = aHueConfig.getSNUUIDFromMac();
|
||||||
|
if(theSettings.getBridgeSecurity().isUseHttps()) {
|
||||||
|
httpType = "https";
|
||||||
|
} else {
|
||||||
|
httpType = "http";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (useUpnpIface)
|
if (useUpnpIface)
|
||||||
upnpMulticastSocket = new MulticastSocket(
|
upnpMulticastSocket = new MulticastSocket(
|
||||||
@@ -125,6 +133,11 @@ public class UpnpListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean startListening() {
|
public boolean startListening() {
|
||||||
|
if (bridgeControl.isReinit() || bridgeControl.isStop()) {
|
||||||
|
log.warn("UPNP Listener exiting as reinit or stop requested....");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
log.info("UPNP Discovery Listener starting....");
|
log.info("UPNP Discovery Listener starting....");
|
||||||
Enumeration<NetworkInterface> ifs = null;
|
Enumeration<NetworkInterface> ifs = null;
|
||||||
|
|
||||||
@@ -198,6 +211,11 @@ public class UpnpListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bridgeControl.isReinit() || bridgeControl.isStop()) {
|
||||||
|
log.warn("UPNP Listener exiting as reinit or stop requested....");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
log.info("UPNP Discovery Listener running and ready....");
|
log.info("UPNP Discovery Listener running and ready....");
|
||||||
boolean loopControl = true;
|
boolean loopControl = true;
|
||||||
boolean error = false;
|
boolean error = false;
|
||||||
@@ -322,7 +340,7 @@ public class UpnpListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
discoveryResponse = String.format(responseTemplate1, Configuration.UPNP_MULTICAST_ADDRESS,
|
discoveryResponse = String.format(responseTemplate1, Configuration.UPNP_MULTICAST_ADDRESS,
|
||||||
Configuration.UPNP_DISCOVERY_PORT, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID);
|
Configuration.UPNP_DISCOVERY_PORT, httpType, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID);
|
||||||
if (traceupnp) {
|
if (traceupnp) {
|
||||||
log.info("Traceupnp: send upnp discovery template 1 with response address: " + httpLocationAddress + ":"
|
log.info("Traceupnp: send upnp discovery template 1 with response address: " + httpLocationAddress + ":"
|
||||||
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
|
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
|
||||||
@@ -337,7 +355,7 @@ public class UpnpListener {
|
|||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
discoveryResponse = String.format(responseTemplate2, Configuration.UPNP_MULTICAST_ADDRESS,
|
discoveryResponse = String.format(responseTemplate2, Configuration.UPNP_MULTICAST_ADDRESS,
|
||||||
Configuration.UPNP_DISCOVERY_PORT, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID,
|
Configuration.UPNP_DISCOVERY_PORT, httpType, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID,
|
||||||
bridgeSNUUID);
|
bridgeSNUUID);
|
||||||
if (traceupnp) {
|
if (traceupnp) {
|
||||||
log.info("Traceupnp: send upnp discovery template 2 with response address: " + httpLocationAddress + ":"
|
log.info("Traceupnp: send upnp discovery template 2 with response address: " + httpLocationAddress + ":"
|
||||||
@@ -352,8 +370,8 @@ public class UpnpListener {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
discoveryResponse = String.format(responseTemplate3, Configuration.UPNP_MULTICAST_ADDRESS,
|
discoveryResponse = String.format(responseTemplate3,Configuration.UPNP_MULTICAST_ADDRESS,
|
||||||
Configuration.UPNP_DISCOVERY_PORT, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID);
|
Configuration.UPNP_DISCOVERY_PORT, httpType, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID);
|
||||||
if (traceupnp) {
|
if (traceupnp) {
|
||||||
log.info("Traceupnp: send upnp discovery template 3 with response address: " + httpLocationAddress + ":"
|
log.info("Traceupnp: send upnp discovery template 3 with response address: " + httpLocationAddress + ":"
|
||||||
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
|
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
|
||||||
@@ -384,7 +402,7 @@ public class UpnpListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
notifyData = String.format(notifyTemplate1, Configuration.UPNP_MULTICAST_ADDRESS,
|
notifyData = String.format(notifyTemplate1, Configuration.UPNP_MULTICAST_ADDRESS,
|
||||||
Configuration.UPNP_DISCOVERY_PORT, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID, bridgeSNUUID);
|
Configuration.UPNP_DISCOVERY_PORT, httpType, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID, bridgeSNUUID);
|
||||||
if (traceupnp) {
|
if (traceupnp) {
|
||||||
log.info("Traceupnp: sendUpnpNotify notifyTemplate1");
|
log.info("Traceupnp: sendUpnpNotify notifyTemplate1");
|
||||||
}
|
}
|
||||||
@@ -398,7 +416,7 @@ public class UpnpListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
notifyData = String.format(notifyTemplate2, Configuration.UPNP_MULTICAST_ADDRESS,
|
notifyData = String.format(notifyTemplate2, Configuration.UPNP_MULTICAST_ADDRESS,
|
||||||
Configuration.UPNP_DISCOVERY_PORT, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID);
|
Configuration.UPNP_DISCOVERY_PORT, httpType, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID);
|
||||||
if (traceupnp) {
|
if (traceupnp) {
|
||||||
log.info("Traceupnp: sendUpnpNotify notifyTemplate2");
|
log.info("Traceupnp: sendUpnpNotify notifyTemplate2");
|
||||||
}
|
}
|
||||||
@@ -412,7 +430,7 @@ public class UpnpListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
notifyData = String.format(notifyTemplate3, Configuration.UPNP_MULTICAST_ADDRESS,
|
notifyData = String.format(notifyTemplate3, Configuration.UPNP_MULTICAST_ADDRESS,
|
||||||
Configuration.UPNP_DISCOVERY_PORT, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID);
|
Configuration.UPNP_DISCOVERY_PORT, httpType, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID);
|
||||||
if (traceupnp) {
|
if (traceupnp) {
|
||||||
log.info("Traceupnp: sendUpnpNotify notifyTemplate3");
|
log.info("Traceupnp: sendUpnpNotify notifyTemplate3");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,6 +367,18 @@ app.service('bridgeService', function ($rootScope, $http, $base64, $location, ng
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.changeSecuritySettings = function (useLinkButton, secureHueApi, execGarden, useHttps, keyfilePath, keyfilePassword) {
|
this.changeSecuritySettings = function (useLinkButton, secureHueApi, execGarden, useHttps, keyfilePath, keyfilePassword) {
|
||||||
|
if(useHttps) {
|
||||||
|
if(!keyfilePassword || keyfilePassword.length == 0 || !keyfilePassword.trim()) {
|
||||||
|
self.displayErrorMessage("Use HTTPS - ", "Key File Password cannot be empty.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!keyfilePath || keyfilePath.length == 0 || !keyfilePath.trim()) {
|
||||||
|
self.displayErrorMessage("Use HTTPS - ", "Key File Path cannot be empty.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var newSecurityInfo = {};
|
var newSecurityInfo = {};
|
||||||
newSecurityInfo = {
|
newSecurityInfo = {
|
||||||
useLinkButton: useLinkButton,
|
useLinkButton: useLinkButton,
|
||||||
@@ -376,6 +388,7 @@ app.service('bridgeService', function ($rootScope, $http, $base64, $location, ng
|
|||||||
keyfilePath: keyfilePath,
|
keyfilePath: keyfilePath,
|
||||||
keyfilePassword: keyfilePassword
|
keyfilePassword: keyfilePassword
|
||||||
};
|
};
|
||||||
|
|
||||||
return $http.post(this.state.systemsbase + "/changesecurityinfo", newSecurityInfo).then(
|
return $http.post(this.state.systemsbase + "/changesecurityinfo", newSecurityInfo).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
self.state.securityInfo = response.data;
|
self.state.securityInfo = response.data;
|
||||||
@@ -2082,21 +2095,25 @@ app.controller('SystemController', function ($scope, $location, bridgeService, n
|
|||||||
}
|
}
|
||||||
|
|
||||||
var othertypes = [];
|
var othertypes = [];
|
||||||
othertypes = newhomegenieothertypes.split(",");
|
|
||||||
var theModuleTypes = [];
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
if (othertypes.length > 0) {
|
var theModuleTypes = [];
|
||||||
for (var i = 0; i < othertypes.length; i++) {
|
|
||||||
var aType = othertypes[i].trim();
|
if(newhomegenieothertypes && newhomegenieothertypes.trim() && newhomegenieothertypes.length > 0) {
|
||||||
if (aType.length > 0) {
|
othertypes = newhomegenieothertypes.split(",");
|
||||||
var moduleType = {
|
if (othertypes.length > 0) {
|
||||||
moduleType: aType
|
for (var i = 0; i < othertypes.length; i++) {
|
||||||
};
|
var aType = othertypes[i].trim();
|
||||||
theModuleTypes.push(moduleType);
|
if (aType.length > 0) {
|
||||||
count++;
|
var moduleType = {
|
||||||
|
moduleType: aType
|
||||||
|
};
|
||||||
|
theModuleTypes.push(moduleType);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var theExtension;
|
var theExtension;
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
theExtension = undefined;
|
theExtension = undefined;
|
||||||
|
|||||||
@@ -761,7 +761,7 @@
|
|||||||
<td><input type="checkbox" ng-model="newhomegeniesecure" ng-true-value=true
|
<td><input type="checkbox" ng-model="newhomegeniesecure" ng-true-value=true
|
||||||
ng-false-value=false></td>
|
ng-false-value=false></td>
|
||||||
<td><button class="btn btn-success" type="submit"
|
<td><button class="btn btn-success" type="submit"
|
||||||
ng-click="addHomeGenietoSettings(newhomegeniename, newhomegenieip, newhomegenieport, newshomegenieusername, newhomegeniepassword, newhomegeniewebhook, newhomegeniesecure, newhomegenieothertypes)">Add</button>
|
ng-click="addHomeGenietoSettings(newhomegeniename, newhomegenieip, newhomegenieport, newhomegenieusername, newhomegeniepassword, newhomegeniewebhook, newhomegeniesecure, newhomegenieothertypes)">Add</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user