mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 16:17:30 +00:00
Implement devimal percent for no locale, add HAL https and debugging for
link buttton usage.
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.0a</version>
|
<version>4.5.0b</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -212,26 +212,26 @@ public class BridgeSecurity {
|
|||||||
Iterator<String> userIterator = theUserIds.iterator();
|
Iterator<String> userIterator = theUserIds.iterator();
|
||||||
while (userIterator.hasNext()) {
|
while (userIterator.hasNext()) {
|
||||||
validUser = userIterator.next();
|
validUser = userIterator.next();
|
||||||
if (validUser.equals(aUser))
|
if (validUser.equals(aUser)) {
|
||||||
found = true;
|
found = true;
|
||||||
|
log.debug("validateWhitelistUser: found a user <" + aUser + ">");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found && !strict) {
|
if(!found && !strict) {
|
||||||
|
log.debug("validateWhitelistUser: a user was not found and it is not strict rules <" + aUser + "> being created");
|
||||||
newWhitelistUser(aUser, userDescription);
|
newWhitelistUser(aUser, userDescription);
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
return HueErrorResponse.createResponse("1", "/api/" + aUser, "unauthorized user", null, null, null).getTheErrors();
|
log.debug("validateWhitelistUser: a user was not found and it is strict rules <" + aUser + ">");
|
||||||
|
return HueErrorResponse.createResponse("1", "/api/" + aUser == null ? "" : aUser, "unauthorized user", null, null, null).getTheErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
Object anUser = securityDescriptor.getWhitelist().remove(DEPRACATED_INTERNAL_USER);
|
|
||||||
if(anUser != null)
|
|
||||||
setSettingsChanged(true);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class HABridge {
|
|||||||
staticFileLocation("/public");
|
staticFileLocation("/public");
|
||||||
while(!bridgeSettings.getBridgeControl().isStop()) {
|
while(!bridgeSettings.getBridgeControl().isStop()) {
|
||||||
bridgeSettings.buildSettings();
|
bridgeSettings.buildSettings();
|
||||||
|
bridgeSettings.getBridgeSecurity().removeTestUsers();
|
||||||
log.info("HA Bridge initializing....");
|
log.info("HA Bridge initializing....");
|
||||||
// sparkjava config directive to set ip address for the web server to listen on
|
// sparkjava config directive to set ip address for the web server to listen on
|
||||||
ipAddress(bridgeSettings.getBridgeSettingsDescriptor().getWebaddress());
|
ipAddress(bridgeSettings.getBridgeSettingsDescriptor().getWebaddress());
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.bwssystems.HABridge.hue;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Conversion;
|
import org.apache.commons.lang3.Conversion;
|
||||||
@@ -83,7 +84,7 @@ public class BrightnessDecode {
|
|||||||
replaceTarget = INTENSITY_PERCENT_HEX;
|
replaceTarget = INTENSITY_PERCENT_HEX;
|
||||||
notDone = true;
|
notDone = true;
|
||||||
} else if (request.contains(INTENSITY_DECIMAL_PERCENT)) {
|
} else if (request.contains(INTENSITY_DECIMAL_PERCENT)) {
|
||||||
replaceValue = String.format("%1.2f", decimalBrightness);
|
replaceValue = String.format(Locale.ROOT, "%1.2f", decimalBrightness);
|
||||||
replaceTarget = INTENSITY_DECIMAL_PERCENT;
|
replaceTarget = INTENSITY_DECIMAL_PERCENT;
|
||||||
notDone = true;
|
notDone = true;
|
||||||
} else if (request.contains(INTENSITY_MATH_CLOSE)) {
|
} else if (request.contains(INTENSITY_MATH_CLOSE)) {
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public class HueMulator {
|
|||||||
public void setupServer() {
|
public void setupServer() {
|
||||||
log.info("Hue emulator service started....");
|
log.info("Hue emulator service started....");
|
||||||
before(HUE_CONTEXT + "/*", (request, response) -> {
|
before(HUE_CONTEXT + "/*", (request, response) -> {
|
||||||
|
log.debug("HueMulator GET called on api/* with request <" + request.pathInfo() + ">");
|
||||||
if(bridgeSettingMaster.getBridgeSecurity().isSecure()) {
|
if(bridgeSettingMaster.getBridgeSecurity().isSecure()) {
|
||||||
String pathInfo = request.pathInfo();
|
String pathInfo = request.pathInfo();
|
||||||
if(pathInfo != null && pathInfo.contains(HUE_CONTEXT + "/devices")) {
|
if(pathInfo != null && pathInfo.contains(HUE_CONTEXT + "/devices")) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ public class HalDevice {
|
|||||||
private String haldevicename;
|
private String haldevicename;
|
||||||
private String haladdress;
|
private String haladdress;
|
||||||
private String halname;
|
private String halname;
|
||||||
|
private Boolean secure;
|
||||||
private DeviceElements buttons;
|
private DeviceElements buttons;
|
||||||
public String getHaldevicetype() {
|
public String getHaldevicetype() {
|
||||||
return haldevicetype;
|
return haldevicetype;
|
||||||
@@ -30,6 +31,12 @@ public class HalDevice {
|
|||||||
public void setHalname(String halname) {
|
public void setHalname(String halname) {
|
||||||
this.halname = halname;
|
this.halname = halname;
|
||||||
}
|
}
|
||||||
|
public Boolean getSecure() {
|
||||||
|
return secure;
|
||||||
|
}
|
||||||
|
public void setSecure(Boolean secure) {
|
||||||
|
this.secure = secure;
|
||||||
|
}
|
||||||
public DeviceElements getButtons() {
|
public DeviceElements getButtons() {
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.bwssystems.HABridge.BridgeSettings;
|
|||||||
import com.bwssystems.HABridge.Home;
|
import com.bwssystems.HABridge.Home;
|
||||||
import com.bwssystems.HABridge.NamedIP;
|
import com.bwssystems.HABridge.NamedIP;
|
||||||
import com.bwssystems.HABridge.api.CallItem;
|
import com.bwssystems.HABridge.api.CallItem;
|
||||||
import com.bwssystems.HABridge.api.NameValue;
|
|
||||||
import com.bwssystems.HABridge.api.hue.HueError;
|
import com.bwssystems.HABridge.api.hue.HueError;
|
||||||
import com.bwssystems.HABridge.api.hue.HueErrorResponse;
|
import com.bwssystems.HABridge.api.hue.HueErrorResponse;
|
||||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.bwssystems.HABridge.NamedIP;
|
import com.bwssystems.HABridge.NamedIP;
|
||||||
import com.bwssystems.HABridge.api.hue.HueError;
|
|
||||||
import com.bwssystems.HABridge.api.hue.HueErrorResponse;
|
|
||||||
import com.bwssystems.HABridge.plugins.http.HTTPHandler;
|
import com.bwssystems.HABridge.plugins.http.HTTPHandler;
|
||||||
import com.bwssystems.HABridge.util.TextStringFormatter;
|
import com.bwssystems.HABridge.util.TextStringFormatter;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@@ -100,7 +98,11 @@ public class HalInfo {
|
|||||||
|
|
||||||
String theUrl = null;
|
String theUrl = null;
|
||||||
String theData;
|
String theData;
|
||||||
theUrl = "http://" + halAddress.getIp() + apiType + theToken;
|
if(halAddress.getSecure())
|
||||||
|
theUrl = "https://";
|
||||||
|
else
|
||||||
|
theUrl = "http://";
|
||||||
|
theUrl = theUrl + halAddress.getIp() + apiType + theToken;
|
||||||
theData = httpClient.doHttpRequest(theUrl, null, null, null, null);
|
theData = httpClient.doHttpRequest(theUrl, null, null, null, null);
|
||||||
if(theData != null) {
|
if(theData != null) {
|
||||||
log.debug("GET " + deviceType + " HalApiResponse - data: " + theData);
|
log.debug("GET " + deviceType + " HalApiResponse - data: " + theData);
|
||||||
@@ -125,6 +127,7 @@ public class HalInfo {
|
|||||||
aNewHalDevice.setHaldevicename(theDevice.getDeviceName());
|
aNewHalDevice.setHaldevicename(theDevice.getDeviceName());
|
||||||
aNewHalDevice.setHaladdress(halAddress.getIp());
|
aNewHalDevice.setHaladdress(halAddress.getIp());
|
||||||
aNewHalDevice.setHalname(halAddress.getName());
|
aNewHalDevice.setHalname(halAddress.getName());
|
||||||
|
aNewHalDevice.setSecure(halAddress.getSecure());
|
||||||
deviceList.add(aNewHalDevice);
|
deviceList.add(aNewHalDevice);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -147,7 +150,11 @@ public class HalInfo {
|
|||||||
deviceList = new ArrayList<HalDevice>();
|
deviceList = new ArrayList<HalDevice>();
|
||||||
while (theHalDevices.hasNext()) {
|
while (theHalDevices.hasNext()) {
|
||||||
HalDevice theHalDevice = theHalDevices.next();
|
HalDevice theHalDevice = theHalDevices.next();
|
||||||
theUrl = "http://" + halAddress.getIp() + IRBUTTON_REQUEST + TextStringFormatter.forQuerySpaceUrl(theHalDevice.getHaldevicename()) + TOKEN_REQUEST + theToken;
|
if(halAddress.getSecure())
|
||||||
|
theUrl = "https://";
|
||||||
|
else
|
||||||
|
theUrl = "http://";
|
||||||
|
theUrl = theUrl + halAddress.getIp() + IRBUTTON_REQUEST + TextStringFormatter.forQuerySpaceUrl(theHalDevice.getHaldevicename()) + TOKEN_REQUEST + theToken;
|
||||||
theData = httpClient.doHttpRequest(theUrl, null, null, null, null);
|
theData = httpClient.doHttpRequest(theUrl, null, null, null, null);
|
||||||
if (theData != null) {
|
if (theData != null) {
|
||||||
log.debug("GET IrData for IR Device " + theHalDevice.getHaldevicename() + " HalApiResponse - data: " + theData);
|
log.debug("GET IrData for IR Device " + theHalDevice.getHaldevicename() + " HalApiResponse - data: " + theData);
|
||||||
|
|||||||
@@ -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) {
|
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 }
|
var newhal = {name: newhalname, ip: newhalip, secure: newhasssecure}
|
||||||
$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--) {
|
||||||
@@ -2202,6 +2203,10 @@ 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";
|
||||||
@@ -2227,24 +2232,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 = "http://" + haldevice.haladdress
|
dimpayload = httpType + haldevice.haladdress
|
||||||
+ preDimCmd
|
+ preDimCmd
|
||||||
+ dim_control
|
+ dim_control
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ postCmd;
|
+ postCmd;
|
||||||
else
|
else
|
||||||
dimpayload = "http://" + haldevice.haladdress
|
dimpayload = httpType + haldevice.haladdress
|
||||||
+ preOnCmd
|
+ preOnCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ postCmd;
|
+ postCmd;
|
||||||
onpayload = "http://" + haldevice.haladdress
|
onpayload = httpType + haldevice.haladdress
|
||||||
+ preOnCmd
|
+ preOnCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ postCmd;
|
+ postCmd;
|
||||||
offpayload = "http://" + haldevice.haladdress
|
offpayload = httpType + haldevice.haladdress
|
||||||
+ preOffCmd
|
+ preOffCmd
|
||||||
+ nameCmd
|
+ nameCmd
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
@@ -2260,8 +2265,11 @@ 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);
|
||||||
onpayload = "http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken;
|
var httpType = "http://";
|
||||||
offpayload = "http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken;
|
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);
|
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;
|
||||||
@@ -2272,8 +2280,11 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALHomeUrls = function (haldevice, buildonly) {
|
$scope.buildHALHomeUrls = function (haldevice, buildonly) {
|
||||||
onpayload = "http://" + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Home?Token=" + $scope.bridge.settings.haltoken;
|
var httpType = "http://";
|
||||||
offpayload = "http://" + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Away?Token=" + $scope.bridge.settings.haltoken;
|
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);
|
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) {
|
||||||
@@ -2283,17 +2294,20 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALHeatUrls = function (haldevice, buildonly) {
|
$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="
|
+ "/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 = "http://" + haldevice.haladdress
|
dimpayload = httpType + 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 = "http://" + haldevice.haladdress
|
offpayload = httpType + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off?Token="
|
+ "!HVACMode=Off?Token="
|
||||||
@@ -2307,17 +2321,20 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALCoolUrls = function (haldevice, buildonly) {
|
$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="
|
+ "/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 = "http://" + haldevice.haladdress
|
dimpayload = httpType + 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 = "http://" + haldevice.haladdress
|
offpayload = httpType + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off?Token="
|
+ "!HVACMode=Off?Token="
|
||||||
@@ -2331,12 +2348,15 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALAutoUrls = function (haldevice, buildonly) {
|
$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="
|
+ "/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 = "http://" + haldevice.haladdress
|
offpayload = httpType + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!HVACMode=Off?Token="
|
+ "!HVACMode=Off?Token="
|
||||||
@@ -2349,16 +2369,18 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALOffUrls = function (haldevice, buildonly) {
|
$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="
|
+ "/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 = "http://" + haldevice.haladdress
|
offpayload = httpType + 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) {
|
||||||
@@ -2368,12 +2390,15 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildHALFanUrls = function (haldevice, buildonly) {
|
$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="
|
+ "/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 = "http://" + haldevice.haladdress
|
offpayload = httpType + haldevice.haladdress
|
||||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||||
+ "!FanMode=Auto?Token="
|
+ "!FanMode=Auto?Token="
|
||||||
|
|||||||
@@ -201,12 +201,14 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>IP</th>
|
<th>IP</th>
|
||||||
|
<th>Use SSL</th>
|
||||||
<th>Manage</th>
|
<th>Manage</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tr ng-repeat="hal in bridge.settings.haladdress.devices">
|
<tr ng-repeat="hal in bridge.settings.haladdress.devices">
|
||||||
<td>{{hal.name}}</td>
|
<td>{{hal.name}}</td>
|
||||||
<td>{{hal.ip}}</td>
|
<td>{{hal.ip}}</td>
|
||||||
|
<td>{{hal.secure}}</td>
|
||||||
<td><button class="btn btn-danger" type="submit"
|
<td><button class="btn btn-danger" type="submit"
|
||||||
ng-click="removeHaltoSettings(hal.name, hal.ip)">Del</button></td>
|
ng-click="removeHaltoSettings(hal.name, hal.ip)">Del</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -217,8 +219,11 @@
|
|||||||
<td><input id="bridge-settings-next-hal-ip"
|
<td><input id="bridge-settings-next-hal-ip"
|
||||||
class="form-control" type="text" ng-model="newhalip"
|
class="form-control" type="text" ng-model="newhalip"
|
||||||
placeholder="192.168.1.3:82"></td>
|
placeholder="192.168.1.3:82"></td>
|
||||||
|
<td><input type="checkbox"
|
||||||
|
ng-model="newhalsecure" ng-true-value=true
|
||||||
|
ng-false-value=false></td>
|
||||||
<td><button class="btn btn-success" type="submit"
|
<td><button class="btn btn-success" type="submit"
|
||||||
ng-click="addHaltoSettings(newhalname, newhalip)">Add</button></td>
|
ng-click="addHaltoSettings(newhalname, newhalip, newhalsecure)">Add</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user