diff --git a/pom.xml b/pom.xml index baa1206..ce87276 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bwssystems.HABridge ha-bridge - 5.2.1d + 5.2.2RC jar HA Bridge diff --git a/src/main/java/com/bwssystems/HABridge/hue/BrightnessDecode.java b/src/main/java/com/bwssystems/HABridge/hue/BrightnessDecode.java index bf58183..bcf6fac 100644 --- a/src/main/java/com/bwssystems/HABridge/hue/BrightnessDecode.java +++ b/src/main/java/com/bwssystems/HABridge/hue/BrightnessDecode.java @@ -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 variables = new HashMap(); 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)) { diff --git a/src/main/java/com/bwssystems/HABridge/upnp/UpnpSettingsResource.java b/src/main/java/com/bwssystems/HABridge/upnp/UpnpSettingsResource.java index db0d939..4eec674 100644 --- a/src/main/java/com/bwssystems/HABridge/upnp/UpnpSettingsResource.java +++ b/src/main/java/com/bwssystems/HABridge/upnp/UpnpSettingsResource.java @@ -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; } } diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index 910c5be..f33aa2a 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -1684,11 +1684,11 @@ app.controller ('SystemController', function ($scope, $location, bridgeService, } } }; - $scope.addDomoticztoSettings = function (newdomoticzname, newdomoticzip, newdomoticzport, newdomoticzusername, newdomoticzpassword) { + $scope.addDomoticztoSettings = function (newdomoticzname, newdomoticzip, newdomoticzport, newdomoticzusername, newdomoticzpassword, newdomoticzsecure) { if($scope.bridge.settings.domoticzaddress === undefined || $scope.bridge.settings.domoticzaddress === null) { $scope.bridge.settings.domoticzaddress = { devices: [] }; } - var newdomoticz = {name: newdomoticzname, ip: newdomoticzip, port: newdomoticzport, username: newdomoticzusername, password: newdomoticzpassword } + var newdomoticz = {name: newdomoticzname, ip: newdomoticzip, port: newdomoticzport, username: newdomoticzusername, password: newdomoticzpassword, secure: newdomoticzsecure } $scope.bridge.settings.domoticzaddress.devices.push(newdomoticz); $scope.newdomoticzname = null; $scope.newdomoticzip = null; diff --git a/src/main/resources/public/views/system.html b/src/main/resources/public/views/system.html index a3dc6b2..dfcdd72 100644 --- a/src/main/resources/public/views/system.html +++ b/src/main/resources/public/views/system.html @@ -512,6 +512,7 @@ Port Username (opt) Password (opt) + Use SSL Manage @@ -531,6 +532,9 @@ + @@ -550,8 +554,11 @@ + + ng-click="addDomoticztoSettings(newdomoticzname, newdomoticzip, newdomoticzport, newdomoticzusername, newdomoticzpassword, newdomoticzsecure)">Add