changes for dfim at 1percent and domoticz https usage

This commit is contained in:
BWS Systems
2018-11-14 11:25:54 -06:00
parent 750056df06
commit b1d1f2ac46
5 changed files with 28 additions and 9 deletions

View File

@@ -52,11 +52,22 @@ public class BrightnessDecode {
boolean notDone = true;
String replaceValue = null;
String replaceTarget = null;
int percentBrightness = (int) Math.round(intensity / 255.0 * 100);
float decimalBrightness = (float) (intensity / 255.0);
int percentBrightness = 0;
float decimalBrightness = (float) 0.0;
Map<String, BigDecimal> variables = new HashMap<String, BigDecimal>();
String mathDescriptor = null;
if(intensity > 0) {
decimalBrightness = (float) (intensity / 255.0);
if(intensity > 0 && intensity < 5)
percentBrightness = 1;
else
percentBrightness = (int) Math.round(intensity / 255.0 * 100)
} else {
decimalBrightness = (float) 0.0;
percentBrightness = 0;
}
while(notDone) {
notDone = false;
if (request.contains(INTENSITY_BYTE)) {

View File

@@ -124,18 +124,19 @@ public class UpnpSettingsResource {
DatagramSocket sock = new DatagramSocket();
// connect is needed to bind the socket and retrieve the local address
// later (it would return 0.0.0.0 otherwise)
sock.connect(InetSocketAddress.createUnresolved(remoteAddress, remotePort));
sock.connect(new InetSocketAddress(remoteAddress, remotePort));
localAddress = sock.getLocalAddress();
sock.disconnect();
sock.close();
sock = null;
} catch(Exception e) {
log.warn("Error <" + e.getMessage() + "> on determining interface to reply for <" + remoteAddress + ">. Using default route IP");
ParseRoute theRoute = ParseRoute.getInstance();
try {
localAddress = InetAddress.getByName(theRoute.getLocalIPAddress());
} catch(Exception e1) {}
log.warn("Error <" + e.getMessage() + "> on determining interface to reply for <" + remoteAddress + ">. Using default route IP Address of " + localAddress.getHostAddress());
}
log.debug("getOutbountAddress returning IP Address of " + localAddress.getHostAddress());
return localAddress;
}
}