mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 00:10:20 +00:00
Updating HAL changes
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.bwssystems.HABridge</groupId>
|
<groupId>com.bwssystems.HABridge</groupId>
|
||||||
<artifactId>ha-bridge</artifactId>
|
<artifactId>ha-bridge</artifactId>
|
||||||
<version>4.5.1</version>
|
<version>4.5.1a</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -385,8 +385,10 @@ public class BridgeSettingsDescriptor {
|
|||||||
List<NamedIP> devicesList = this.getHaladdress().getDevices();
|
List<NamedIP> devicesList = this.getHaladdress().getDevices();
|
||||||
if(devicesList.get(0).getIp().contains(Configuration.DEFAULT_ADDRESS))
|
if(devicesList.get(0).getIp().contains(Configuration.DEFAULT_ADDRESS))
|
||||||
return false;
|
return false;
|
||||||
if(this.getHaltoken() == null || this.getHaltoken().equals(""))
|
if(devicesList.get(0).getPassword() == null || devicesList.get(0).getPassword().trim().isEmpty()) {
|
||||||
return false;
|
if(this.getHaltoken() == null || this.getHaltoken().equals(""))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public Boolean isValidMQTT() {
|
public Boolean isValidMQTT() {
|
||||||
|
|||||||
@@ -129,10 +129,9 @@ public class HalHome implements Home {
|
|||||||
+ (anItem.getHttpVerb() == null ? "GET" : anItem.getHttpVerb()) + ": "
|
+ (anItem.getHttpVerb() == null ? "GET" : anItem.getHttpVerb()) + ": "
|
||||||
+ anItem.getItem().getAsString());
|
+ anItem.getItem().getAsString());
|
||||||
|
|
||||||
String anUrl = intermediate;
|
String anUrl = null;
|
||||||
|
|
||||||
anUrl = BrightnessDecode.calculateReplaceIntensityValue(anUrl,
|
anUrl = BrightnessDecode.calculateReplaceIntensityValue(intermediate, intensity, targetBri, targetBriInc, false);
|
||||||
intensity, targetBri, targetBriInc, false);
|
|
||||||
anUrl = DeviceDataDecode.replaceDeviceData(anUrl, device);
|
anUrl = DeviceDataDecode.replaceDeviceData(anUrl, device);
|
||||||
anUrl = TimeDecode.replaceTimeValue(anUrl);
|
anUrl = TimeDecode.replaceTimeValue(anUrl);
|
||||||
|
|
||||||
@@ -143,6 +142,10 @@ public class HalHome implements Home {
|
|||||||
anUrl = "https://" + anUrl;
|
anUrl = "https://" + anUrl;
|
||||||
else
|
else
|
||||||
anUrl = "http://" + anUrl;
|
anUrl = "http://" + anUrl;
|
||||||
|
|
||||||
|
if(!anUrl.contains("?Token="))
|
||||||
|
anUrl = anUrl + "?Token=" + entry.getValue().getHalAddress().getPassword();
|
||||||
|
|
||||||
if (entry.getValue().deviceCommand(anUrl) == null) {
|
if (entry.getValue().deviceCommand(anUrl) == null) {
|
||||||
log.warn("Error on calling hal to change device state: " + anUrl);
|
log.warn("Error on calling hal to change device state: " + anUrl);
|
||||||
responseString = new Gson().toJson(HueErrorResponse.createResponse("6", "/lights/" + lightId,
|
responseString = new Gson().toJson(HueErrorResponse.createResponse("6", "/lights/" + lightId,
|
||||||
|
|||||||
@@ -125,7 +125,10 @@ public class HalInfo {
|
|||||||
HalDevice aNewHalDevice = new HalDevice();
|
HalDevice aNewHalDevice = new HalDevice();
|
||||||
aNewHalDevice.setHaldevicetype(deviceType);
|
aNewHalDevice.setHaldevicetype(deviceType);
|
||||||
aNewHalDevice.setHaldevicename(theDevice.getDeviceName());
|
aNewHalDevice.setHaldevicename(theDevice.getDeviceName());
|
||||||
aNewHalDevice.setHaladdress(halAddress);
|
NamedIP theaddress = new NamedIP();
|
||||||
|
theaddress.setIp(halAddress.getIp());
|
||||||
|
theaddress.setName(halAddress.getName());
|
||||||
|
aNewHalDevice.setHaladdress(theaddress);
|
||||||
deviceList.add(aNewHalDevice);
|
deviceList.add(aNewHalDevice);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
|
|||||||
if (error.status === 401)
|
if (error.status === 401)
|
||||||
$rootScope.$broadcast('securityReinit', 'done');
|
$rootScope.$broadcast('securityReinit', 'done');
|
||||||
else
|
else
|
||||||
self.displayWarn("Cannot get testuser: ", error);
|
self.displayWarn("Cannot get testuser: ", error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
|
|||||||
if (error.status === 401)
|
if (error.status === 401)
|
||||||
$rootScope.$broadcast('securityReinit', 'done');
|
$rootScope.$broadcast('securityReinit', 'done');
|
||||||
else
|
else
|
||||||
self.displayWarn("Cannot get a user: ", error);
|
self.displayWarn("Cannot get a user: ", error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1134,6 +1134,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
|
|||||||
|
|
||||||
this.testUrl = function (device, type, value) {
|
this.testUrl = function (device, type, value) {
|
||||||
var msgDescription = "unknown";
|
var msgDescription = "unknown";
|
||||||
|
self.getTestUser();
|
||||||
var testUrl = this.state.huebase + "/" + this.state.testuser + "/lights/" + device.id + "/state";
|
var testUrl = this.state.huebase + "/" + this.state.testuser + "/lights/" + device.id + "/state";
|
||||||
var testBody = "{\"on\":";
|
var testBody = "{\"on\":";
|
||||||
if (type === "off") {
|
if (type === "off") {
|
||||||
@@ -1151,8 +1152,13 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
|
|||||||
msgDescription = "success " + angular.toJson(response.data);
|
msgDescription = "success " + angular.toJson(response.data);
|
||||||
}
|
}
|
||||||
if (typeof(response.data[0].error) !== 'undefined') {
|
if (typeof(response.data[0].error) !== 'undefined') {
|
||||||
msgDescription = "error " + angular.toJson(response.data[0].error);
|
if(reponse.data[0].error.indexOf("unauthorized") > -1) {
|
||||||
self.displayErrorMessage("Request Error, Pleae look in your habridge log: ", msgDescription);
|
self.displayWarn("Authorization error, please retry...", null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msgDescription = "error " + angular.toJson(response.data[0].error);
|
||||||
|
self.displayErrorMessage("Request Error, Please look in your habridge log: ", msgDescription);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2202,11 +2208,6 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
var preOffCmd = "";
|
var preOffCmd = "";
|
||||||
var nameCmd = "";
|
var nameCmd = "";
|
||||||
var aDeviceType;
|
var aDeviceType;
|
||||||
var postCmd = "?Token=";
|
|
||||||
if(haldevice.haladdress.password === undefined || haldevice.haladdress.password === null || haldevice.haladdress.password.lenght === 0)
|
|
||||||
postCmd = postCmd + $scope.bridge.settings.haltoken;
|
|
||||||
else
|
|
||||||
postCmd = postCmd + haldevice.haladdress.password;
|
|
||||||
if(haldevice.haldevicetype === "Group") {
|
if(haldevice.haldevicetype === "Group") {
|
||||||
aDeviceType = "group";
|
aDeviceType = "group";
|
||||||
preOnCmd = "/GroupService!GroupCmd=On";
|
preOnCmd = "/GroupService!GroupCmd=On";
|
||||||
@@ -2235,24 +2236,20 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
+ preDimCmd
|
+ preDimCmd
|
||||||
+ dim_control
|
+ dim_control
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20");
|
||||||
+ postCmd;
|
|
||||||
else
|
else
|
||||||
dimpayload = "http://" + haldevice.haladdress.ip
|
dimpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ preOnCmd
|
+ preOnCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20");
|
||||||
+ postCmd;
|
|
||||||
onpayload = "http://" + haldevice.haladdress.ip
|
onpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ preOnCmd
|
+ preOnCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20");
|
||||||
+ postCmd;
|
|
||||||
offpayload = "http://" + haldevice.haladdress.ip
|
offpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ preOffCmd
|
+ preOffCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20");
|
||||||
+ postCmd;
|
|
||||||
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name, haldevice.haldevicename, haldevice.haladdress.name, aDeviceType, "halDevice", null, null);
|
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name, haldevice.haldevicename, haldevice.haladdress.name, aDeviceType, "halDevice", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
@@ -2264,13 +2261,8 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
$scope.buildButtonUrls = function (haldevice, onbutton, offbutton, buildonly) {
|
$scope.buildButtonUrls = function (haldevice, onbutton, offbutton, buildonly) {
|
||||||
var actionOn = angular.fromJson(onbutton);
|
var actionOn = angular.fromJson(onbutton);
|
||||||
var actionOff = angular.fromJson(offbutton);
|
var actionOff = angular.fromJson(offbutton);
|
||||||
var postCmd = "?Token=";
|
onpayload = "http://" + haldevice.haladdress.ip + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20");
|
||||||
if(haldevice.haladdress.password === undefined || haldevice.haladdress.password === null || haldevice.haladdress.password.lenght === 0)
|
offpayload = "http://" + haldevice.haladdress.ip + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20");
|
||||||
postCmd = postCmd + $scope.bridge.settings.haltoken;
|
|
||||||
else
|
|
||||||
postCmd = postCmd + haldevice.haladdress.password;
|
|
||||||
onpayload = "http://" + haldevice.haladdress.ip + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20") + postCmd;
|
|
||||||
offpayload = "http://" + haldevice.haladdress.ip + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20") + postCmd;
|
|
||||||
|
|
||||||
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-" + actionOn.DeviceName, haldevice.haldevicename, haldevice.haladdress.name, "button", "halButton", null, null);
|
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-" + actionOn.DeviceName, haldevice.haldevicename, haldevice.haladdress.name, "button", "halButton", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
@@ -2281,13 +2273,8 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALHomeUrls = function (haldevice, buildonly) {
|
$scope.buildHALHomeUrls = function (haldevice, buildonly) {
|
||||||
var postCmd = "?Token=";
|
onpayload = "http://" + haldevice.haladdress.ip + "/ModeService!ModeCmd=Set!ModeName=Home";
|
||||||
if(haldevice.haladdress.password === undefined || haldevice.haladdress.password === null || haldevice.haladdress.password.lenght === 0)
|
offpayload = "http://" + haldevice.haladdress.ip + "/ModeService!ModeCmd=Set!ModeName=Away";
|
||||||
postCmd = postCmd + $scope.bridge.settings.haltoken;
|
|
||||||
else
|
|
||||||
postCmd = postCmd + haldevice.haladdress.password;
|
|
||||||
onpayload = "http://" + haldevice.haladdress.ip + "/ModeService!ModeCmd=Set!ModeName=Home" + postCmd;
|
|
||||||
offpayload = "http://" + haldevice.haladdress.ip + "/ModeService!ModeCmd=Set!ModeName=Away" + postCmd;
|
|
||||||
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-HomeAway", haldevice.haldevicename, haldevice.haladdress.name, "home", "halHome", null, null);
|
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-HomeAway", haldevice.haldevicename, haldevice.haladdress.name, "home", "halHome", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
@@ -2297,23 +2284,18 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALHeatUrls = function (haldevice, buildonly) {
|
$scope.buildHALHeatUrls = function (haldevice, buildonly) {
|
||||||
var postCmd = "?Token=";
|
|
||||||
if(haldevice.haladdress.password === undefined || haldevice.haladdress.password === null || haldevice.haladdress.password.lenght === 0)
|
|
||||||
postCmd = postCmd + $scope.bridge.settings.haltoken;
|
|
||||||
else
|
|
||||||
postCmd = postCmd + haldevice.haladdress.password;
|
|
||||||
onpayload = "http://" + haldevice.haladdress.ip
|
onpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Heat" + postCmd;
|
+ "!HVACMode=Heat";
|
||||||
dimpayload = "http://" + haldevice.haladdress.ip
|
dimpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Heat!HeatSpValue=${intensity.percent}" + postCmd;
|
+ "!HVACMode=Heat!HeatSpValue=${intensity.percent}";
|
||||||
offpayload = "http://" + haldevice.haladdress.ip
|
offpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off" + postCmd;
|
+ "!HVACMode=Off";
|
||||||
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetHeat", haldevice.haldevicename + " Heat", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetHeat", haldevice.haldevicename + " Heat", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
@@ -2323,23 +2305,18 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALCoolUrls = function (haldevice, buildonly) {
|
$scope.buildHALCoolUrls = function (haldevice, buildonly) {
|
||||||
var postCmd = "?Token=";
|
|
||||||
if(haldevice.haladdress.password === undefined || haldevice.haladdress.password === null || haldevice.haladdress.password.lenght === 0)
|
|
||||||
postCmd = postCmd + $scope.bridge.settings.haltoken;
|
|
||||||
else
|
|
||||||
postCmd = postCmd + haldevice.haladdress.password;
|
|
||||||
onpayload = "http://" + haldevice.haladdress.ip
|
onpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Cool" + postCmd;
|
+ "!HVACMode=Cool";
|
||||||
dimpayload = "http://" + haldevice.haladdress.ip
|
dimpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Cool!CoolSpValue=${intensity.percent}" + postCmd;
|
+ "!HVACMode=Cool!CoolSpValue=${intensity.percent}";
|
||||||
offpayload = "http://" + haldevice.haladdress.ip
|
offpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off" + postCmd;
|
+ "!HVACMode=Off";
|
||||||
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetCool", haldevice.haldevicename + " Cool", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetCool", haldevice.haldevicename + " Cool", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
@@ -2349,19 +2326,14 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALAutoUrls = function (haldevice, buildonly) {
|
$scope.buildHALAutoUrls = function (haldevice, buildonly) {
|
||||||
var postCmd = "?Token=";
|
|
||||||
if(haldevice.haladdress.password === undefined || haldevice.haladdress.password === null || haldevice.haladdress.password.lenght === 0)
|
|
||||||
postCmd = postCmd + $scope.bridge.settings.haltoken;
|
|
||||||
else
|
|
||||||
postCmd = postCmd + haldevice.haladdress.password;
|
|
||||||
onpayload = "http://" + haldevice.haladdress.ip
|
onpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Auto" + postCmd;
|
+ "!HVACMode=Auto";
|
||||||
offpayload = "http://" + haldevice.haladdress.ip
|
offpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off" + postCmd;
|
+ "!HVACMode=Off";
|
||||||
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetAuto", haldevice.haldevicename + " Auto", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetAuto", haldevice.haldevicename + " Auto", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
@@ -2371,19 +2343,14 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALOffUrls = function (haldevice, buildonly) {
|
$scope.buildHALOffUrls = function (haldevice, buildonly) {
|
||||||
var postCmd = "?Token=";
|
|
||||||
if(haldevice.haladdress.password === undefined || haldevice.haladdress.password === null || haldevice.haladdress.password.lenght === 0)
|
|
||||||
postCmd = postCmd + $scope.bridge.settings.haltoken;
|
|
||||||
else
|
|
||||||
postCmd = postCmd + haldevice.haladdress.password;
|
|
||||||
onpayload = "http://" + haldevice.haladdress.ip
|
onpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Auto" + postCmd;
|
+ "!HVACMode=Auto";
|
||||||
offpayload = "http://" + haldevice.haladdress.ip
|
offpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off" + postCmd;
|
+ "!HVACMode=Off";
|
||||||
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-TurnOff", haldevice.haldevicename + " Thermostat", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-TurnOff", haldevice.haldevicename + " Thermostat", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
@@ -2393,19 +2360,14 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALFanUrls = function (haldevice, buildonly) {
|
$scope.buildHALFanUrls = function (haldevice, buildonly) {
|
||||||
var postCmd = "?Token=";
|
|
||||||
if(haldevice.haladdress.password === undefined || haldevice.haladdress.password === null || haldevice.haladdress.password.lenght === 0)
|
|
||||||
postCmd = postCmd + $scope.bridge.settings.haltoken;
|
|
||||||
else
|
|
||||||
postCmd = postCmd + haldevice.haladdress.password;
|
|
||||||
onpayload = "http://" + haldevice.haladdress.ip
|
onpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!FanMode=On" + postCmd;
|
+ "!FanMode=On";
|
||||||
offpayload = "http://" + haldevice.haladdress.ip
|
offpayload = "http://" + haldevice.haladdress.ip
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!FanMode=Auto" + postCmd;
|
+ "!FanMode=Auto";
|
||||||
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetFan", haldevice.haldevicename + " Fan", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetFan", haldevice.haldevicename + " Fan", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
|
|||||||
Reference in New Issue
Block a user