Fixed openhab build screen and openhab invalid responses.

Completed Broadlink impl

Testing
This commit is contained in:
bsamuels
2018-01-19 14:46:45 -06:00
parent 1897633e75
commit 14e940134c
32 changed files with 692 additions and 47 deletions

View File

@@ -41,7 +41,6 @@ public class BroadlinkHome implements Home {
private static final String _rm2 = "RM2";
private Map<String, BLDevice> broadlinkMap;
private Boolean validBroadlink;
private Gson aGsonHandler;
private boolean closed;
private Boolean isDevMode;
@@ -55,7 +54,6 @@ public class BroadlinkHome implements Home {
@Override
public Home createHome(BridgeSettings bridgeSettings) {
broadlinkMap = null;
aGsonHandler = null;
BLDevice[] clients;
isDevMode = Boolean.parseBoolean(System.getProperty("dev.mode", "false"));
@@ -127,10 +125,7 @@ public class BroadlinkHome implements Home {
} else {
BroadlinkEntry broadlinkCommand = null;
if(anItem.getItem().isJsonObject())
broadlinkCommand = aGsonHandler.fromJson(anItem.getItem(), BroadlinkEntry.class);
else
broadlinkCommand = aGsonHandler.fromJson(anItem.getItem().getAsString(), BroadlinkEntry.class);
broadlinkCommand = new Gson().fromJson(anItem.getItem().getAsString(), BroadlinkEntry.class);
BLDevice theDevice = broadlinkMap.get(broadlinkCommand.getId());
if (theDevice == null) {
log.warn("Should not get here, no BroadlinkDevices available");
@@ -149,6 +144,8 @@ public class BroadlinkHome implements Home {
else
changeState = false;
try {
if(!isDevMode)
theDevice.auth();
((MP1Device) theDevice).setState(Integer.parseInt(broadlinkCommand.getData()), changeState);
} catch (NumberFormatException e1) {
log.error("Call to " + _mp1 + " device failed with number format exception.", e1);
@@ -178,6 +175,8 @@ public class BroadlinkHome implements Home {
else
changeState = false;
try {
if(!isDevMode)
theDevice.auth();
((SP2Device) theDevice).setState(changeState);
} catch (Exception e1) {
log.error("Call to " + _sp2 + " device failed with exception.", e1);
@@ -192,6 +191,8 @@ public class BroadlinkHome implements Home {
else
changeState = false;
try {
if(!isDevMode)
theDevice.auth();
((SP1Device) theDevice).setPower(changeState);
} catch (Exception e) {
log.error("Call to " + _sp1 + " device failed with exception.", e);
@@ -210,8 +211,9 @@ public class BroadlinkHome implements Home {
case BLDevice.DEV_RM_2_PRO_PLUS_2_BL:
case BLDevice.DEV_RM_MINI_SHATE:
if(broadlinkCommand.getData() != null && !broadlinkCommand.getData().trim().isEmpty()) {
theStringData = broadlinkCommand.getData().trim();
if(targetBri != null || targetBriInc != null) {
theStringData = BrightnessDecode.calculateReplaceIntensityValue(broadlinkCommand.getData().trim(), intensity, targetBri, targetBriInc, true);
theStringData = BrightnessDecode.calculateReplaceIntensityValue(theStringData, intensity, targetBri, targetBriInc, true);
}
if(colorData != null) {
theStringData = ColorDecode.replaceColorData(theStringData, colorData, BrightnessDecode.calculateIntensity(intensity, targetBri, targetBriInc), true);
@@ -221,6 +223,8 @@ public class BroadlinkHome implements Home {
byte[] theData = DatatypeConverter.parseHexBinary(theStringData);
SendDataCmdPayload thePayload = new SendDataCmdPayload(theData);
try {
if(!isDevMode)
theDevice.auth();
((RM2Device) theDevice).sendCmdPkt(Configuration.BROADLINK_DISCONVER_TIMEOUT, thePayload);
} catch (IOException e) {
log.error("Call to " + _rm2 + " device failed with exception.", e);

View File

@@ -15,17 +15,9 @@ import com.github.mob41.blapi.pkt.CmdPayload;
public class TestBLDevice extends BLDevice {
private static final Logger log = LoggerFactory.getLogger(TestBLDevice.class);
short adeviceType;
String adeviceDesc;
String ahost;
Mac amac;
protected TestBLDevice(short deviceType, String deviceDesc, String host, Mac mac) throws IOException {
super(deviceType, host, host, mac);
adeviceType = deviceType;
adeviceDesc = deviceDesc;
ahost = host;
super(deviceType, deviceDesc, host, mac);
}
public void setState(boolean aState) {
@@ -46,30 +38,30 @@ public class TestBLDevice extends BLDevice {
}
public static BLDevice[] discoverDevices(InetAddress theAddress, int aport, int timeout) {
TestBLDevice mp1Device = null;
TestBLDevice sp1Device = null;
TestBLDevice sp2Device = null;
TestBLDevice rm2Device = null;
TestMP1Device mp1Device = null;
TestSP1Device sp1Device = null;
TestSP2Device sp2Device = null;
TestRM2Device rm2Device = null;
try {
mp1Device = new TestBLDevice(BLDevice.DEV_MP1, BLDevice.DESC_MP1, "mp1host", null);
mp1Device = new TestMP1Device("mp1host", null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
sp1Device = new TestBLDevice(BLDevice.DEV_SP1, BLDevice.DESC_SP1, "sp1host", null);
sp1Device = new TestSP1Device("sp1host", null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
sp2Device = new TestBLDevice(BLDevice.DEV_SP2, BLDevice.DESC_SP2, "sp2host", null);
sp2Device = new TestSP2Device("sp2host", null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
rm2Device = new TestBLDevice(BLDevice.DEV_RM_2, BLDevice.DESC_RM_2, "rm2host", null);
rm2Device = new TestRM2Device("rm2host", null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();

View File

@@ -0,0 +1,29 @@
package com.bwssystems.HABridge.plugins.broadlink;
import java.io.IOException;
import java.net.DatagramPacket;
import javax.xml.bind.DatatypeConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.mob41.blapi.MP1Device;
import com.github.mob41.blapi.mac.Mac;
import com.github.mob41.blapi.pkt.CmdPayload;
public class TestMP1Device extends MP1Device {
private static final Logger log = LoggerFactory.getLogger(TestMP1Device.class);
protected TestMP1Device(String host, Mac mac) throws IOException {
super(host, mac);
}
public void setState(int anIndex, boolean aState) {
log.info("setState called with index " + anIndex + " and state " + aState);
}
public DatagramPacket sendCmdPkt(int timeout, CmdPayload aCmd) {
log.info("sendCmdPkt called with " + DatatypeConverter.printHexBinary(aCmd.getPayload().getData()));
return null;
}
}

View File

@@ -0,0 +1,27 @@
package com.bwssystems.HABridge.plugins.broadlink;
import java.io.IOException;
import java.net.DatagramPacket;
import javax.xml.bind.DatatypeConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.mob41.blapi.RM2Device;
import com.github.mob41.blapi.mac.Mac;
import com.github.mob41.blapi.pkt.CmdPayload;
import com.github.mob41.blapi.pkt.cmd.rm2.SendDataCmdPayload;
public class TestRM2Device extends RM2Device {
private static final Logger log = LoggerFactory.getLogger(TestRM2Device.class);
protected TestRM2Device(String host, Mac mac) throws IOException {
super(host, mac);
}
public DatagramPacket sendCmdPkt(int timeout, CmdPayload aCmd) {
log.info("sendCmdPkt called with " + DatatypeConverter.printHexBinary(((SendDataCmdPayload)aCmd).getData()));
return null;
}
}

View File

@@ -0,0 +1,30 @@
package com.bwssystems.HABridge.plugins.broadlink;
import java.io.IOException;
import java.net.DatagramPacket;
import javax.xml.bind.DatatypeConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.mob41.blapi.SP1Device;
import com.github.mob41.blapi.mac.Mac;
import com.github.mob41.blapi.pkt.CmdPayload;
public class TestSP1Device extends SP1Device {
private static final Logger log = LoggerFactory.getLogger(TestSP1Device.class);
protected TestSP1Device(String host, Mac mac) throws IOException {
super(host, mac);
}
public void setPower(boolean aState) {
log.info("setPower called with " + aState);
}
public DatagramPacket sendCmdPkt(int timeout, CmdPayload aCmd) {
log.info("sendCmdPkt called with " + DatatypeConverter.printHexBinary(aCmd.getPayload().getData()));
return null;
}
}

View File

@@ -0,0 +1,30 @@
package com.bwssystems.HABridge.plugins.broadlink;
import java.io.IOException;
import java.net.DatagramPacket;
import javax.xml.bind.DatatypeConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.mob41.blapi.SP2Device;
import com.github.mob41.blapi.mac.Mac;
import com.github.mob41.blapi.pkt.CmdPayload;
public class TestSP2Device extends SP2Device {
private static final Logger log = LoggerFactory.getLogger(TestSP2Device.class);
protected TestSP2Device(String host, Mac mac) throws IOException {
super(host, mac);
}
public void setState(boolean aState) {
log.info("setState called with " + aState);
}
public DatagramPacket sendCmdPkt(int timeout, CmdPayload aCmd) {
log.info("sendCmdPkt called with " + DatatypeConverter.printHexBinary(aCmd.getPayload().getData()));
return null;
}
}

View File

@@ -99,6 +99,8 @@ public class HTTPHandler {
}
}
if (response != null && response.getStatusLine().getStatusCode() >= 200 && response.getStatusLine().getStatusCode() < 300) {
if(theContent == null)
theContent = "";
log.debug("Successfull response - The http response is <<<" + theContent + ">>>");
retryCount = 2;
} else if (response != null) {
@@ -107,10 +109,9 @@ public class HTTPHandler {
if (response.getStatusLine().getStatusCode() == 504) {
log.warn("HTTP response code was 504, retrying...");
log.debug("The 504 error content is <<<" + theContent + ">>>");
theContent = null;
} else
retryCount = 2;
theContent = null;
}
} catch (ClientProtocolException e) {

View File

@@ -88,7 +88,13 @@ public class OpenHABHome implements Home {
aCommand = TimeDecode.replaceTimeValue(aCommand);
}
try {
theHandler.callCommand(anUrl, aCommand, httpClient);
boolean success = theHandler.callCommand(anUrl, aCommand, httpClient);
if(!success) {
log.warn("Comand had error to OpenHAB");
responseString = new Gson().toJson(HueErrorResponse.createResponse("6", "/lights/" + lightId,
"Error on calling url to change device state", "/lights/"
+ lightId + "state", null, null).getTheErrors(), HueError[].class);
}
} catch (Exception e) {
log.warn("Cannot send comand to OpenHAB", e);
responseString = new Gson().toJson(HueErrorResponse.createResponse("6", "/lights/" + lightId,

View File

@@ -44,6 +44,8 @@ public class OpenHABInstance {
aUrl = aUrl + theOpenHAB.getIp() + ":" + theOpenHAB.getPort() + "/" + aCommand;
String theData = httpClient.doHttpRequest(aUrl, HttpPost.METHOD_NAME, "text/plain", commandData, headers);
log.debug("call Command return is: <" + theData + ">");
if(theData.contains("error") || theData.contains("ERROR") || theData.contains("Error"))
return false;
return true;
}

View File

@@ -87,6 +87,10 @@ app.config (function ($locationProvider, $routeProvider) {
templateUrl: 'views/fhemdevice.html',
controller: 'FhemController',
requiresAuthentication: true
}).when ('/broadlinkdevices', {
templateUrl: 'views/broadlinkdevice.html',
controller: 'BroadlinkController',
requiresAuthentication: true
}).when ('/login', {
templateUrl: 'views/login.html',
controller: 'LoginController'
@@ -155,7 +159,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
this.state = {base: "./api/devices", bridgelocation: ".", systemsbase: "./system", huebase: "./api", configs: [], backups: [], devices: [], device: {},
mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], mapTypes: [], olddevicename: "", logShowAll: false,
isInControl: false, showVera: false, showFibaro: false, showHarmony: false, showNest: false, showHue: false, showHal: false, showMqtt: false, showHass: false,
showHomeWizard: false, showDomoticz: false, showSomfy: false, showLifx: false, showOpenHAB: false, showFHEM: false, habridgeversion: {}, viewDevId: "", queueDevId: "", securityInfo: {}, filterDevicesByIpAddress: null,
showHomeWizard: false, showDomoticz: false, showSomfy: false, showLifx: false, showOpenHAB: false, showFHEM: false, showBroadlink: false, habridgeversion: {}, viewDevId: "", queueDevId: "", securityInfo: {}, filterDevicesByIpAddress: null,
filterDevicesOnlyFiltered: false, filterDeviceType: null};
this.displayWarn = function(errorTitle, error) {
@@ -576,6 +580,11 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
return;
}
this.updateShowBroadlink = function () {
this.state.showBroadlink = self.state.settings.broadlinkconfigured;
return;
}
this.loadBridgeSettings = function () {
return $http.get(this.state.systemsbase + "/settings").then(
function (response) {
@@ -594,6 +603,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
self.updateShowLifx();
self.updateShowOpenHAB();
self.updateShowFhem();
self.updateShowBroadlink();
},
function (error) {
if (error.status === 401)
@@ -933,6 +943,22 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
);
};
this.viewBroadlinkDevices = function () {
if (!this.state.showBroadlink)
return;
return $http.get(this.state.base + "/broadlink/devices").then(
function (response) {
self.state.broadlinkdevices = response.data;
},
function (error) {
if (error.status === 401)
$rootScope.$broadcast('securityReinit', 'done');
else
self.displayWarn("Get broadlink Devices Error: ", error);
}
);
};
this.formatCallItem = function (currentItem) {
if(!currentItem.startsWith("{\"item") && !currentItem.startsWith("[{\"item")) {
if (currentItem.startsWith("[") || currentItem.startsWith("{"))
@@ -1352,6 +1378,11 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
testBody = testBody + "\"xy\": [" + value[0] +"," + value[1] + "]";
}
testBody = testBody + "}";
if (testBody === "{}") {
self.displayWarn("No value available for test call...", null);
return;
}
$http.put(testUrl, testBody).then(
function (response) {
if (typeof(response.data[0].success) !== 'undefined') {
@@ -3732,7 +3763,7 @@ app.controller('OpenHABController', function ($scope, $location, bridgeService,
$scope.device = bridgeService.state.device;
};
$scope.buildDeviceUrls = function (openhabdevice, dim_control, ondeviceaction, oninputdeviceaction, offdeviceaction, offinputdeviceaction, buildonly) {
$scope.buildDeviceUrls = function (openhabdevice, dim_control, onaction, ondata, dimaction, dimdata, offaction, offdata, coloraction, colordata, buildonly) {
var preCmd = "/rest/items/" + openhabdevice.item.name;
if(openhabdevice.item.type !== 'String') {
if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)) {
@@ -3742,20 +3773,38 @@ app.controller('OpenHABController', function ($scope, $location, bridgeService,
dimpayload = null;
onpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"ON\"}";
offpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"OFF\"}";
colorpayload = null;
}
else {
dimpayload = null;
if(ondeviceaction === 'other')
onpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + oninputdeviceaction + "\"}";
if(onaction === 'other')
onpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + ondata + "\"}";
else if(onaction !== undefined && onaction !== null && onaction !== '')
onpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + onaction + "\"}";
else
onpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + ondeviceaction + "\"}";
onpayload = null;
if(offdeviceaction === 'other')
offpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + offinputdeviceaction + "\"}";
if(dimaction === 'other')
dimpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + dimdata + "\"}";
else if(dimaction !== undefined && dimaction !== null && dimaction !== '')
dimpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + dimaction + "\"}";
else
offpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + offdeviceaction + "\"}";
dimpayload = null;
if(offaction === 'other')
offpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + offdata + "\"}";
else if(offaction !== undefined && offaction !== null && offaction !== '')
offpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + offaction + "\"}";
else
offpayload = null;
if(coloraction === 'other')
colorpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + colordata + "\"}";
else if(coloraction !== undefined && coloraction !== null && coloraction !== '')
colorpayload = "{\"url\":\"http://" + openhabdevice.address + preCmd + "\",\"command\":\"" + coloraction + "\"}";
else
colorpayload = null;
}
bridgeService.buildUrls(onpayload, dimpayload, offpayload, null, true, openhabdevice.item.name + "-" + openhabdevice.name, openhabdevice.item.name, openhabdevice.name, openhabdevice.item.type, "openhabDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, openhabdevice.item.name + "-" + openhabdevice.name, openhabdevice.item.name, openhabdevice.name, openhabdevice.item.type, "openhabDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);
@@ -3769,7 +3818,7 @@ app.controller('OpenHABController', function ($scope, $location, bridgeService,
for(var i = 0; i < $scope.bulk.devices.length; i++) {
for(var x = 0; x < bridgeService.state.openhabdevices.length; x++) {
if(bridgeService.state.openhabdevices[x].devicename === $scope.bulk.devices[i]) {
$scope.buildDeviceUrls(bridgeService.state.openhabdevices[x],dim_control,true);
$scope.buildDeviceUrls(bridgeService.state.openhabdevices[x],dim_control, null, null, null, null, null, null, null, null, true);
devicesList[i] = {
name: $scope.device.name,
mapId: $scope.device.mapId,
@@ -3996,6 +4045,156 @@ app.controller('FhemController', function ($scope, $location, bridgeService, ngD
};
});
app.controller('BroadlinkController', function ($scope, $location, bridgeService, ngDialog) {
$scope.bridge = bridgeService.state;
$scope.device = bridgeService.state.device;
$scope.device_dim_control = "";
$scope.bulk = { devices: [] };
$scope.selectAll = false;
bridgeService.viewBroadlinkDevices();
$scope.imgButtonsUrl = "glyphicon glyphicon-plus";
$scope.buttonsVisible = false;
$scope.clearDevice = function () {
bridgeService.clearDevice();
$scope.device = bridgeService.state.device;
};
$scope.buildDeviceUrls = function (broadlinkdevice, dim_control, ondata, dimdata, offdata, colordata, buildonly) {
var preCmd = "{\"id\":\"" + broadlinkdevice.id + "\",\"name\":\"" + broadlinkdevice.name +"\",\"command\":\"";
if(broadlinkdevice.type === 'SP1' || broadlinkdevice.type === 'SP2') {
dimpayload = null;
colorpayload = null;
onpayload = preCmd + "on\"}";
offpayload = preCmd + "off\"}";
}
else if(broadlinkdevice.type === 'MP1') {
dimpayload = null;
colorpayload = null;
onpayload = preCmd + "on\",\"data\":\"" + ondata + "\"}";
offpayload = preCmd + "off\",\"data\":\"" + offdata + "\"}";
} else {
if( ondata !== undefined && ondata !== null && ondata !== "")
onpayload = preCmd + "ircommand\",\"data\":\"" + ondata + "\"}";
else
onpayload = null;
if( dimdata !== undefined && dimdata !== null && dimdata !== "")
dimpayload = preCmd + "ircommand\",\"data\":\"" + dimdata + "\"}";
else
dimpayload = null;
if( offdata !== undefined && offdata !== null && offdata !== "")
offpayload = preCmd + "ircommand\",\"data\":\"" + offdata + "\"}";
else
offpayload = null;
if( colordata !== undefined && colordata !== null && colordata !== "")
colorpayload = preCmd + "ircommand\",\"data\":\"" + colordata + "\"}";
else
colorpayload = null;
}
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, broadlinkdevice.id, broadlinkdevice.name, broadlinkdevice.id, broadlinkdevice.type, "broadlinkDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);
$location.path('/editdevice');
}
};
$scope.bulkAddDevices = function(dim_control) {
var devicesList = [];
$scope.clearDevice();
for(var i = 0; i < $scope.bulk.devices.length; i++) {
for(var x = 0; x < bridgeService.state.broadlinkdevices.length; x++) {
if(bridgeService.state.broadlinkdevices[x].devicename === $scope.bulk.devices[i]) {
$scope.buildDeviceUrls(bridgeService.state.broadlinkdevices[x],dim_control,null,null,null,null,true);
devicesList[i] = {
name: $scope.device.name,
mapId: $scope.device.mapId,
mapType: $scope.device.mapType,
deviceType: $scope.device.deviceType,
targetDevice: $scope.device.targetDevice,
onUrl: $scope.device.onUrl,
dimUrl: $scope.device.dimUrl,
offUrl: $scope.device.offUrl,
colorUrl: $scope.device.colorUrl,
headers: $scope.device.headers,
httpVerb: $scope.device.httpVerb,
contentType: $scope.device.contentType,
contentBody: $scope.device.contentBody,
contentBodyDim: $scope.device.contentBodyDim,
contentBodyOff: $scope.device.contentBodyOff
};
$scope.clearDevice();
}
}
}
bridgeService.bulkAddDevice(devicesList).then(
function () {
$scope.clearDevice();
bridgeService.viewDevices();
bridgeService.viewHalDevices();
},
function (error) {
bridgeService.displayWarn("Error adding openhab devices in bulk.", error)
}
);
$scope.bulk = { devices: [] };
$scope.selectAll = false;
};
$scope.toggleSelection = function toggleSelection(deviceId) {
var idx = $scope.bulk.devices.indexOf(deviceId);
// is currently selected
if (idx > -1) {
$scope.bulk.devices.splice(idx, 1);
if($scope.bulk.devices.length === 0 && $scope.selectAll)
$scope.selectAll = false;
}
// is newly selected
else {
$scope.bulk.devices.push(deviceId);
$scope.selectAll = true;
}
};
$scope.toggleSelectAll = function toggleSelectAll() {
if($scope.selectAll) {
$scope.selectAll = false;
$scope.bulk = { devices: [] };
}
else {
$scope.selectAll = true;
for(var x = 0; x < bridgeService.state.broadlinkdevices.length; x++) {
if($scope.bulk.devices.indexOf(bridgeService.state.broadlinkdevices[x]) < 0)
$scope.bulk.devices.push(bridgeService.state.broadlinkdevices[x].devicename);
}
}
};
$scope.toggleButtons = function () {
$scope.buttonsVisible = !$scope.buttonsVisible;
if($scope.buttonsVisible)
$scope.imgButtonsUrl = "glyphicon glyphicon-minus";
else
$scope.imgButtonsUrl = "glyphicon glyphicon-plus";
};
$scope.deleteDevice = function (device) {
$scope.bridge.device = device;
ngDialog.open({
template: 'deleteDialog',
controller: 'DeleteDialogCtrl',
className: 'ngdialog-theme-default'
});
};
$scope.editDevice = function (device) {
bridgeService.editDevice(device);
$location.path('/editdevice');
};
});
app.controller('EditController', function ($scope, $location, bridgeService) {
$scope.bridge = bridgeService.state;
$scope.device = bridgeService.state.device;
@@ -4445,6 +4644,20 @@ app.filter('configuredFhemItems', function (bridgeService) {
}
});
app.filter('configuredBroadlinkItems', function (bridgeService) {
return function(input) {
var out = [];
if(input === undefined || input === null || input.length === undefined)
return out;
for (var i = 0; i < input.length; i++) {
if (bridgeService.deviceContainsType(input[i], "broadlink")) {
out.push(input[i]);
}
}
return out;
}
});
app.filter('filterDevicesByRequester', function () {
return function(input,search,mustContain,deviceType) {
var out = [];

View File

@@ -0,0 +1,237 @@
<ul class="nav nav-pills" role="tablist">
<li role="presentation"><a href="#!/">Bridge Devices</a></li>
<li role="presentation"><a href="#!/system">Bridge Control</a></li>
<li role="presentation"><a href="#!/logs">Logs</a></li>
<li ng-if="bridge.showVera" role="presentation"><a href="#!/veradevices">Vera Devices</a></li>
<li ng-if="bridge.showVera" role="presentation"><a href="#!/verascenes">Vera Scenes</a></li>
<li ng-if="bridge.showFibaro" role="presentation"><a href="#!/fibarodevices">Fibaro Devices</a></li>
<li ng-if="bridge.showFibaro" role="presentation"><a href="#!/fibaroscenes">Fibaro Scenes</a></li>
<li ng-if="bridge.showHarmony" role="presentation"><a href="#!/harmonyactivities">Harmony Activities</a></li>
<li ng-if="bridge.showHarmony" role="presentation"><a href="#!/harmonydevices">Harmony Devices</a></li>
<li ng-if="bridge.showNest" role="presentation"><a href="#!/nest">Nest</a></li>
<li ng-if="bridge.showHue" role="presentation"><a href="#!/huedevices">Hue Devices</a></li>
<li ng-if="bridge.showHal" role="presentation"><a href="#!/haldevices">HAL Devices</a></li>
<li ng-if="bridge.showMqtt" role="presentation"><a href="#!/mqttmessages">MQTT Messages</a></li>
<li ng-if="bridge.showHass" role="presentation"><a href="#!/hassdevices">HomeAssistant Devices</a></li>
<li ng-if="bridge.showDomoticz" role="presentation"><a href="#!/domoticzdevices">Domoticz Devices</a></li>
<li ng-if="bridge.showSomfy" role="presentation"><a href="#!/somfydevices">Somfy Devices</a></li>
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX Devices</a></li>
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showbroadlink" role="presentation"><a href="#!/broadlinkdevices">broadlink Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation" class="active"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Broadlink Device List
({{bridge.broadlinkdevices.length}})</h2>
</div>
<div class="panel-body">
<p class="text-muted">For any Broadlink Device, use the build action buttons
to generate the item addition information into the ha-bridge device and this will put you into the edit screen. Then
you can modify the name to anything you want that will be the keyword
for the Echo or Google Home. Also, you can go back to any helper tab and click a build
action button to add another item for a multi-command. After you are
done in the edit tab, click the 'Add Bridge Device' to finish that selection
setup. The 'Already Configured Broadlink Devices' list below will show what
is already setup for your broadlink.</p>
<p class="text-muted">
Also, use this select menu for which type of dim control you would
like to be generated: <select name="device-dim-control"
id="device-dim-control" ng-model="device_dim_control">
<option value="">none</option>
<option value="${intensity.byte}">Pass-thru Value</option>
<option value="${intensity.percent}">Percentage</option>
<option value="${intensity.decimal_percent}">Decimal Percentage</option>
<option value="${intensity.math(X*1)}">Custom Math</option>
</select>
</p>
<p class="text-muted">Use the check boxes by the names to use the bulk addition
feature. Select your items and dim control type if wanted, then click
bulk add below. Your items will be added with on and off or dim and
off if selected with the name of the device from the Broadlink.</p>
<scrollable-table watch="bridge.broadlinkdevices">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th sortable-header col="id">
<span><input type="checkbox" name="selectAll"
value="{{selectAll}}"
ng-checked="selectAll"
ng-click="toggleSelectAll()"> ID</span></th>
<th sortable-header col="desc">Description</th>
<th sortable-header col="type">Type</th>
<th col="string-actions">On Actions</th>
<th col="string-actions">Dim Actions</th>
<th col="string-actions">Off Actions</th>
<th col="string-actions">Color Actions</th>
<th>Build Actions</th>
</tr>
</thead>
<tr ng-if="broadlinkdevice.type === 'SP1' || broadlinkdevice.type === 'SP2'" ng-repeat="broadlinkdevice in bridge.broadlinkdevices">
<td>{{$index+1}}</td>
<td><input type="checkbox" name="bulk.devices[]"
value="{{broadlinkdevice.id}}"
ng-checked="bulk.devices.indexOf(broadlinkdevice.id) > -1"
ng-click="toggleSelection(broadlinkdevice.id)">
{{broadlinkdevice.id}}</td>
<td>{{broadlinkdevice.name}}</td>
<td>{{broadlinkdevice.type}}</td>
<td>
On
</td>
<td>
Not Available
</td>
<td>
Off
</td>
<td>
Not Available
</td>
<td>
<button class="btn btn-success" type="submit"
ng-click="buildDeviceUrls(broadlinkdevice, device_dim_control, null, null, null, null, false)">Build Item</button>
</td>
</tr>
<tr ng-if="broadlinkdevice.type === 'MP1'" ng-repeat="broadlinkdevice in bridge.broadlinkdevices">
<td>{{$index+1}}</td>
<td><input type="checkbox" name="bulk.devices[]"
value="{{broadlinkdevice.id}}"
ng-checked="bulk.devices.indexOf(broadlinkdevice.id) > -1"
ng-click="toggleSelection(broadlinkdevice.id)">
{{broadlinkdevice.id}}</td>
<td>{{broadlinkdevice.name}}</td>
<td>{{broadlinkdevice.type}}</td>
<td>
On
<select name="on-input-device-action" id="on-input-device-action" ng-model="ondata">
<option value="1">Socket 1</option>
<option value="2">Socket 2</option>
<option value="3">Socket 3</option>
<option value="4">Socket 4</option>
</select>
</td>
<td>
Not Available
</td>
<td>
Off
<select name="off-input-device-action" id="off-input-device-action" ng-model="offdata">
<option value="1">Socket 1</option>
<option value="2">Socket 2</option>
<option value="3">Socket 3</option>
<option value="4">Socket 4</option>
</select>
</td>
<td>
Not Available
</td>
<td>
<button class="btn btn-success" type="submit"
ng-click="buildDeviceUrls(broadlinkdevice, device_dim_control, ondata, null, offdata, null, false)">Build Item</button>
</td>
</tr>
<tr ng-if="broadlinkdevice.type === 'RM2'" ng-repeat="broadlinkdevice in bridge.broadlinkdevices">
<td>{{$index+1}}</td>
<td><input type="checkbox" name="bulk.devices[]"
value="{{broadlinkdevice.id}}"
ng-checked="bulk.devices.indexOf(broadlinkdevice.id) > -1"
ng-click="toggleSelection(broadlinkdevice.id)">
{{broadlinkdevice.id}}</td>
<td>{{broadlinkdevice.name}}</td>
<td>{{broadlinkdevice.type}}</td>
<td>
<input id="on-input-device-action"
class="form-control" type="text"
ng-model="ondata"
placeholder="IR Code Data in Hex String">
</td>
<td>
<input id="dim-input-device-action"
class="form-control" type="text"
ng-model="dimdata"
placeholder="IR Code Data in Hex String">
</td>
<td>
<input id="off-input-device-action"
class="form-control" type="text"
ng-model="offdata"
placeholder="IR Code Data in Hex String">
</td>
<td>
<input id="color-input-device-action"
class="form-control" type="text"
ng-model="colordata"
placeholder="IR Code Data in Hex String">
</td>
<td>
<button class="btn btn-success" type="submit"
ng-click="buildDeviceUrls(broadlinkdevice, device_dim_control, ondata, dimdata, offdata, colordata, false)">Build Item</button>
</td>
</tr>
</table>
</scrollable-table>
<div class="panel-footer">
<button class="btn btn-success" type="submit"
ng-click="bulkAddDevices(device_dim_control)">Bulk Add
({{bulk.devices.length}})</button>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
Already Configured Broadlink Devices <a ng-click="toggleButtons()"><span
class={{imgButtonsUrl}} aria-hidden="true"></span></a></a>
</h2>
</div>
<div ng-if="buttonsVisible" class="panel-body">
<scrollable-table watch="bridge.broadlinkdevices">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th sortable-header col="name">Name</th>
<th sortable-header col="category">Category</th>
<th sortable-header col="broadlinkname">Broadlink</th>
<th>Map Id</th>
<th>Actions</th>
</tr>
</thead>
<tr
ng-repeat="device in bridge.devices | configuredBroadlinkItems">
<td>{{$index+1}}</td>
<td>{{device.name}}</td>
<td>{{device.deviceType}}</td>
<td>{{device.targetDevice}}</td>
<td>{{device.mapId}}</td>
<td>
<p>
<button class="btn btn-warning" type="submit"
ng-click="editDevice(device)">Edit</button>
<button class="btn btn-danger" type="submit"
ng-click="deleteDevice(device)">Delete</button>
</p>
</td>
</tr>
</table>
</scrollable-table>
</div>
</div>
<script type="text/ng-template" id="deleteMapandIdDialog">
<div class="ngdialog-message">
<h2>Device Map and Id?</h2>
<p>{{mapandid.mapType}} with {{mapandid.id}}</p>
<p>Are you Sure?</p>
</div>
<div class="ngdialog-buttons mt">
<button type="button" class="ngdialog-button ngdialog-button-error" ng-click="deleteMapandId(mapandid)">Delete</button>
</div>
</script>

View File

@@ -20,6 +20,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>
<div postrender-action="goToRow()">

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -21,6 +21,7 @@
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li role="presentation" class="active"><a href="#!/editdevice">Add/Edit</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
</ul>
<div class="panel panel-default">

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation" class="active"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>
@@ -111,7 +112,7 @@
</tr>
</thead>
<tr
ng-repeat="device in bridge.devices | configuredfhemItems">
ng-repeat="device in bridge.devices | configuredFhemItems">
<td>{{$index+1}}</td>
<td>{{device.name}}</td>
<td>{{device.deviceType}}</td>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation" class="active"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation" class="active"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>
@@ -64,11 +65,40 @@
<th sortable-header col="type">Type</th>
<th sortable-header col="openhabname">OpenHAB</th>
<th col="string-actions">On Actions</th>
<th col="string-actions">Dim Actions</th>
<th col="string-actions">Off Actions</th>
<th col="string-actions">Color Actions</th>
<th>Build Actions</th>
</tr>
</thead>
<tr ng-repeat="openhabdevice in bridge.openhabdevices">
<tr ng-if="openhabdevice.item.type !== 'String'" ng-repeat="openhabdevice in bridge.openhabdevices">
<td>{{$index+1}}</td>
<td><input type="checkbox" name="bulk.devices[]"
value="{{openhabdevice.item.name}}"
ng-checked="bulk.devices.indexOf(openhabdevice.item.name) > -1"
ng-click="toggleSelection(openhabdevice.item.name)">
{{openhabdevice.item.name}}</td>
<td>{{openhabdevice.item.type}}</td>
<td>{{openhabdevice.name}}</td>
<td>
On
</td>
<td>
<div ng-if="openhabdevice.item.type === 'Dimmer'">Use Dim Control selection</div>
<div ng-if="openhabdevice.item.type !== 'Dimmer'">Not Available</div>
</td>
<td>
Off
</td>
<td>
Not Available
</td>
<td>
<button class="btn btn-success" type="submit"
ng-click="buildDeviceUrls(openhabdevice, device_dim_control, null, null, null, null, null, null, null, null, false)">Build Item</button>
</td>
</tr>
<tr ng-if="openhabdevice.item.type === 'String'" ng-repeat="openhabdevice in bridge.openhabdevices">
<td>{{$index+1}}</td>
<td><input type="checkbox" name="bulk.devices[]"
value="{{openhabdevice.item.name}}"
@@ -78,32 +108,56 @@
<td>{{openhabdevice.item.type}}</td>
<td>{{openhabdevice.name}}</td>
<td>
<select name="on-device-action" id="on-device-action" ng-model="ondeviceaction">
<select name="on-device-action" id="on-device-action" ng-model="onaction">
<option value="">None</option>
<option ng-repeat="option in openhabdevice.item.stateDescription.options"
value="{{option.value}}">{{option.label}}</option>
<option value="other">Other</option>
</select>
<input id="on-input-device-action"
<input ng-if="onaction === 'other'" id="on-input-device-action"
class="form-control" type="text"
ng-model="oninputdeviceaction"
ng-model="ondata"
placeholder="Type Action if Other">
</td>
<td>
<select name="off-device-action" id="off-device-action" ng-model="offdeviceaction">
<select name="dim-device-action" id="dim-device-action" ng-model="dimaction">
<option value="">None</option>
<option ng-repeat="option in openhabdevice.item.stateDescription.options"
value="{{option.value}}">{{option.label}}</option>
<option value="other">Other</option>
</select>
<input id="off-input-device-action"
<input ng-if="dimaction === 'other'" id="dim-input-device-action"
class="form-control" type="text"
ng-model="offinputdeviceaction"
ng-model="dimdata"
placeholder="Type Action if Other">
</td>
<td>
<select name="off-device-action" id="off-device-action" ng-model="offaction">
<option value="">None</option>
<option ng-repeat="option in openhabdevice.item.stateDescription.options"
value="{{option.value}}">{{option.label}}</option>
<option value="other">Other</option>
</select>
<input ng-if="offaction === 'other'" id="off-input-device-action"
class="form-control" type="text"
ng-model="offdata"
placeholder="Type Action if Other">
</td>
<td>
<select name="color-device-action" id="color-device-action" ng-model="coloraction">
<option value="">None</option>
<option ng-repeat="option in openhabdevice.item.stateDescription.options"
value="{{option.value}}">{{option.label}}</option>
<option value="other">Other</option>
</select>
<inpu ng-if="coloraction === 'other'"t id="color-input-device-action"
class="form-control" type="text"
ng-model="colordata"
placeholder="Type Action if Other">
</td>
<td>
<button class="btn btn-success" type="submit"
ng-click="buildDeviceUrls(openhabdevice, device_dim_control, ondeviceaction, oninputdeviceaction, offdeviceaction, offinputdeviceaction, false)">Build Item</button>
ng-click="buildDeviceUrls(openhabdevice, device_dim_control, onaction, ondata, dimaction, dimdata, offaction, offdata, coloraction, colordata, false)">Build Item</button>
</td>
</tr>
</table>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>