Implement devimal percent for no locale, add HAL https and debugging for

link buttton usage.
This commit is contained in:
Admin
2017-05-19 15:45:56 -05:00
parent 19256e4eaa
commit 62b896ee07
10 changed files with 83 additions and 37 deletions

View File

@@ -1317,14 +1317,15 @@ app.controller ('SystemController', function ($scope, $location, bridgeService,
}
}
};
$scope.addHaltoSettings = function (newhalname, newhalip) {
$scope.addHaltoSettings = function (newhalname, newhalip, newhasssecure) {
if($scope.bridge.settings.haladdress === undefined || $scope.bridge.settings.haladdress === null) {
$scope.bridge.settings.haladdress = { devices: [] };
}
var newhal = {name: newhalname, ip: newhalip }
var newhal = {name: newhalname, ip: newhalip, secure: newhasssecure}
$scope.bridge.settings.haladdress.devices.push(newhal);
$scope.newhalname = null;
$scope.newhalip = null;
$scope.newhasssecure = false;
};
$scope.removeHaltoSettings = function (halname, halip) {
for(var i = $scope.bridge.settings.haladdress.devices.length - 1; i >= 0; i--) {
@@ -2202,6 +2203,10 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
var preOffCmd = "";
var nameCmd = "";
var aDeviceType;
var httpType = "http://";
if(haldevice.secure)
httpType = "https://";
var postCmd = "?Token=" + $scope.bridge.settings.haltoken;
if(haldevice.haldevicetype === "Group") {
aDeviceType = "group";
@@ -2227,24 +2232,24 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
nameCmd = "!DeviceName=";
}
if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0) && aDeviceType === "switch")
dimpayload = "http://" + haldevice.haladdress
dimpayload = httpType + haldevice.haladdress
+ preDimCmd
+ dim_control
+ nameCmd
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ postCmd;
else
dimpayload = "http://" + haldevice.haladdress
dimpayload = httpType + haldevice.haladdress
+ preOnCmd
+ nameCmd
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ postCmd;
onpayload = "http://" + haldevice.haladdress
onpayload = httpType + haldevice.haladdress
+ preOnCmd
+ nameCmd
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ postCmd;
offpayload = "http://" + haldevice.haladdress
offpayload = httpType + haldevice.haladdress
+ preOffCmd
+ nameCmd
+ haldevice.haldevicename.replaceAll(" ", "%20")
@@ -2260,8 +2265,11 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
$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;
offpayload = "http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken;
var httpType = "http://";
if(haldevice.secure)
httpType = "https://";
onpayload = httpType + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken;
offpayload = httpType + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken;
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;
@@ -2272,8 +2280,11 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
};
$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;
var httpType = "http://";
if(haldevice.secure)
httpType = "https://";
onpayload = httpType + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Home?Token=" + $scope.bridge.settings.haltoken;
offpayload = httpType + 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;
if (!buildonly) {
@@ -2283,17 +2294,20 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
};
$scope.buildHALHeatUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
var httpType = "http://";
if(haldevice.secure)
httpType = "https://";
onpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Heat?Token="
+ $scope.bridge.settings.haltoken;
dimpayload = "http://" + haldevice.haladdress
dimpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Heat!HeatSpValue=${intensity.percent}?Token="
+ $scope.bridge.settings.haltoken;
offpayload = "http://" + haldevice.haladdress
offpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Off?Token="
@@ -2307,17 +2321,20 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
};
$scope.buildHALCoolUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
var httpType = "http://";
if(haldevice.secure)
httpType = "https://";
onpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Cool?Token="
+ $scope.bridge.settings.haltoken;
dimpayload = "http://" + haldevice.haladdress
dimpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Cool!CoolSpValue=${intensity.percent}?Token="
+ $scope.bridge.settings.haltoken;
offpayload = "http://" + haldevice.haladdress
offpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Off?Token="
@@ -2331,12 +2348,15 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
};
$scope.buildHALAutoUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
var httpType = "http://";
if(haldevice.secure)
httpType = "https://";
onpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Auto?Token="
+ $scope.bridge.settings.haltoken;
offpayload = "http://" + haldevice.haladdress
offpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Off?Token="
@@ -2349,16 +2369,18 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
};
$scope.buildHALOffUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
var httpType = "http://";
if(haldevice.secure)
httpType = "https://";
onpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Auto?Token="
+ $scope.bridge.settings.haltoken;
offpayload = "http://" + haldevice.haladdress
offpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Off?Token="
$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;
if (!buildonly) {
@@ -2368,12 +2390,15 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
};
$scope.buildHALFanUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress
var httpType = "http://";
if(haldevice.secure)
httpType = "https://";
onpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!FanMode=On?Token="
+ $scope.bridge.settings.haltoken;
offpayload = "http://" + haldevice.haladdress
offpayload = httpType + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20")
+ "!FanMode=Auto?Token="