mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 16:17:30 +00:00
remove .map files and remove async from run function.
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -77,7 +77,7 @@ app.config (function ($locationProvider, $routeProvider) {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
app.run( async function ($rootScope, $location, Auth, bridgeService) {
|
app.run(function ($rootScope, $location, Auth, bridgeService) {
|
||||||
bridgeService.getHABridgeVersion();
|
bridgeService.getHABridgeVersion();
|
||||||
|
|
||||||
$rootScope.$on('securitySetupReceived', function(event, data) {
|
$rootScope.$on('securitySetupReceived', function(event, data) {
|
||||||
@@ -1317,15 +1317,14 @@ app.controller ('SystemController', function ($scope, $location, bridgeService,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.addHaltoSettings = function (newhalname, newhalip, newhasssecure) {
|
$scope.addHaltoSettings = function (newhalname, newhalip) {
|
||||||
if($scope.bridge.settings.haladdress === undefined || $scope.bridge.settings.haladdress === null) {
|
if($scope.bridge.settings.haladdress === undefined || $scope.bridge.settings.haladdress === null) {
|
||||||
$scope.bridge.settings.haladdress = { devices: [] };
|
$scope.bridge.settings.haladdress = { devices: [] };
|
||||||
}
|
}
|
||||||
var newhal = {name: newhalname, ip: newhalip, secure: newhasssecure}
|
var newhal = {name: newhalname, ip: newhalip }
|
||||||
$scope.bridge.settings.haladdress.devices.push(newhal);
|
$scope.bridge.settings.haladdress.devices.push(newhal);
|
||||||
$scope.newhalname = null;
|
$scope.newhalname = null;
|
||||||
$scope.newhalip = null;
|
$scope.newhalip = null;
|
||||||
$scope.newhasssecure = false;
|
|
||||||
};
|
};
|
||||||
$scope.removeHaltoSettings = function (halname, halip) {
|
$scope.removeHaltoSettings = function (halname, halip) {
|
||||||
for(var i = $scope.bridge.settings.haladdress.devices.length - 1; i >= 0; i--) {
|
for(var i = $scope.bridge.settings.haladdress.devices.length - 1; i >= 0; i--) {
|
||||||
@@ -2203,10 +2202,6 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
var preOffCmd = "";
|
var preOffCmd = "";
|
||||||
var nameCmd = "";
|
var nameCmd = "";
|
||||||
var aDeviceType;
|
var aDeviceType;
|
||||||
var httpType = "http://";
|
|
||||||
if(haldevice.secure)
|
|
||||||
httpType = "https://";
|
|
||||||
|
|
||||||
var postCmd = "?Token=" + $scope.bridge.settings.haltoken;
|
var postCmd = "?Token=" + $scope.bridge.settings.haltoken;
|
||||||
if(haldevice.haldevicetype === "Group") {
|
if(haldevice.haldevicetype === "Group") {
|
||||||
aDeviceType = "group";
|
aDeviceType = "group";
|
||||||
@@ -2232,24 +2227,24 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
nameCmd = "!DeviceName=";
|
nameCmd = "!DeviceName=";
|
||||||
}
|
}
|
||||||
if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0) && aDeviceType === "switch")
|
if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0) && aDeviceType === "switch")
|
||||||
dimpayload = httpType + haldevice.haladdress
|
dimpayload = "http://" + haldevice.haladdress
|
||||||
+ preDimCmd
|
+ preDimCmd
|
||||||
+ dim_control
|
+ dim_control
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ postCmd;
|
+ postCmd;
|
||||||
else
|
else
|
||||||
dimpayload = httpType + haldevice.haladdress
|
dimpayload = "http://" + haldevice.haladdress
|
||||||
+ preOnCmd
|
+ preOnCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ postCmd;
|
+ postCmd;
|
||||||
onpayload = httpType + haldevice.haladdress
|
onpayload = "http://" + haldevice.haladdress
|
||||||
+ preOnCmd
|
+ preOnCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ postCmd;
|
+ postCmd;
|
||||||
offpayload = httpType + haldevice.haladdress
|
offpayload = "http://" + haldevice.haladdress
|
||||||
+ preOffCmd
|
+ preOffCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
@@ -2265,11 +2260,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 httpType = "http://";
|
onpayload = "http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken;
|
||||||
if(haldevice.secure)
|
offpayload = "http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken;
|
||||||
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);
|
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;
|
$scope.device = bridgeService.state.device;
|
||||||
@@ -2280,11 +2272,8 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALHomeUrls = function (haldevice, buildonly) {
|
$scope.buildHALHomeUrls = function (haldevice, buildonly) {
|
||||||
var httpType = "http://";
|
onpayload = "http://" + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Home?Token=" + $scope.bridge.settings.haltoken;
|
||||||
if(haldevice.secure)
|
offpayload = "http://" + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Away?Token=" + $scope.bridge.settings.haltoken;
|
||||||
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);
|
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-HomeAway", haldevice.haldevicename, haldevice.halname, "home", "halHome", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
@@ -2294,20 +2283,17 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALHeatUrls = function (haldevice, buildonly) {
|
$scope.buildHALHeatUrls = function (haldevice, buildonly) {
|
||||||
var httpType = "http://";
|
onpayload = "http://" + haldevice.haladdress
|
||||||
if(haldevice.secure)
|
|
||||||
httpType = "https://";
|
|
||||||
onpayload = httpType + haldevice.haladdress
|
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Heat?Token="
|
+ "!HVACMode=Heat?Token="
|
||||||
+ $scope.bridge.settings.haltoken;
|
+ $scope.bridge.settings.haltoken;
|
||||||
dimpayload = httpType + haldevice.haladdress
|
dimpayload = "http://" + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Heat!HeatSpValue=${intensity.percent}?Token="
|
+ "!HVACMode=Heat!HeatSpValue=${intensity.percent}?Token="
|
||||||
+ $scope.bridge.settings.haltoken;
|
+ $scope.bridge.settings.haltoken;
|
||||||
offpayload = httpType + haldevice.haladdress
|
offpayload = "http://" + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off?Token="
|
+ "!HVACMode=Off?Token="
|
||||||
@@ -2321,20 +2307,17 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALCoolUrls = function (haldevice, buildonly) {
|
$scope.buildHALCoolUrls = function (haldevice, buildonly) {
|
||||||
var httpType = "http://";
|
onpayload = "http://" + haldevice.haladdress
|
||||||
if(haldevice.secure)
|
|
||||||
httpType = "https://";
|
|
||||||
onpayload = httpType + haldevice.haladdress
|
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Cool?Token="
|
+ "!HVACMode=Cool?Token="
|
||||||
+ $scope.bridge.settings.haltoken;
|
+ $scope.bridge.settings.haltoken;
|
||||||
dimpayload = httpType + haldevice.haladdress
|
dimpayload = "http://" + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Cool!CoolSpValue=${intensity.percent}?Token="
|
+ "!HVACMode=Cool!CoolSpValue=${intensity.percent}?Token="
|
||||||
+ $scope.bridge.settings.haltoken;
|
+ $scope.bridge.settings.haltoken;
|
||||||
offpayload = httpType + haldevice.haladdress
|
offpayload = "http://" + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off?Token="
|
+ "!HVACMode=Off?Token="
|
||||||
@@ -2348,15 +2331,12 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALAutoUrls = function (haldevice, buildonly) {
|
$scope.buildHALAutoUrls = function (haldevice, buildonly) {
|
||||||
var httpType = "http://";
|
onpayload = "http://" + haldevice.haladdress
|
||||||
if(haldevice.secure)
|
|
||||||
httpType = "https://";
|
|
||||||
onpayload = httpType + haldevice.haladdress
|
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Auto?Token="
|
+ "!HVACMode=Auto?Token="
|
||||||
+ $scope.bridge.settings.haltoken;
|
+ $scope.bridge.settings.haltoken;
|
||||||
offpayload = httpType + haldevice.haladdress
|
offpayload = "http://" + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off?Token="
|
+ "!HVACMode=Off?Token="
|
||||||
@@ -2369,18 +2349,16 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALOffUrls = function (haldevice, buildonly) {
|
$scope.buildHALOffUrls = function (haldevice, buildonly) {
|
||||||
var httpType = "http://";
|
onpayload = "http://" + haldevice.haladdress
|
||||||
if(haldevice.secure)
|
|
||||||
httpType = "https://";
|
|
||||||
onpayload = httpType + haldevice.haladdress
|
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Auto?Token="
|
+ "!HVACMode=Auto?Token="
|
||||||
+ $scope.bridge.settings.haltoken;
|
+ $scope.bridge.settings.haltoken;
|
||||||
offpayload = httpType + haldevice.haladdress
|
offpayload = "http://" + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off?Token="
|
+ "!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);
|
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;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
@@ -2390,15 +2368,12 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALFanUrls = function (haldevice, buildonly) {
|
$scope.buildHALFanUrls = function (haldevice, buildonly) {
|
||||||
var httpType = "http://";
|
onpayload = "http://" + haldevice.haladdress
|
||||||
if(haldevice.secure)
|
|
||||||
httpType = "https://";
|
|
||||||
onpayload = httpType + haldevice.haladdress
|
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!FanMode=On?Token="
|
+ "!FanMode=On?Token="
|
||||||
+ $scope.bridge.settings.haltoken;
|
+ $scope.bridge.settings.haltoken;
|
||||||
offpayload = httpType + haldevice.haladdress
|
offpayload = "http://" + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!FanMode=Auto?Token="
|
+ "!FanMode=Auto?Token="
|
||||||
@@ -3408,7 +3383,6 @@ app.controller('LoginController', function ($scope, $location, Auth) {
|
|||||||
$scope.logout = function() {
|
$scope.logout = function() {
|
||||||
Auth.logout();
|
Auth.logout();
|
||||||
$scope.loggedIn = Auth.isLoggedIn();
|
$scope.loggedIn = Auth.isLoggedIn();
|
||||||
bridgeService.displaySuccess("User Logged Out");
|
|
||||||
$location.path("/login");
|
$location.path("/login");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user