mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 00:10:20 +00:00
Finished implementation of HAL calls to the API. Testing next.
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.bwssystems.HABridge</groupId>
|
||||
<artifactId>ha-bridge</artifactId>
|
||||
<version>2.0.7-hal-c</version>
|
||||
<version>2.0.7-hal-d</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
@@ -89,7 +89,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.2.4</version>
|
||||
<version>2.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.bwssystems.hal;
|
||||
|
||||
import java.util.List;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class DeviceElements {
|
||||
@SerializedName(value="DeviceElements", alternate={"SceneElements", "GroupElements", "HVACElements", "MacroElements", "IrElements", "IrButtons"})
|
||||
private List<DeviceName> DeviceElements;
|
||||
|
||||
public List<DeviceName> getDeviceElements() {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.bwssystems.hal;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class DeviceName {
|
||||
@SerializedName(value="DeviceName", alternate={"SceneName", "GroupName", "HVACName", "MacroName", "IrName", "IrButton"})
|
||||
private String DeviceName;
|
||||
|
||||
public String getDeviceName() {
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.bwssystems.hal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HVACElements {
|
||||
private List<HVACName> HVACElements;
|
||||
|
||||
public List<HVACName> getHVACElements() {
|
||||
return HVACElements;
|
||||
}
|
||||
|
||||
public void setHVACElements(List<HVACName> hVACElements) {
|
||||
HVACElements = hVACElements;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.bwssystems.hal;
|
||||
|
||||
public class HVACName {
|
||||
private String HVACName;
|
||||
|
||||
public String getHVACName() {
|
||||
return HVACName;
|
||||
}
|
||||
|
||||
public void setHVACName(String hVACName) {
|
||||
HVACName = hVACName;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ public class HalDevice {
|
||||
private String haldevicename;
|
||||
private String haladdress;
|
||||
private String halname;
|
||||
private DeviceElements buttons;
|
||||
public String getHaldevicetype() {
|
||||
return haldevicetype;
|
||||
}
|
||||
@@ -29,4 +30,10 @@ public class HalDevice {
|
||||
public void setHalname(String halname) {
|
||||
this.halname = halname;
|
||||
}
|
||||
public DeviceElements getButtons() {
|
||||
return buttons;
|
||||
}
|
||||
public void setButtons(DeviceElements buttons) {
|
||||
this.buttons = buttons;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,27 @@ public class HalHome {
|
||||
if(theResponse != null)
|
||||
addHalDevices(deviceList, theResponse, key);
|
||||
else
|
||||
log.warn("Cannot get HVAC for Hal with name: " + key);
|
||||
log.warn("Cannot get Homes for Hal with name: " + key);
|
||||
theResponse = hals.get(key).getGroups();
|
||||
if(theResponse != null)
|
||||
addHalDevices(deviceList, theResponse, key);
|
||||
else
|
||||
log.warn("Cannot get Groups for Hal with name: " + key);
|
||||
theResponse = hals.get(key).getMacros();
|
||||
if(theResponse != null)
|
||||
addHalDevices(deviceList, theResponse, key);
|
||||
else
|
||||
log.warn("Cannot get Macros for Hal with name: " + key);
|
||||
theResponse = hals.get(key).getScenes();
|
||||
if(theResponse != null)
|
||||
addHalDevices(deviceList, theResponse, key);
|
||||
else
|
||||
log.warn("Cannot get Scenes for Hal with name: " + key);
|
||||
theResponse = hals.get(key).getButtons();
|
||||
if(theResponse != null)
|
||||
addHalDevices(deviceList, theResponse, key);
|
||||
else
|
||||
log.warn("Cannot get Buttons for Hal with name: " + key);
|
||||
}
|
||||
return deviceList;
|
||||
}
|
||||
@@ -81,6 +101,7 @@ public class HalHome {
|
||||
HalDevice aNewHalDevice = new HalDevice();
|
||||
aNewHalDevice.setHaldevicetype(theDevice.getHaldevicetype());
|
||||
aNewHalDevice.setHaldevicename(theDevice.getHaldevicename());
|
||||
aNewHalDevice.setButtons(theDevice.getButtons());
|
||||
aNewHalDevice.setHaladdress(hals.get(theKey).getHalAddress().getIp());
|
||||
aNewHalDevice.setHalname(theKey);
|
||||
theDeviceList.add(aNewHalDevice);
|
||||
|
||||
@@ -15,12 +15,18 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.bwssystems.HABridge.NamedIP;
|
||||
import com.bwssystems.util.TextStringFormatter;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class HalInfo {
|
||||
private static final Logger log = LoggerFactory.getLogger(HalInfo.class);
|
||||
private static final String DEVICE_REQUEST = "/DeviceData!DeviceCmd=GetNames!DeviceType=";
|
||||
private static final String HVAC_REQUEST = "/HVACData!HVACCmd=GetNames";
|
||||
private static final String GROUP_REQUEST = "/GroupData!GroupCmd=GetNames";
|
||||
private static final String MACRO_REQUEST = "/MacroData!MacroCmd=GetNames";
|
||||
private static final String SCENE_REQUEST = "/SceneData!SceneCmd=GetNames";
|
||||
private static final String IRDATA_REQUEST = "/IrData!IRCmd=GetNames";
|
||||
private static final String IRBUTTON_REQUEST = "/IrData!IRCmd=GetButtons!IrDevice=";
|
||||
private static final String TOKEN_REQUEST = "?Token=";
|
||||
private static final String LIGHT_REQUEST = "Light";
|
||||
private static final String APPL_REQUEST = "Appl";
|
||||
@@ -28,7 +34,11 @@ public class HalInfo {
|
||||
private static final String THEATRE_REQUEST = "Theatre";
|
||||
private static final String CUSTOM_REQUEST = "Custom";
|
||||
private static final String HVAC_TYPE = "HVAC";
|
||||
private static final String HOME_TYPE = "HOME";
|
||||
private static final String HOME_TYPE = "Home";
|
||||
private static final String GROUP_TYPE = "Group";
|
||||
private static final String MACRO_TYPE = "Macro";
|
||||
private static final String SCENE_TYPE = "Scene";
|
||||
private static final String IRDATA_TYPE = "IrData";
|
||||
private HttpClient httpClient;
|
||||
private NamedIP halAddress;
|
||||
private String theToken;
|
||||
@@ -57,7 +67,25 @@ public class HalInfo {
|
||||
}
|
||||
|
||||
public List<HalDevice> getHVAC() {
|
||||
return getHalHVAC(HVAC_REQUEST + TOKEN_REQUEST, HVAC_TYPE);
|
||||
return getHalDevices(HVAC_REQUEST + TOKEN_REQUEST, HVAC_TYPE);
|
||||
}
|
||||
|
||||
public List<HalDevice> getGroups() {
|
||||
return getHalDevices(GROUP_REQUEST + TOKEN_REQUEST, GROUP_TYPE);
|
||||
}
|
||||
|
||||
public List<HalDevice> getMacros() {
|
||||
return getHalDevices(MACRO_REQUEST + TOKEN_REQUEST, MACRO_TYPE);
|
||||
}
|
||||
|
||||
public List<HalDevice> getScenes() {
|
||||
return getHalDevices(SCENE_REQUEST + TOKEN_REQUEST, SCENE_TYPE);
|
||||
}
|
||||
|
||||
public List<HalDevice> getButtons() {
|
||||
List<HalDevice> irDataDevices = getHalDevices(IRDATA_REQUEST + TOKEN_REQUEST, IRDATA_TYPE);
|
||||
|
||||
return getDeviceButtons(irDataDevices);
|
||||
}
|
||||
|
||||
public List<HalDevice> getHome(String theDeviceName) {
|
||||
@@ -79,7 +107,7 @@ public class HalInfo {
|
||||
theUrl = "http://" + halAddress.getIp() + apiType + theToken;
|
||||
theData = doHttpGETRequest(theUrl);
|
||||
if(theData != null) {
|
||||
log.debug("GET HalApiResponse - data: " + theData);
|
||||
log.debug("GET " + deviceType + " HalApiResponse - data: " + theData);
|
||||
theHalApiResponse = new Gson().fromJson(theData, DeviceElements.class);
|
||||
if(theHalApiResponse.getDeviceElements() == null) {
|
||||
StatusDescription theStatus = new Gson().fromJson(theData, StatusDescription.class);
|
||||
@@ -109,42 +137,41 @@ public class HalInfo {
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
private List<HalDevice> getHalHVAC(String apiType, String deviceType) {
|
||||
HVACElements theHalApiResponse = null;
|
||||
private List<HalDevice> getDeviceButtons(List<HalDevice> theIrDevices) {
|
||||
DeviceElements theHalApiResponse = null;
|
||||
List<HalDevice> deviceList = null;
|
||||
|
||||
String theUrl = null;
|
||||
String theData;
|
||||
theUrl = "http://" + halAddress.getIp() + apiType + theToken;
|
||||
Iterator<HalDevice> theHalDevices = theIrDevices.iterator();
|
||||
deviceList = new ArrayList<HalDevice>();
|
||||
while (theHalDevices.hasNext()) {
|
||||
HalDevice theHalDevice = theHalDevices.next();
|
||||
theUrl = "http://" + halAddress.getIp() + IRBUTTON_REQUEST + TextStringFormatter.forQuerySpaceUrl(theHalDevice.getHaldevicename()) + TOKEN_REQUEST + theToken;
|
||||
theData = doHttpGETRequest(theUrl);
|
||||
if (theData != null) {
|
||||
log.debug("GET HalApiResponse - data: " + theData);
|
||||
theHalApiResponse = new Gson().fromJson(theData, HVACElements.class);
|
||||
if(theHalApiResponse.getHVACElements() == null) {
|
||||
log.debug("GET IrData for IR Device " + theHalDevice.getHaldevicename() + " HalApiResponse - data: " + theData);
|
||||
theHalApiResponse = new Gson().fromJson(theData, DeviceElements.class);
|
||||
if (theHalApiResponse.getDeviceElements() == null) {
|
||||
StatusDescription theStatus = new Gson().fromJson(theData, StatusDescription.class);
|
||||
if (theStatus.getStatus() == null) {
|
||||
log.warn("Cannot get an devices for type " + deviceType + " for hal " + halAddress.getName() + " as response is not parsable.");
|
||||
}
|
||||
else {
|
||||
log.warn("Cannot get an devices for type " + deviceType + " for hal " + halAddress.getName() + ". Status: " + theStatus.getStatus() + ", with description: " + theStatus.getDescription());
|
||||
log.warn("Cannot get buttons for IR Device " + theHalDevice.getHaldevicename() + " for hal "
|
||||
+ halAddress.getName() + " as response is not parsable.");
|
||||
} else {
|
||||
log.warn("Cannot get buttons for IR Device " + theHalDevice.getHaldevicename() + " for hal "
|
||||
+ halAddress.getName() + ". Status: " + theStatus.getStatus() + ", with description: "
|
||||
+ theStatus.getDescription());
|
||||
}
|
||||
return deviceList;
|
||||
}
|
||||
deviceList = new ArrayList<HalDevice>();
|
||||
|
||||
Iterator<HVACName> theDeviceNames = theHalApiResponse.getHVACElements().iterator();
|
||||
while(theDeviceNames.hasNext()) {
|
||||
HVACName theDevice = theDeviceNames.next();
|
||||
HalDevice aNewHalDevice = new HalDevice();
|
||||
aNewHalDevice.setHaldevicetype(deviceType);
|
||||
aNewHalDevice.setHaldevicename(theDevice.getHVACName());
|
||||
deviceList.add(aNewHalDevice);
|
||||
theHalDevice.setButtons(theHalApiResponse);
|
||||
deviceList.add(theHalDevice);
|
||||
|
||||
} else {
|
||||
log.warn("Get Hal buttons for IR Device " + theHalDevice.getHaldevicename() + " for "
|
||||
+ halAddress.getName() + " - returned null, no data.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
log.warn("Get Hal device types " + deviceType + " for " + halAddress.getName() + " - returned null, no data.");
|
||||
}
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
|
||||
@@ -1396,37 +1396,83 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
|
||||
$scope.buildDeviceUrls = function (haldevice, dim_control) {
|
||||
bridgeService.clearDevice();
|
||||
$scope.device = $scope.bridge.device;
|
||||
var preOnCmd = "";
|
||||
var preDimCmd = "";
|
||||
var preOffCmd = "";
|
||||
var nameCmd = ""
|
||||
var postCmd = "?Token=" + $scope.bridge.settings.haltoken;
|
||||
if(haldevice.haldevicetype == "Group") {
|
||||
$scope.device.deviceType = "group";
|
||||
preOnCmd = "/GroupService!GroupCmd=On";
|
||||
preOffCmd = "/GroupService!GroupCmd=Off";
|
||||
nameCmd = "!GroupName=";
|
||||
}
|
||||
else if(haldevice.haldevicetype == "Macro") {
|
||||
$scope.device.deviceType = "macro";
|
||||
preOnCmd = "/MacroService!MacroCmd=Set!MacroName=";
|
||||
preOffCmd = preOnCmd;
|
||||
}
|
||||
else if(haldevice.haldevicetype == "Scene") {
|
||||
$scope.device.deviceType = "scene";
|
||||
preOnCmd = "/SceneService!SceneCmd=Set!SceneName=";
|
||||
preOffCmd = preOnCmd;
|
||||
}
|
||||
else {
|
||||
$scope.device.deviceType = "switch";
|
||||
preOnCmd = "/DeviceService!DeviceCmd=SetDevice!DeviceValue=On";
|
||||
preDimCmd = "/DeviceService!DeviceCmd=SetDevice!DeviceValue=Dim!DevicePercent=";
|
||||
preOffCmd = "/DeviceService!DeviceCmd=SetDevice!DeviceValue=Off";
|
||||
nameCmd = "!DeviceName=";
|
||||
}
|
||||
$scope.device.name = haldevice.haldevicename;
|
||||
$scope.device.targetDevice = haldevice.halname;
|
||||
$scope.device.mapType = "halDevice";
|
||||
$scope.device.mapId = haldevice.haldevicename + "-" + haldevice.halname;
|
||||
if(dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)
|
||||
if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0) && $scope.device.deviceType == "switch")
|
||||
$scope.device.dimUrl = "http://" + haldevice.haladdress
|
||||
+ "/DeviceService!DeviceName="
|
||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||
+ "!DeviceCmd=SetDevice!DeviceValue=Dim!DevicePercent="
|
||||
+ preDimCmd
|
||||
+ dim_control
|
||||
+ "?Token="
|
||||
+ $scope.bridge.settings.haltoken;
|
||||
+ nameCmd
|
||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||
+ postCmd;
|
||||
else
|
||||
$scope.device.dimUrl = "http://" + haldevice.haladdress
|
||||
+ "/DeviceService!DeviceName="
|
||||
+ preOnCmd
|
||||
+ nameCmd
|
||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||
+ "!DeviceCmd=SetDevice!DeviceValue=On?Token="
|
||||
+ $scope.bridge.settings.haltoken;
|
||||
+ postCmd;
|
||||
$scope.device.onUrl = "http://" + haldevice.haladdress
|
||||
+ "/DeviceService!DeviceName="
|
||||
+ preOnCmd
|
||||
+ nameCmd
|
||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||
+ "!DeviceCmd=SetDevice!DeviceValue=On?Token="
|
||||
+ $scope.bridge.settings.haltoken;
|
||||
+ postCmd;
|
||||
$scope.device.offUrl = "http://" + haldevice.haladdress
|
||||
+ "/DeviceService!DeviceName="
|
||||
+ preOffCmd
|
||||
+ nameCmd
|
||||
+ haldevice.haldevicename.replaceAll(" ", "%20")
|
||||
+ "!DeviceCmd=SetDevice!DeviceValue=Off?Token="
|
||||
+ $scope.bridge.settings.haltoken;
|
||||
|
||||
+ postCmd;
|
||||
};
|
||||
|
||||
$scope.buildButtonUrls = function (haldevice, onbutton, offbutton) {
|
||||
var currentOn = $scope.device.onUrl;
|
||||
var currentOff = $scope.device.offUrl;
|
||||
var actionOn = angular.fromJson(onbutton);
|
||||
var actionOff = angular.fromJson(offbutton);
|
||||
if( $scope.device.mapType == "halButton") {
|
||||
$scope.device.mapId = $scope.device.mapId + "-" + actionOn.DeviceName;
|
||||
$scope.device.onUrl = currentOn.substr(0, currentOn.indexOf("]")) + ",{\"item\":\"http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken +"\"}]";
|
||||
$scope.device.offUrl = currentOff.substr(0, currentOff.indexOf("]")) + ",{\"item\":\"http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken + "\"}]";
|
||||
}
|
||||
else if ($scope.device.mapType == null || $scope.device.mapType == "") {
|
||||
bridgeService.clearDevice();
|
||||
$scope.device.deviceType = "button";
|
||||
$scope.device.targetDevice = haldevice.halname;
|
||||
$scope.device.name = haldevice.haldevicename;
|
||||
$scope.device.mapType = "halButton";
|
||||
$scope.device.mapId = haldevice.haldevicename + "-" + haldevice.halname + "-" + actionOn.DeviceName;
|
||||
$scope.device.onUrl = "[{\"item\":\"http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken + "\"}]";
|
||||
$scope.device.offUrl = "[{\"item\":\"http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken + "\"}]";
|
||||
}
|
||||
};
|
||||
|
||||
$scope.buildHALHomeUrls = function (haldevice) {
|
||||
@@ -1445,7 +1491,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = haldevice.haldevicename + " Heat";
|
||||
$scope.device.targetDevice = haldevice.halname;
|
||||
$scope.device.mapType = "HALThermoSet";
|
||||
$scope.device.mapType = "halThermoSet";
|
||||
$scope.device.mapId = haldevice.haldevicename + "-" + haldevice.halname + "-SetHeat";
|
||||
$scope.device.onUrl = "http://" + haldevice.haladdress
|
||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||
@@ -1468,7 +1514,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = haldevice.haldevicename + " Cool";
|
||||
$scope.device.targetDevice = haldevice.halname;
|
||||
$scope.device.mapType = "HALThermoSet";
|
||||
$scope.device.mapType = "halThermoSet";
|
||||
$scope.device.mapId = haldevice.haldevicename + "-" + haldevice.halname + "-SetCool";
|
||||
$scope.device.onUrl = "http://" + haldevice.haladdress
|
||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||
@@ -1491,7 +1537,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = haldevice.haldevicename + " Auto";
|
||||
$scope.device.targetDevice = haldevice.halname;
|
||||
$scope.device.mapType = "HALThermoSet";
|
||||
$scope.device.mapType = "halThermoSet";
|
||||
$scope.device.mapId = haldevice.haldevicename + "-" + haldevice.halname + "-SetAuto";
|
||||
$scope.device.onUrl = "http://" + haldevice.haladdress
|
||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||
@@ -1509,7 +1555,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = haldevice.haldevicename + " Thermostat";
|
||||
$scope.device.targetDevice = haldevice.halname;
|
||||
$scope.device.mapType = "HALThermoSet";
|
||||
$scope.device.mapType = "halThermoSet";
|
||||
$scope.device.mapId = haldevice.haldevicename + "-" + haldevice.halname + "-TurnOff";
|
||||
$scope.device.onUrl = "http://" + haldevice.haladdress
|
||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||
@@ -1527,7 +1573,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = haldevice.haldevicename + " Fan";
|
||||
$scope.device.targetDevice = haldevice.halname;
|
||||
$scope.device.mapType = "HALThermoSet";
|
||||
$scope.device.mapType = "halThermoSet";
|
||||
$scope.device.mapId = haldevice.haldevicename + "-" + haldevice.halname + "-SetFan";
|
||||
$scope.device.onUrl = "http://" + haldevice.haladdress
|
||||
+ "/HVACService!HVACCmd=Set!HVACName="
|
||||
@@ -1638,12 +1684,7 @@ app.controller('HalController', function ($scope, $location, $http, bridgeServic
|
||||
$scope.imgButtonsUrl = "glyphicon glyphicon-plus";
|
||||
};
|
||||
|
||||
$scope.deleteDeviceByMapId = function (haldevicename, halname, mapType) {
|
||||
var id = haldevicename + "-" + halname;
|
||||
if(mapType == "HOME")
|
||||
id = id + "-HomeAway";
|
||||
if(mapType == "HALThermoSet")
|
||||
id = id + "-SetAuto";
|
||||
$scope.deleteDeviceByMapId = function (id, mapType) {
|
||||
$scope.bridge.mapandid = { id, mapType };
|
||||
ngDialog.open({
|
||||
template: 'deleteMapandIdDialog',
|
||||
@@ -1906,17 +1947,7 @@ app.filter('unavailableHalDeviceId', function(bridgeService) {
|
||||
if(input == null)
|
||||
return out;
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(bridgeService.findDeviceByMapId(input[i].haldevicename + "-" + input[i].halname, input[i].halname, "halDevice")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(bridgeService.findDeviceByMapId(input[i].haldevicename + "-" + input[i].halname + "-HomeAway", input[i].halname, "halHome")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(input[i].mapType == "HALThermoSet"){
|
||||
if(input[i].mapType != null && bridgeService.aContainsB(input[i].mapType, "hal")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@
|
||||
<option value="exec">Execute Script/Program</option>
|
||||
<option value="switch">Switch</option>
|
||||
<option value="scene">Scene</option>
|
||||
<option value="macro">Macro</option>
|
||||
<option value="group">Group</option>
|
||||
<option value="activity">Activity</option>
|
||||
<option value="button">Button</option>
|
||||
<option value="thermo">Thermo</option>
|
||||
@@ -97,6 +99,8 @@
|
||||
<option value="nestThermoSet">Nest Thermostat</option>
|
||||
<option value="hueDevice">Hue Device</option>
|
||||
<option value="halDevice">HAL Device</option>
|
||||
<option value="halHome">HAL Home Status</option>
|
||||
<option value="halThermoSet">HAL Thermostat</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
ng-click="toggleSelectAll()"> Name</span></th>
|
||||
<th sortable-header col="category">Category</th>
|
||||
<th sortable-header col="halname">HAL</th>
|
||||
<th>On Button</th>
|
||||
<th>Off Button</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -70,12 +72,27 @@
|
||||
<td>{{haldevice.haldevicetype}}</td>
|
||||
<td>{{haldevice.halname}}</td>
|
||||
<td>
|
||||
<button ng-if="haldevice.haldevicetype === 'Light' || haldevice.haldevicetype === 'Appl' || haldevice.haldevicetype === 'Theatre' || haldevice.haldevicetype === 'Custom'" class="btn btn-success" type="submit"
|
||||
<select name="button-on" id="button-on" ng-model="button_on">
|
||||
<option ng-repeat="aButtonOn in haldevice.buttons.DeviceElements"
|
||||
value="{{aButtonOn}}">{{aButtonOn.DeviceName}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select name="button-off" id="button-off" ng-model="button_off">
|
||||
<option ng-repeat="aButtonOff in haldevice.buttons.DeviceElements"
|
||||
value="{{aButtonOff}}">{{aButtonOff.DeviceName}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<button ng-if="haldevice.haldevicetype != 'Home' && haldevice.haldevicetype != 'HVAC' && haldevice.haldevicetype != 'IrData'" class="btn btn-success" type="submit"
|
||||
ng-click="buildDeviceUrls(haldevice, device_dim_control)">Generate
|
||||
Bridge Device</button>
|
||||
<button ng-if="haldevice.haldevicetype === 'HOME'" class="btn btn-success" type="submit"
|
||||
<button ng-if="haldevice.haldevicetype == 'Home'" class="btn btn-success" type="submit"
|
||||
ng-click="buildHALHomeUrls(haldevice)">Home/Away</button>
|
||||
<ul ng-if="haldevice.haldevicetype === 'HVAC'" class="list-group">
|
||||
<button ng-if="haldevice.haldevicetype == 'IrData'" class="btn btn-success" type="submit"
|
||||
ng-click="buildButtonUrls(haldevice, button_on, button_off)">Build
|
||||
A Button</button>
|
||||
<ul ng-if="haldevice.haldevicetype == 'HVAC'" class="list-group">
|
||||
<li class="list-group-item">
|
||||
<p>
|
||||
<button class="btn btn-success" type="submit"
|
||||
@@ -122,14 +139,14 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr
|
||||
ng-repeat="haldevice in bridge.haldevices | unavailableHalDeviceId">
|
||||
ng-repeat="device in bridge.devices | unavailableHalDeviceId">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{haldevice.haldevicename}}</td>
|
||||
<td>{{haldevice.haldevicetype}}</td>
|
||||
<td>{{haldevice.halname}}</td>
|
||||
<td>{{device.name}}</td>
|
||||
<td>{{device.deviceType}}</td>
|
||||
<td>{{device.targetDevice}}</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" type="submit"
|
||||
ng-click="deleteDeviceByMapId(haldevice.haldevicename, haldevice.halname, haldevice.haldevicetype)">Delete</button>
|
||||
ng-click="deleteDeviceByMapId(device.mapId, device.mapType)">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user