Updated issues with edit and update device

This commit is contained in:
Admin
2017-01-12 10:57:28 -06:00
parent cd62538785
commit 382828f615
4 changed files with 15 additions and 20 deletions

View File

@@ -27,16 +27,16 @@ Then locate the jar and start the server with:
ATTENTION: This requires JDK 1.8 to run ATTENTION: This requires JDK 1.8 to run
``` ```
java -jar ha-bridge-3.5.1.jar java -jar ha-bridge-4.0.0.jar
``` ```
### Automation on Linux systems ### Automation on Linux systems
To have this configured and running automatically there are a few resources to use. One is using Docker and a docker container has been built for this and can be gotten here: https://github.com/aptalca/docker-ha-bridge To have this configured and running automatically there are a few resources to use. One is using Docker and a docker container has been built for this and can be gotten here: https://github.com/aptalca/docker-ha-bridge
Create the directory and make sure that ha-bridge-3.5.1.jar is in your /home/pi/habridge directory. Create the directory and make sure that ha-bridge-4.0.0.jar is in your /home/pi/habridge directory.
``` ```
pi@raspberrypi:~ $ mkdir habridge pi@raspberrypi:~ $ mkdir habridge
pi@raspberrypi:~ $ cd habridge pi@raspberrypi:~ $ cd habridge
pi@raspberrypi:~/habridge $ wget https://github.com/bwssytems/ha-bridge/releases/download/v3.5.1/ha-bridge-3.5.1.jar pi@raspberrypi:~/habridge $ wget https://github.com/bwssytems/ha-bridge/releases/download/v4.0.0/ha-bridge-4.0.0.jar
``` ```
For next gen Linux systems (this includes the Raspberry Pi), here is a systemctl unit file that you can install. Here is a link on how to do this: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units For next gen Linux systems (this includes the Raspberry Pi), here is a systemctl unit file that you can install. Here is a link on how to do this: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
@@ -48,7 +48,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-3.5.1.jar ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.0.0.jar
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@@ -65,7 +65,7 @@ Then cut and past this, modify any locations that are not correct
``` ```
cd /home/pi/habridge cd /home/pi/habridge
rm /home/pi/habridge/habridge-log.txt rm /home/pi/habridge/habridge-log.txt
nohup java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-3.5.1.jar > /home/pi/habridge/habridge-log.txt 2>&1 & nohup java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.0.0.jar > /home/pi/habridge/habridge-log.txt 2>&1 &
chmod 777 /home/pi/habridge/habridge-log.txt chmod 777 /home/pi/habridge/habridge-log.txt
``` ```
Exit and save the file with ctrl-X and follow the prompts and then execute on the command line: Exit and save the file with ctrl-X and follow the prompts and then execute on the command line:
@@ -1059,11 +1059,6 @@ GET http://host:80/description.xml
</device>\n </device>\n
</root>\n </root>\n
``` ```
## Debugging
To turn on debugging for the bridge, use the following extra parm in the command line:
```
-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG
```
## Development Mode ## Development Mode
To turn on development mode so that it will not need an Harmony Hub for testing, use the following extra parm in the command line and the harmony ip and login info will not be needed: To turn on development mode so that it will not need an Harmony Hub for testing, use the following extra parm in the command line and the harmony ip and login info will not be needed:
``` ```

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId> <groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId> <artifactId>ha-bridge</artifactId>
<version>4beta3.2</version> <version>4beta3.3</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>HA Bridge</name> <name>HA Bridge</name>

View File

@@ -32,8 +32,7 @@ public class UDPHome implements Home {
public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int intensity, public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int intensity,
Integer targetBri,Integer targetBriInc, DeviceDescriptor device, String body) { Integer targetBri,Integer targetBriInc, DeviceDescriptor device, String body) {
log.debug("executing HUE api request to UDP: " + anItem.getItem().getAsString()); log.debug("executing HUE api request to UDP: " + anItem.getItem().getAsString());
String intermediate = anItem.getItem().getAsString() String intermediate = anItem.getItem().getAsString().substring(anItem.getItem().getAsString().indexOf("://") + 3);
.substring(anItem.getItem().getAsString().indexOf("://") + 3);
String hostPortion = intermediate.substring(0, intermediate.indexOf('/')); String hostPortion = intermediate.substring(0, intermediate.indexOf('/'));
String theUrlBody = intermediate.substring(intermediate.indexOf('/') + 1); String theUrlBody = intermediate.substring(intermediate.indexOf('/') + 1);
String hostAddr = null; String hostAddr = null;
@@ -51,17 +50,14 @@ public class UDPHome implements Home {
} }
if (theUrlBody.startsWith("0x")) { if (theUrlBody.startsWith("0x")) {
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, true);
intensity, targetBri, targetBriInc, true);
sendData = DatatypeConverter.parseHexBinary(theUrlBody.substring(2)); sendData = DatatypeConverter.parseHexBinary(theUrlBody.substring(2));
} else { } else {
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, false);
intensity, targetBri, targetBriInc, false);
sendData = theUrlBody.getBytes(); sendData = theUrlBody.getBytes();
} }
try { try {
theUDPDatagramSender.sendUDPResponse(sendData, IPAddress, theUDPDatagramSender.sendUDPResponse(sendData, IPAddress, Integer.parseInt(port));
Integer.parseInt(port));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// noop // noop
} catch (IOException e) { } catch (IOException e) {

View File

@@ -2148,6 +2148,7 @@ app.controller('EditController', function ($scope, $location, $http, bridgeServi
$scope.newDimItem = {}; $scope.newDimItem = {};
$scope.newOffItem = {}; $scope.newOffItem = {};
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
$scope.mapTypeSelected = null;
}; };
$scope.editDevice = function (copy) { $scope.editDevice = function (copy) {
@@ -2161,7 +2162,10 @@ app.controller('EditController', function ($scope, $location, $http, bridgeServi
} }
if (copy) if (copy)
$scope.device.id = null; $scope.device.id = null;
$scope.device.mapType = $scope.mapTypeSelected[0]; if($scope.mapTypeSelected !== undefined && $scope.mapTypeSelected !== null)
$scope.device.mapType = $scope.mapTypeSelected[0];
else
$scope.device.mapType = null;
if ($scope.onDevices !== null) if ($scope.onDevices !== null)
$scope.device.onUrl = angular.toJson(bridgeService.updateCallObjectsType($scope.onDevices)); $scope.device.onUrl = angular.toJson(bridgeService.updateCallObjectsType($scope.onDevices));
if ($scope.dimDevices !== null) if ($scope.dimDevices !== null)