Updated FHEM integration for testing

This commit is contained in:
bsamuels
2018-01-02 16:20:51 -06:00
parent 4c694cb285
commit f27d905869
33 changed files with 434 additions and 24 deletions

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId> <groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId> <artifactId>ha-bridge</artifactId>
<version>5.1.0d</version> <version>5.1.0e</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>HA Bridge</name> <name>HA Bridge</name>

View File

@@ -211,6 +211,7 @@ public class BridgeSettings extends BackupHandler {
theBridgeSettings.setSomfyconfigured(theBridgeSettings.isValidSomfy()); theBridgeSettings.setSomfyconfigured(theBridgeSettings.isValidSomfy());
theBridgeSettings.setHomeWizardConfigured(theBridgeSettings.isValidHomeWizard()); theBridgeSettings.setHomeWizardConfigured(theBridgeSettings.isValidHomeWizard());
theBridgeSettings.setOpenhabconfigured(theBridgeSettings.isValidOpenhab()); theBridgeSettings.setOpenhabconfigured(theBridgeSettings.isValidOpenhab());
theBridgeSettings.setFhemconfigured(theBridgeSettings.isValidFhem());
// Lifx is either configured or not, so it does not need an update. // Lifx is either configured or not, so it does not need an update.
if(serverPortOverride != null) if(serverPortOverride != null)
theBridgeSettings.setServerPort(serverPortOverride); theBridgeSettings.setServerPort(serverPortOverride);

View File

@@ -105,6 +105,9 @@ public class BridgeSettingsDescriptor {
@SerializedName("upnpsenddelay") @SerializedName("upnpsenddelay")
@Expose @Expose
private Integer upnpsenddelay; private Integer upnpsenddelay;
@SerializedName("fhemaddress")
@Expose
private IpList fhemaddress;
private boolean settingsChanged; private boolean settingsChanged;
private boolean veraconfigured; private boolean veraconfigured;
@@ -120,6 +123,7 @@ public class BridgeSettingsDescriptor {
private boolean lifxconfigured; private boolean lifxconfigured;
private boolean homewizardconfigured; private boolean homewizardconfigured;
private boolean openhabconfigured; private boolean openhabconfigured;
private boolean fhemconfigured;
// Deprecated settings // Deprecated settings
private String haltoken; private String haltoken;
@@ -447,6 +451,18 @@ public class BridgeSettingsDescriptor {
public void setUpnpsenddelay(Integer upnpsenddelay) { public void setUpnpsenddelay(Integer upnpsenddelay) {
this.upnpsenddelay = upnpsenddelay; this.upnpsenddelay = upnpsenddelay;
} }
public IpList getFhemaddress() {
return fhemaddress;
}
public void setFhemaddress(IpList fhemaddress) {
this.fhemaddress = fhemaddress;
}
public boolean isFhemconfigured() {
return fhemconfigured;
}
public void setFhemconfigured(boolean fhemconfigured) {
this.fhemconfigured = fhemconfigured;
}
public Boolean isValidVera() { public Boolean isValidVera() {
if(this.getVeraAddress() == null || this.getVeraAddress().getDevices().size() <= 0) if(this.getVeraAddress() == null || this.getVeraAddress().getDevices().size() <= 0)
return false; return false;
@@ -564,4 +580,14 @@ public class BridgeSettingsDescriptor {
return true; return true;
} }
public Boolean isValidFhem() {
if(this.getFhemaddress() == null || this.getFhemaddress().getDevices().size() <= 0)
return false;
List<NamedIP> devicesList = this.getFhemaddress().getDevices();
if(devicesList.get(0).getIp().contains(Configuration.DEFAULT_ADDRESS))
return false;
return true;
}
} }

View File

@@ -32,6 +32,7 @@ public class DeviceMapTypes {
public final static String[] SOMFY_DEVICE = { "somfyDevice", "Somfy Device"}; public final static String[] SOMFY_DEVICE = { "somfyDevice", "Somfy Device"};
public final static String[] LIFX_DEVICE = { "lifxDevice", "LIFX Device"}; public final static String[] LIFX_DEVICE = { "lifxDevice", "LIFX Device"};
public final static String[] OPENHAB_DEVICE = { "openhabDevice", "OpenHAB Device"}; public final static String[] OPENHAB_DEVICE = { "openhabDevice", "OpenHAB Device"};
public final static String[] FHEM_DEVICE = { "fhemDevice", "FHEM Device"};
public final static int typeIndex = 0; public final static int typeIndex = 0;
public final static int displayIndex = 1; public final static int displayIndex = 1;
@@ -65,6 +66,7 @@ public class DeviceMapTypes {
deviceMapTypes.add(FIBARO_SCENE); deviceMapTypes.add(FIBARO_SCENE);
deviceMapTypes.add(SOMFY_DEVICE); deviceMapTypes.add(SOMFY_DEVICE);
deviceMapTypes.add(OPENHAB_DEVICE); deviceMapTypes.add(OPENHAB_DEVICE);
deviceMapTypes.add(FHEM_DEVICE);
} }
public static int getTypeIndex() { public static int getTypeIndex() {
return typeIndex; return typeIndex;

View File

@@ -11,6 +11,7 @@ import com.bwssystems.HABridge.devicemanagmeent.ResourceHandler;
import com.bwssystems.HABridge.plugins.NestBridge.NestHome; import com.bwssystems.HABridge.plugins.NestBridge.NestHome;
import com.bwssystems.HABridge.plugins.domoticz.DomoticzHome; import com.bwssystems.HABridge.plugins.domoticz.DomoticzHome;
import com.bwssystems.HABridge.plugins.exec.CommandHome; import com.bwssystems.HABridge.plugins.exec.CommandHome;
import com.bwssystems.HABridge.plugins.fhem.FHEMHome;
import com.bwssystems.HABridge.plugins.hal.HalHome; import com.bwssystems.HABridge.plugins.hal.HalHome;
import com.bwssystems.HABridge.plugins.harmony.HarmonyHome; import com.bwssystems.HABridge.plugins.harmony.HarmonyHome;
import com.bwssystems.HABridge.plugins.hass.HassHome; import com.bwssystems.HABridge.plugins.hass.HassHome;
@@ -106,7 +107,7 @@ public class HomeManager {
aHome = new DomoticzHome(bridgeSettings); aHome = new DomoticzHome(bridgeSettings);
homeList.put(DeviceMapTypes.DOMOTICZ_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.DOMOTICZ_DEVICE[DeviceMapTypes.typeIndex], aHome);
resourceList.put(DeviceMapTypes.DOMOTICZ_DEVICE[DeviceMapTypes.typeIndex], aHome); resourceList.put(DeviceMapTypes.DOMOTICZ_DEVICE[DeviceMapTypes.typeIndex], aHome);
//setup the Somfy configuration if available //setup the Somfy configuration if availableOPENHAB
aHome = new SomfyHome(bridgeSettings); aHome = new SomfyHome(bridgeSettings);
homeList.put(DeviceMapTypes.SOMFY_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.SOMFY_DEVICE[DeviceMapTypes.typeIndex], aHome);
resourceList.put(DeviceMapTypes.SOMFY_DEVICE[DeviceMapTypes.typeIndex], aHome); resourceList.put(DeviceMapTypes.SOMFY_DEVICE[DeviceMapTypes.typeIndex], aHome);
@@ -118,6 +119,10 @@ public class HomeManager {
aHome = new OpenHABHome(bridgeSettings); aHome = new OpenHABHome(bridgeSettings);
resourceList.put(DeviceMapTypes.OPENHAB_DEVICE[DeviceMapTypes.typeIndex], aHome); resourceList.put(DeviceMapTypes.OPENHAB_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.OPENHAB_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.OPENHAB_DEVICE[DeviceMapTypes.typeIndex], aHome);
//setup the OpenHAB configuration if available
aHome = new FHEMHome(bridgeSettings);
resourceList.put(DeviceMapTypes.FHEM_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.FHEM_DEVICE[DeviceMapTypes.typeIndex], aHome);
} }
public Home findHome(String type) { public Home findHome(String type) {

View File

@@ -321,6 +321,12 @@ public class DeviceResource {
return homeManager.findResource(DeviceMapTypes.OPENHAB_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.OPENHAB_DEVICE[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.OPENHAB_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.OPENHAB_DEVICE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/fhem/devices", "application/json", (request, response) -> {
log.debug("Get FHEM devices");
response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.FHEM_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.FHEM_DEVICE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer());
get (API_CONTEXT + "/map/types", "application/json", (request, response) -> { get (API_CONTEXT + "/map/types", "application/json", (request, response) -> {
log.debug("Get map types"); log.debug("Get map types");
return new DeviceMapTypes().getDeviceMapTypes(); return new DeviceMapTypes().getDeviceMapTypes();

View File

@@ -4,7 +4,7 @@ public class FHEMDevice {
private String address; private String address;
private String name; private String name;
private FHEMItem item; private Result item;
public String getAddress() { public String getAddress() {
return address; return address;
} }
@@ -17,11 +17,10 @@ public class FHEMDevice {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public FHEMItem getItem() { public Result getItem() {
return item; return item;
} }
public void setItem(FHEMItem item) { public void setItem(Result item) {
this.item = item; this.item = item;
} }
} }

View File

@@ -131,7 +131,7 @@ public class FHEMHome implements Home {
if(!validFhem) if(!validFhem)
return null; return null;
log.debug("consolidating devices for java.lang.String"); log.debug("consolidating devices for FHEM");
List<FHEMDevice> theResponse = null; List<FHEMDevice> theResponse = null;
Iterator<String> keys = fhemMap.keySet().iterator(); Iterator<String> keys = fhemMap.keySet().iterator();
List<FHEMDevice> deviceList = new ArrayList<FHEMDevice>(); List<FHEMDevice> deviceList = new ArrayList<FHEMDevice>();
@@ -160,12 +160,12 @@ public class FHEMHome implements Home {
@Override @Override
public Home createHome(BridgeSettings bridgeSettings) { public Home createHome(BridgeSettings bridgeSettings) {
fhemMap = null; fhemMap = null;
validFhem = bridgeSettings.getBridgeSettingsDescriptor().isValidOpenhab(); validFhem = bridgeSettings.getBridgeSettingsDescriptor().isValidFhem();
log.info("FHEM Home created." + (validFhem ? "" : " No FHEMs configured.")); log.info("FHEM Home created." + (validFhem ? "" : " No FHEMs configured."));
if(validFhem) { if(validFhem) {
fhemMap = new HashMap<String,FHEMInstance>(); fhemMap = new HashMap<String,FHEMInstance>();
httpClient = HTTPHome.getHandler(); httpClient = HTTPHome.getHandler();
Iterator<NamedIP> theList = bridgeSettings.getBridgeSettingsDescriptor().getOpenhabaddress().getDevices().iterator(); Iterator<NamedIP> theList = bridgeSettings.getBridgeSettingsDescriptor().getFhemaddress().getDevices().iterator();
while(theList.hasNext() && validFhem) { while(theList.hasNext() && validFhem) {
NamedIP aFhem = theList.next(); NamedIP aFhem = theList.next();
try { try {

View File

@@ -49,7 +49,7 @@ public class FHEMInstance {
public List<FHEMDevice> getDevices(HTTPHandler httpClient) { public List<FHEMDevice> getDevices(HTTPHandler httpClient) {
List<FHEMDevice> deviceList = null; List<FHEMDevice> deviceList = null;
FHEMItem[] theFhemStates; FHEMItem theFhemStates;
String theUrl = null; String theUrl = null;
String theData; String theData;
NameValue[] headers = null; NameValue[] headers = null;
@@ -61,24 +61,25 @@ public class FHEMInstance {
theUrl = theUrl + theFhem.getUsername() + ":" + theFhem.getPassword() + "@"; theUrl = theUrl + theFhem.getUsername() + ":" + theFhem.getPassword() + "@";
} }
theUrl = theUrl + theFhem.getIp() + ":" + theFhem.getPort() + "/fhem?cmd=jsonlist2"; theUrl = theUrl + theFhem.getIp() + ":" + theFhem.getPort() + "/fhem?cmd=jsonlist2";
if(theFhem.getWebhook() != null && !theFhem.getWebhook().trim().isEmpty())
theUrl = theUrl + "%20room=" + theFhem.getWebhook().trim();
theData = httpClient.doHttpRequest(theUrl, HttpGet.METHOD_NAME, "application/json", null, headers); theData = httpClient.doHttpRequest(theUrl, HttpGet.METHOD_NAME, "application/json", null, headers);
if(theData != null) { if(theData != null) {
log.debug("GET FHEM States - data: " + theData); log.debug("GET FHEM States - data: " + theData);
theData = getJSONData(theData); theData = getJSONData(theData);
theFhemStates = new Gson().fromJson(theData, FHEMItem[].class); theFhemStates = new Gson().fromJson(theData, FHEMItem.class);
if(theFhemStates == null) { if(theFhemStates == null) {
log.warn("Cannot get an devices for FHEM " + theFhem.getName() + " as response is not parsable."); log.warn("Cannot get any devices for FHEM " + theFhem.getName() + " as response is not parsable.");
} }
else { else {
deviceList = new ArrayList<FHEMDevice>(); deviceList = new ArrayList<FHEMDevice>();
for (int i = 0; i < theFhemStates.length; i++) { for (Result aResult:theFhemStates.getResults()) {
FHEMDevice aNewFhemDeviceDevice = new FHEMDevice(); FHEMDevice aNewFhemDeviceDevice = new FHEMDevice();
aNewFhemDeviceDevice.setItem(theFhemStates[i]); aNewFhemDeviceDevice.setItem(aResult);
aNewFhemDeviceDevice.setAddress(theFhem.getIp() + ":" + theFhem.getPort()); aNewFhemDeviceDevice.setAddress(theFhem.getIp() + ":" + theFhem.getPort());
aNewFhemDeviceDevice.setName(theFhem.getName()); aNewFhemDeviceDevice.setName(theFhem.getName());
deviceList.add(aNewFhemDeviceDevice); deviceList.add(aNewFhemDeviceDevice);
} }
} }
} }
@@ -91,7 +92,10 @@ public class FHEMInstance {
String theData; String theData;
theData = response.substring(response.indexOf("<pre>") + 4); theData = response.substring(response.indexOf("<pre>") + 4);
theData = theData.substring(1, theData.indexOf("</pre>") - 1); theData = theData.substring(1, theData.indexOf("</pre>") - 1);
// TODO Fix stripping out new line chars theData = theData.replace("\n", "");
theData = theData.replace("\r", "");
theData = theData.replace("<a href=\"", "<a href=\\\"");
theData = theData.replace("\">", "\\\">");
return theData; return theData;
} }

View File

@@ -66,7 +66,7 @@ public class OpenHABInstance {
log.debug("GET OpenHAB States - data: " + theData); log.debug("GET OpenHAB States - data: " + theData);
theOpenhabStates = new Gson().fromJson(theData, OpenHABItem[].class); theOpenhabStates = new Gson().fromJson(theData, OpenHABItem[].class);
if(theOpenhabStates == null) { if(theOpenhabStates == null) {
log.warn("Cannot get an devices for OpenHAB " + theOpenHAB.getName() + " as response is not parsable."); log.warn("Cannot get any devices for OpenHAB " + theOpenHAB.getName() + " as response is not parsable.");
} }
else { else {
deviceList = new ArrayList<OpenHABDevice>(); deviceList = new ArrayList<OpenHABDevice>();

View File

@@ -83,6 +83,10 @@ app.config (function ($locationProvider, $routeProvider) {
templateUrl: 'views/openhabdevice.html', templateUrl: 'views/openhabdevice.html',
controller: 'OpenHABController', controller: 'OpenHABController',
requiresAuthentication: true requiresAuthentication: true
}).when ('/fhemdevices', {
templateUrl: 'views/fhemdevice.html',
controller: 'FhemController',
requiresAuthentication: true
}).when ('/login', { }).when ('/login', {
templateUrl: 'views/login.html', templateUrl: 'views/login.html',
controller: 'LoginController' controller: 'LoginController'
@@ -151,7 +155,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
this.state = {base: "./api/devices", bridgelocation: ".", systemsbase: "./system", huebase: "./api", configs: [], backups: [], devices: [], device: {}, this.state = {base: "./api/devices", bridgelocation: ".", systemsbase: "./system", huebase: "./api", configs: [], backups: [], devices: [], device: {},
mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], mapTypes: [], olddevicename: "", logShowAll: false, 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, 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, habridgeversion: {}, viewDevId: "", queueDevId: "", securityInfo: {}, filterDevicesByIpAddress: null, showHomeWizard: false, showDomoticz: false, showSomfy: false, showLifx: false, showOpenHAB: false, showFHEM: false, habridgeversion: {}, viewDevId: "", queueDevId: "", securityInfo: {}, filterDevicesByIpAddress: null,
filterDevicesOnlyFiltered: false, filterDeviceType: null}; filterDevicesOnlyFiltered: false, filterDeviceType: null};
this.displayWarn = function(errorTitle, error) { this.displayWarn = function(errorTitle, error) {
@@ -567,6 +571,11 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
return; return;
} }
this.updateShowFhem = function () {
this.state.showFHEM = self.state.settings.fhemconfigured;
return;
}
this.loadBridgeSettings = function () { this.loadBridgeSettings = function () {
return $http.get(this.state.systemsbase + "/settings").then( return $http.get(this.state.systemsbase + "/settings").then(
function (response) { function (response) {
@@ -584,6 +593,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
self.updateShowSomfy(); self.updateShowSomfy();
self.updateShowLifx(); self.updateShowLifx();
self.updateShowOpenHAB(); self.updateShowOpenHAB();
self.updateShowFhem();
}, },
function (error) { function (error) {
if (error.status === 401) if (error.status === 401)
@@ -907,6 +917,22 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
); );
}; };
this.viewFhemDevices = function () {
if (!this.state.showFHEM)
return;
return $http.get(this.state.base + "/fhem/devices").then(
function (response) {
self.state.fhemdevices = response.data;
},
function (error) {
if (error.status === 401)
$rootScope.$broadcast('securityReinit', 'done');
else
self.displayWarn("Get FHEM Devices Error: ", error);
}
);
};
this.formatCallItem = function (currentItem) { this.formatCallItem = function (currentItem) {
if(!currentItem.startsWith("{\"item") && !currentItem.startsWith("[{\"item")) { if(!currentItem.startsWith("{\"item") && !currentItem.startsWith("[{\"item")) {
if (currentItem.startsWith("[") || currentItem.startsWith("{")) if (currentItem.startsWith("[") || currentItem.startsWith("{"))
@@ -1631,6 +1657,27 @@ app.controller ('SystemController', function ($scope, $location, bridgeService,
} }
}; };
$scope.addFhemtoSettings = function (newfhemname, newfhemip, newfhemport, newfhemusername, newfhempassword, newfhemwebhook, newfhemsecure) {
if($scope.bridge.settings.fhemaddress === undefined || $scope.bridge.settings.fhemaddress === null) {
$scope.bridge.settings.fhemaddress = { devices: [] };
}
var newfhem = {name: newfhemname, ip: newfhemip, port: newfhemport, username: newfhemusername, password: newfhempassword, secure: newfhemsecure, webhook: newfhemwebhook }
$scope.bridge.settings.fhemaddress.devices.push(newfhem);
$scope.newfhemname = null;
$scope.newfhemip = null;
$scope.newfhemport = null;
$scope.newfhemusername = null;
$scope.newfhempassword = null;
$scope.newfhemwebhook = null;
};
$scope.removeFhemtoSettings = function (fhemname, fhemip) {
for(var i = $scope.bridge.settings.fhemaddress.devices.length - 1; i >= 0; i--) {
if($scope.bridge.settings.fhemaddress.devices[i].name === fhemname && $scope.bridge.settings.fhemaddress.devices[i].ip === fhemip) {
$scope.bridge.settings.fhemaddress.devices.splice(i, 1);
}
}
};
$scope.bridgeReinit = function () { $scope.bridgeReinit = function () {
bridgeService.reinit(); bridgeService.reinit();
}; };
@@ -3737,6 +3784,147 @@ app.controller('OpenHABController', function ($scope, $location, bridgeService,
}; };
}); });
app.controller('FhemController', 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.viewFhemDevices();
$scope.imgButtonsUrl = "glyphicon glyphicon-plus";
$scope.buttonsVisible = false;
$scope.clearDevice = function () {
bridgeService.clearDevice();
$scope.device = bridgeService.state.device;
};
$scope.buildDeviceUrls = function (fhemdevice, dim_control, ondeviceaction, oninputdeviceaction, offdeviceaction, offinputdeviceaction, buildonly) {
var preCmd = "/fhem?cmd=set%20" + fhemdevice.item.name + "%20";
if(fhemdevice.item.possibleSets.indexOf("dim" >= 0)) {
if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)) {
dimpayload = "{\"url\":\"http://" + fhemdevice.address + preCmd + "\",\"command\":\"dim%20" + dim_control + "\"}";
}
else
dimpayload = null;
}
else
dimpayload = null;
if(fhemdevice.item.possibleSets.indexOf("RGB" >= 0)) {
if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)) {
colorpayload = "{\"url\":\"http://" + fhemdevice.address + preCmd + "\",\"command\":\"RGB%20${color.rgbx}\"}";
}
else
colorpayload = null;
}
else
colorpayload = null;
onpayload = "{\"url\":\"http://" + fhemdevice.address + preCmd + "\",\"command\":\"on\"}";
offpayload = "{\"url\":\"http://" + fhemdevice.address + preCmd + "\",\"command\":\"off\"}";
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, fhemdevice.item.name + "-" + fhemdevice.name, fhemdevice.item.name, fhemdevice.name, fhemdevice.item.type, "fhemDevice", 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.fhemdevices.length; x++) {
if(bridgeService.state.fhemdevices[x].devicename === $scope.bulk.devices[i]) {
$scope.buildDeviceUrls(bridgeService.state.fhemdevices[x],dim_control,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 fhem 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.fhemdevices.length; x++) {
if($scope.bulk.devices.indexOf(bridgeService.state.fhemdevices[x]) < 0)
$scope.bulk.devices.push(bridgeService.state.fhemdevices[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) { app.controller('EditController', function ($scope, $location, bridgeService) {
$scope.bridge = bridgeService.state; $scope.bridge = bridgeService.state;
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
@@ -4168,6 +4356,20 @@ app.filter('configuredOpenHABItems', function (bridgeService) {
} }
}); });
app.filter('configuredFhemItems', 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], "fhem")) {
out.push(input[i]);
}
}
return out;
}
});
app.filter('filterDevicesByRequester', function () { app.filter('filterDevicesByRequester', function () {
return function(input,search,mustContain,deviceType) { return function(input,search,mustContain,deviceType) {
var out = []; var out = [];

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>
<div postrender-action="goToRow()"> <div postrender-action="goToRow()">

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -19,6 +19,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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 role="presentation" class="active"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -0,0 +1,142 @@
<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.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 role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">FHEM Device List
({{bridge.fhemdevices.length}})</h2>
</div>
<div class="panel-body">
<p class="text-muted">For any FHEM 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 FHEM Devices' list below will show what
is already setup for your FHEM.</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 FHEM.</p>
<scrollable-table watch="bridge.fhemdevices">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th sortable-header col="name">
<span><input type="checkbox" name="selectAll"
value="{{selectAll}}"
ng-checked="selectAll"
ng-click="toggleSelectAll()"> Name</span></th>
<th sortable-header col="fhemname">FHEM</th>
<th sortable-header col="type">Capabilities</th>
<th>Build Actions</th>
</tr>
</thead>
<tr ng-repeat="fhemdevice in bridge.fhemdevices">
<td>{{$index+1}}</td>
<td><input type="checkbox" name="bulk.devices[]"
value="{{fhemdevice.item.name}}"
ng-checked="bulk.devices.indexOf(fhemdevice.item.name) > -1"
ng-click="toggleSelection(fhemdevice.item.name)">
{{fhemdevice.item.name}}</td>
<td>{{fhemdevice.name}}</td>
<td>{{fhemdevice.item.possibleSets}}</td>
<td>
<button class="btn btn-success" type="submit"
ng-click="buildDeviceUrls(fhemdevice, device_dim_control, 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 FHEM 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.fhemdevices">
<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="fhemname">FHEM</th>
<th>Map Id</th>
<th>Actions</th>
</tr>
</thead>
<tr
ng-repeat="device in bridge.devices | configuredfhemItems">
<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

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX Devices</a></li> <li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX Devices</a></li>
<li ng-if="bridge.showHomeWizard" role="presentation" class="active"><a href="#!/homewizarddevices">HomeWizard Devices</a></li> <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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation" class="active"><a href="#!/lifxdevices">LIFX Devices</a></li> <li ng-if="bridge.showLifx" role="presentation" class="active"><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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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 role="presentation"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -637,6 +637,7 @@
<th>Port</th> <th>Port</th>
<th>Username (opt)</th> <th>Username (opt)</th>
<th>Password (opt)</th> <th>Password (opt)</th>
<th>Room (opt)</th>
<th>Use SSL</th> <th>Use SSL</th>
<th>Manage</th> <th>Manage</th>
</tr> </tr>
@@ -657,6 +658,9 @@
<td><input id="bridge-settings-next-fhem-password" <td><input id="bridge-settings-next-fhem-password"
class="form-control" type="password" ng-model="fhem.password" class="form-control" type="password" ng-model="fhem.password"
placeholder="FHEM password (opt)"></td> placeholder="FHEM password (opt)"></td>
<td><input id="bridge-settings-next-fhem-webhook"
class="form-control" type="text" ng-model="fhem.webhook"
placeholder="Room Name"></td>
<td><input type="checkbox" <td><input type="checkbox"
ng-model="fhem.secure" ng-true-value=true ng-model="fhem.secure" ng-true-value=true
ng-false-value=false></td> ng-false-value=false></td>
@@ -679,11 +683,14 @@
<td><input id="bridge-settings-new-fhem-password" <td><input id="bridge-settings-new-fhem-password"
class="form-control" type="password" ng-model="newfhempassword" class="form-control" type="password" ng-model="newfhempassword"
placeholder="FHEM password (opt)"></td> placeholder="FHEM password (opt)"></td>
<td><input id="bridge-settings-new-fhem-webhook"
class="form-control" type="text" ng-model="newfhemwebhook"
placeholder="Room Name"></td>
<td><input type="checkbox" <td><input type="checkbox"
ng-model="newfhemsecure" ng-true-value=true ng-model="newfhemsecure" ng-true-value=true
ng-false-value=false></td> ng-false-value=false></td>
<td><button class="btn btn-success" type="submit" <td><button class="btn btn-success" type="submit"
ng-click="addFhemtoSettings(newfhemname, newfhemip, newfhemport, newsfhemusername, newfhempassword, newfhemsecure)">Add</button></td> ng-click="addFhemtoSettings(newfhemname, newfhemip, newfhemport, newsfhemusername, newfhempassword, newfhemwebhook, newfhemsecure)">Add</button></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -18,6 +18,7 @@
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX 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.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.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"><a href="#!/editdevice">Add/Edit</a></li> <li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul> </ul>

View File

@@ -248,14 +248,11 @@ public class FHEMInstanceConstructor {
aGson = new GsonBuilder() aGson = new GsonBuilder()
.create(); .create();
FHEMItem[] aService = aGson.fromJson(decodeData, FHEMItem[].class); FHEMItem aService = aGson.fromJson(decodeData, FHEMItem.class);
for(int i = 0; i < aService.length; i++) { List<Result> services = aService.getResults();
System.out.println(aService[i].getTotalResultsReturned());
List<Result> services = aService[i].getResults();
for(Result aResult:services) { for(Result aResult:services) {
System.out.println(" " + aResult.getName()); System.out.println(" " + aResult.getName());
} }
}
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }