/payload, format of request unknown: " + theUrl);
- theUrlBody = TimeDecode.replaceTimeValue(theUrlBody);
- if (theUrlBody.startsWith("0x")) {
- theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, true);
- sendData = DatatypeConverter.parseHexBinary(theUrlBody.substring(2));
- } else {
- theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, false);
- sendData = theUrlBody.getBytes();
- }
- try {
- theUDPDatagramSender.sendUDPResponse(sendData, IPAddress, Integer.parseInt(port));
- } catch (NumberFormatException e) {
- log.warn("Udp Call, Number format exception on port, continuing...");
- } catch (IOException e) {
- log.warn("IO exception on udp call, continuing...");
- }
return null;
}
diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js
index e8ea1f0..612162d 100644
--- a/src/main/resources/public/scripts/app.js
+++ b/src/main/resources/public/scripts/app.js
@@ -1227,7 +1227,7 @@ app.controller('VeraController', function ($scope, $location, $http, bridgeServi
$scope.device = bridgeService.state.device;
};
- $scope.buildDeviceUrls = function (veradevice, dim_control) {
+ $scope.buildDeviceUrls = function (veradevice, dim_control, buildonly) {
if(dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0) {
dimpayload = "http://" + veradevice.veraaddress + ":" + $scope.vera.port
+ "/data_request?id=action&output_format=json&DeviceNum="
@@ -1248,8 +1248,10 @@ app.controller('VeraController', function ($scope, $location, $http, bridgeServi
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, veradevice.id, veradevice.name, veradevice.veraname, "switch", "veraDevice", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
$scope.buildSceneUrls = function (verascene) {
@@ -1268,10 +1270,11 @@ app.controller('VeraController', function ($scope, $location, $http, bridgeServi
$scope.bulkAddDevices = function(dim_control) {
var devicesList = [];
+ $scope.clearDevice();
for(var i = 0; i < $scope.bulk.devices.length; i++) {
for(var x = 0; x < bridgeService.state.veradevices.length; x++) {
if(bridgeService.state.veradevices[x].id === $scope.bulk.devices[i]) {
- $scope.buildDeviceUrls(bridgeService.state.veradevices[x],dim_control);
+ $scope.buildDeviceUrls(bridgeService.state.veradevices[x],dim_control,true);
devicesList[i] = {
name: $scope.device.name,
mapId: $scope.device.mapId,
@@ -1288,6 +1291,7 @@ app.controller('VeraController', function ($scope, $location, $http, bridgeServi
contentBodyDim: $scope.device.contentBodyDim,
contentBodyOff: $scope.device.contentBodyOff
};
+ $scope.clearDevice();
}
}
}
@@ -1331,7 +1335,7 @@ app.controller('VeraController', function ($scope, $location, $http, bridgeServi
else {
$scope.selectAll = true;
for(var x = 0; x < bridgeService.state.veradevices.length; x++) {
- if($scope.bulk.devices.indexOf(bridgeService.state.veradevices[x]) < 0 && !bridgeService.findDeviceByMapId(bridgeService.state.veradevices[x].id, bridgeService.state.veradevices[x].veraname, "veraDevice"))
+ if($scope.bulk.devices.indexOf(bridgeService.state.veradevices[x]) < 0)
$scope.bulk.devices.push(bridgeService.state.veradevices[x].id);
}
}
@@ -1541,16 +1545,19 @@ app.controller('HueController', function ($scope, $location, $http, bridgeServic
offpayload = "{\"ipAddress\":\"" + huedevice.hueaddress + "\",\"deviceId\":\"" + huedevice.huedeviceid +"\",\"hueName\":\"" + huedevice.huename + "\"}";
bridgeService.buildUrls(onpayload, null, offpayload, true, huedevice.device.uniqueid, huedevice.device.name, huedevice.huename, "passthru", "hueDevice", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
$scope.bulkAddDevices = function() {
var devicesList = [];
+ $scope.clearDevice();
for(var i = 0; i < $scope.bulk.devices.length; i++) {
for(var x = 0; x < bridgeService.state.huedevices.length; x++) {
if(bridgeService.state.huedevices[x].device.uniqueid === $scope.bulk.devices[i]) {
- $scope.buildDeviceUrls(bridgeService.state.huedevices[x]);
+ $scope.buildDeviceUrls(bridgeService.state.huedevices[x],true);
devicesList[i] = {
name: $scope.device.name,
mapId: $scope.device.mapId,
@@ -1567,6 +1574,7 @@ app.controller('HueController', function ($scope, $location, $http, bridgeServic
contentBodyDim: $scope.device.contentBodyDim,
contentBodyOff: $scope.device.contentBodyOff
};
+ $scope.clearDevice();
}
}
}
@@ -1654,7 +1662,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
$scope.device = bridgeService.state.device;
};
- $scope.buildDeviceUrls = function (haldevice, dim_control) {
+ $scope.buildDeviceUrls = function (haldevice, dim_control, buildonly) {
var preOnCmd = "";
var preDimCmd = "";
var preOffCmd = "";
@@ -1709,11 +1717,13 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
+ postCmd;
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname, haldevice.haldevicename, haldevice.halname, aDeviceType, "halDevice", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
- $scope.buildButtonUrls = function (haldevice, onbutton, offbutton) {
+ $scope.buildButtonUrls = function (haldevice, onbutton, offbutton, buildonly) {
var actionOn = angular.fromJson(onbutton);
var actionOff = angular.fromJson(offbutton);
onpayload = "http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken;
@@ -1721,20 +1731,24 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-" + actionOn.DeviceName, haldevice.haldevicename, haldevice.halname, "button", "halButton", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
- $scope.buildHALHomeUrls = function (haldevice) {
+ $scope.buildHALHomeUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Home?Token=" + $scope.bridge.settings.haltoken;
offpayload = "http://" + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Away?Token=" + $scope.bridge.settings.haltoken;
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-HomeAway", haldevice.haldevicename, haldevice.halname, "home", "halHome", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
- $scope.buildHALHeatUrls = function (haldevice) {
+ $scope.buildHALHeatUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
@@ -1752,11 +1766,13 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
+ $scope.bridge.settings.haltoken;
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-SetHeat", haldevice.haldevicename + " Heat", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
- $scope.buildHALCoolUrls = function (haldevice) {
+ $scope.buildHALCoolUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
@@ -1774,11 +1790,13 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
+ $scope.bridge.settings.haltoken;
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-SetCool", haldevice.haldevicename + " Cool", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
- $scope.buildHALAutoUrls = function (haldevice) {
+ $scope.buildHALAutoUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
@@ -1790,11 +1808,13 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
+ "!HVACMode=Off?Token="
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-SetAuto", haldevice.haldevicename + " Auto", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
- $scope.buildHALOffUrls = function (haldevice) {
+ $scope.buildHALOffUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
@@ -1807,11 +1827,13 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
$scope.device.offUrl = "http://" + haldevice.haladdress
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-TurnOff", haldevice.haldevicename + " Thermostat", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
- $scope.buildHALFanUrls = function (haldevice) {
+ $scope.buildHALFanUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
@@ -1824,21 +1846,24 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
+ $scope.bridge.settings.haltoken;
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-SetFan", haldevice.haldevicename + " Fan", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device;
- bridgeService.editNewDevice($scope.device);
- $location.path('/editdevice');
+ if (!buildonly) {
+ bridgeService.editNewDevice($scope.device);
+ $location.path('/editdevice');
+ }
};
$scope.bulkAddDevices = function(dim_control) {
var devicesList = [];
+ $scope.clearDevice();
for(var i = 0; i < $scope.bulk.devices.length; i++) {
for(var x = 0; x < bridgeService.state.haldevices.length; x++) {
if(bridgeService.state.haldevices[x].haldevicename === $scope.bulk.devices[i]) {
if(bridgeService.state.haldevices[x].haldevicetype === "HVAC")
- $scope.buildHALAutoUrls(bridgeService.state.haldevices[x]);
+ $scope.buildHALAutoUrls(bridgeService.state.haldevices[x], true);
else if(bridgeService.state.haldevices[x].haldevicetype === "HOME")
- $scope.buildHALHomeUrls(bridgeService.state.haldevices[x]);
+ $scope.buildHALHomeUrls(bridgeService.state.haldevices[x], true);
else
- $scope.buildDeviceUrls(bridgeService.state.haldevices[x],dim_control);
+ $scope.buildDeviceUrls(bridgeService.state.haldevices[x],dim_control, true);
devicesList[i] = {
name: $scope.device.name,
mapId: $scope.device.mapId,
@@ -1855,6 +1880,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
contentBodyDim: $scope.device.contentBodyDim,
contentBodyOff: $scope.device.contentBodyOff
};
+ $scope.clearDevice();
}
}
}
@@ -1897,7 +1923,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
else {
$scope.selectAll = true;
for(var x = 0; x < bridgeService.state.haldevices.length; x++) {
- if($scope.bulk.devices.indexOf(bridgeService.state.haldevices[x]) < 0 && !bridgeService.findDeviceByMapId(bridgeService.state.haldevices[x].haldevicename + "-" + bridgeService.state.haldevices[x].halname, bridgeService.state.haldevices[x].halname, "halDevice"))
+ if($scope.bulk.devices.indexOf(bridgeService.state.haldevices[x]) < 0)
$scope.bulk.devices.push(bridgeService.state.haldevices[x].haldevicename);
}
}
@@ -2191,7 +2217,7 @@ app.controller('DomoticzController', function ($scope, $location, $http, bridgeS
bridgeService.viewHalDevices();
},
function (error) {
- bridgeService.displayWarn("Error adding HAL devices in bulk.", error)
+ bridgeService.displayWarn("Error adding Domoticz devices in bulk.", error)
}
);
$scope.bulk = { devices: [] };
@@ -2223,8 +2249,8 @@ app.controller('DomoticzController', function ($scope, $location, $http, bridgeS
else {
$scope.selectAll = true;
for(var x = 0; x < bridgeService.state.haldevices.length; x++) {
- if($scope.bulk.devices.indexOf(bridgeService.state.haldevices[x]) < 0 && !bridgeService.findDeviceByMapId(bridgeService.state.haldevices[x].haldevicename + "-" + bridgeService.state.haldevices[x].halname, bridgeService.state.haldevices[x].halname, "halDevice"))
- $scope.bulk.devices.push(bridgeService.state.haldevices[x].haldevicename);
+ if($scope.bulk.devices.indexOf(bridgeService.state.domoticzdevices[x]) < 0)
+ $scope.bulk.devices.push(bridgeService.state.domoticzdevices[x].devicename);
}
}
};
@@ -2281,6 +2307,7 @@ app.controller('LifxController', function ($scope, $location, $http, bridgeServi
$scope.bulkAddDevices = function(dim_control) {
var devicesList = [];
+ $scope.clearDevice();
for(var i = 0; i < $scope.bulk.devices.length; i++) {
for(var x = 0; x < bridgeService.state.lifxdevices.length; x++) {
if(bridgeService.state.lifxdevices[x].devicename === $scope.bulk.devices[i]) {
@@ -2301,6 +2328,7 @@ app.controller('LifxController', function ($scope, $location, $http, bridgeServi
contentBodyDim: $scope.device.contentBodyDim,
contentBodyOff: $scope.device.contentBodyOff
};
+ $scope.clearDevice();
}
}
}
@@ -2343,8 +2371,8 @@ app.controller('LifxController', function ($scope, $location, $http, bridgeServi
else {
$scope.selectAll = true;
for(var x = 0; x < bridgeService.state.haldevices.length; x++) {
- if($scope.bulk.devices.indexOf(bridgeService.state.haldevices[x]) < 0 && !bridgeService.findDeviceByMapId(bridgeService.state.haldevices[x].haldevicename + "-" + bridgeService.state.haldevices[x].halname, bridgeService.state.haldevices[x].halname, "halDevice"))
- $scope.bulk.devices.push(bridgeService.state.haldevices[x].haldevicename);
+ if($scope.bulk.devices.indexOf(bridgeService.state.lifxdevices[x]) < 0)
+ $scope.bulk.devices.push(bridgeService.state.lifxdevices[x].devicename);
}
}
};
diff --git a/src/main/resources/public/views/domoticzdevice.html b/src/main/resources/public/views/domoticzdevice.html
index 2359739..7f4f151 100644
--- a/src/main/resources/public/views/domoticzdevice.html
+++ b/src/main/resources/public/views/domoticzdevice.html
@@ -76,7 +76,7 @@
| {{domoticzdevice.domoticzname}} |
+ ng-click="buildDeviceUrls(domoticzdevice, device_dim_control,false)">Build Item
|
diff --git a/src/main/resources/public/views/haldevice.html b/src/main/resources/public/views/haldevice.html
index a185dbe..13878cf 100644
--- a/src/main/resources/public/views/haldevice.html
+++ b/src/main/resources/public/views/haldevice.html
@@ -89,27 +89,27 @@
+ ng-click="buildDeviceUrls(haldevice, device_dim_control, false)">Build Item
+ ng-click="buildHALHomeUrls(haldevice, false)">Build Home/Away
-
+ ng-click="buildHALHeatUrls(haldevice, false)">Heat
+ ng-click="buildHALCoolUrls(haldevice, false)">Cool
+ ng-click="buildHALAutoUrls(haldevice, false)">Auto
+ ng-click="buildHALOffUrls(haldevice, false)">Off
+ ng-click="buildHALFanUrls(haldevice, false)">Fan
diff --git a/src/main/resources/public/views/huedevice.html b/src/main/resources/public/views/huedevice.html
index e3ae20d..7d9325c 100644
--- a/src/main/resources/public/views/huedevice.html
+++ b/src/main/resources/public/views/huedevice.html
@@ -65,7 +65,7 @@
| {{huedevice.huename}} |
+ ng-click="buildDeviceUrls(huedevice, false)">Build Item
|
diff --git a/src/main/resources/public/views/lifxdevice.html b/src/main/resources/public/views/lifxdevice.html
index 6278cea..465c557 100644
--- a/src/main/resources/public/views/lifxdevice.html
+++ b/src/main/resources/public/views/lifxdevice.html
@@ -59,7 +59,7 @@
{{lifxdev.type}} |
|
diff --git a/src/main/resources/public/views/veradevice.html b/src/main/resources/public/views/veradevice.html
index cba365c..68105af 100644
--- a/src/main/resources/public/views/veradevice.html
+++ b/src/main/resources/public/views/veradevice.html
@@ -80,7 +80,7 @@
{{veradevice.veraname}} |
+ ng-click="buildDeviceUrls(veradevice, device_dim_control, false)">Build Item
|