mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-16 18:24:36 +00:00
changes for dfim at 1percent and domoticz https usage
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>5.2.1d</version>
|
||||
<version>5.2.2RC</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -512,6 +512,7 @@
|
||||
<th>Port</th>
|
||||
<th>Username (opt)</th>
|
||||
<th>Password (opt)</th>
|
||||
<th>Use SSL</th>
|
||||
<th>Manage</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -531,6 +532,9 @@
|
||||
<td><input id="bridge-settings-next-domoticz-password"
|
||||
class="form-control" type="password" ng-model="domoticz.password"
|
||||
placeholder="Domoticz password (opt)"></td>
|
||||
<td><input type="checkbox"
|
||||
ng-model="domoticz.secure" ng-true-value=true
|
||||
ng-false-value=false></td>
|
||||
<td><button class="btn btn-danger" type="submit"
|
||||
ng-click="removeDomoticztoSettings(domoticz.name, domoticz.ip)">Del</button></td>
|
||||
</tr>
|
||||
@@ -550,8 +554,11 @@
|
||||
<td><input id="bridge-settings-new-domoticz-password"
|
||||
class="form-control" type="password" ng-model="newdomoticzpassword"
|
||||
placeholder="Domoticz password (opt)"></td>
|
||||
<td><input type="checkbox"
|
||||
ng-model="newdomoticzsecure" ng-true-value=true
|
||||
ng-false-value=false></td>
|
||||
<td><button class="btn btn-success" type="submit"
|
||||
ng-click="addDomoticztoSettings(newdomoticzname, newdomoticzip, newdomoticzport, newdomoticzusername, newdomoticzpassword)">Add</button></td>
|
||||
ng-click="addDomoticztoSettings(newdomoticzname, newdomoticzip, newdomoticzport, newdomoticzusername, newdomoticzpassword, newdomoticzsecure)">Add</button></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user