Fixed issues with 4beta1

This commit is contained in:
Admin
2016-12-30 15:00:31 -06:00
parent 363fb605a6
commit 9c4eb58739
20 changed files with 182 additions and 124 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>4beta1.1</version> <version>4beta2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>HA Bridge</name> <name>HA Bridge</name>
@@ -15,6 +15,7 @@
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories> <repositories>

View File

@@ -4,32 +4,30 @@ import java.util.ArrayList;
public class DeviceMapTypes { public class DeviceMapTypes {
public final static String[] CUSTOM_DEVICE = { "custom", "Custom", "none"}; public final static String[] CUSTOM_DEVICE = { "custom", "Custom"};
public final static String[] VERA_DEVICE = { "veraDevice", "Vera Device", "vera"}; public final static String[] VERA_DEVICE = { "veraDevice", "Vera Device"};
public final static String[] VERA_SCENE = { "veraScene", "Vera Scene", "vera"}; public final static String[] VERA_SCENE = { "veraScene", "Vera Scene"};
public final static String[] HARMONY_ACTIVITY = { "harmonyActivity", "Harmony Activity", "harmony"}; public final static String[] HARMONY_ACTIVITY = { "harmonyActivity", "Harmony Activity"};
public final static String[] HARMONY_BUTTON = { "harmonyButton", "Harmony Button", "harmony"}; public final static String[] HARMONY_BUTTON = { "harmonyButton", "Harmony Button"};
public final static String[] NEST_HOMEAWAY = { "nestHomeAway", "Nest Home Status", "nest"}; public final static String[] NEST_HOMEAWAY = { "nestHomeAway", "Nest Home Status"};
public final static String[] NEST_THERMO_SET = { "nestThermoSet", "Nest Thermostat", "nest"}; public final static String[] NEST_THERMO_SET = { "nestThermoSet", "Nest Thermostat"};
public final static String[] HUE_DEVICE = { "hueDevice", "Hue Device", "hue"}; public final static String[] HUE_DEVICE = { "hueDevice", "Hue Device"};
public final static String[] HAL_DEVICE = { "halDevice", "HAL Device", "hal"}; public final static String[] HAL_DEVICE = { "halDevice", "HAL Device"};
public final static String[] HAL_BUTTON = { "halButton", "HAL Button", "hal"}; public final static String[] HAL_BUTTON = { "halButton", "HAL Button"};
public final static String[] HAL_HOME = { "halHome", "HAL Home Status", "hal"}; public final static String[] HAL_HOME = { "halHome", "HAL Home Status"};
public final static String[] HAL_THERMO_SET = { "halThermoSet", "HAL Thermostat", "hal"}; public final static String[] HAL_THERMO_SET = { "halThermoSet", "HAL Thermostat"};
public final static String[] MQTT_MESSAGE = { "mqttMessage", "MQTT Message", "mqtt"}; public final static String[] MQTT_MESSAGE = { "mqttMessage", "MQTT Message"};
public final static String[] EXEC_DEVICE = { "exec", "Execute Script/Program", "command"}; public final static String[] EXEC_DEVICE_COMPAT = { "exec", "Execute Script/Program"};
public final static String[] CMD_DEVICE = { "cmdDevice", "Execute Command/Script/Program", "command"}; public final static String[] CMD_DEVICE = { "cmdDevice", "Execute Command/Script/Program"};
public final static String[] HASS_DEVICE = { "hassDevice", "HomeAssistant Device", "hass"}; public final static String[] HASS_DEVICE = { "hassDevice", "HomeAssistant Device"};
public final static String[] TCP_DEVICE = { "tcpDevice", "TCP Device", "none"}; public final static String[] TCP_DEVICE = { "tcpDevice", "TCP Device"};
public final static String[] TCP_DEVICE_COMPAT = { "TCP", "TCP Device", "none"}; public final static String[] TCP_DEVICE_COMPAT = { "TCP", "TCP Device"};
public final static String[] UDP_DEVICE = { "udpDevice", "UDP Device", "none"}; public final static String[] UDP_DEVICE = { "udpDevice", "UDP Device"};
public final static String[] UDP_DEVICE_COMPAT = { "UDP", "UDP Device", "none"}; public final static String[] UDP_DEVICE_COMPAT = { "UDP", "UDP Device"};
public final static String[] HTTP_DEVICE = { "httpDevice", "HTTP Device", "none"}; public final static String[] HTTP_DEVICE = { "httpDevice", "HTTP Device"};
public final static String[] DEFAULT_DEVICE = { "udpDevice", "Default Device", "none"};
public final static int typeIndex = 0; public final static int typeIndex = 0;
public final static int displayIndex = 1; public final static int displayIndex = 1;
public final static int resourceIndex = 1;
ArrayList<String[]> deviceMapTypes; ArrayList<String[]> deviceMapTypes;
@@ -37,7 +35,6 @@ public class DeviceMapTypes {
super(); super();
deviceMapTypes = new ArrayList<String[]>(); deviceMapTypes = new ArrayList<String[]>();
deviceMapTypes.add(CMD_DEVICE); deviceMapTypes.add(CMD_DEVICE);
deviceMapTypes.add(DEFAULT_DEVICE);
deviceMapTypes.add(HAL_DEVICE); deviceMapTypes.add(HAL_DEVICE);
deviceMapTypes.add(HAL_HOME); deviceMapTypes.add(HAL_HOME);
deviceMapTypes.add(HAL_THERMO_SET); deviceMapTypes.add(HAL_THERMO_SET);
@@ -61,10 +58,23 @@ public class DeviceMapTypes {
public static int getDisplayIndex() { public static int getDisplayIndex() {
return displayIndex; return displayIndex;
} }
public static int getResourceindex() {
return resourceIndex;
}
public ArrayList<String[]> getDeviceMapTypes() { public ArrayList<String[]> getDeviceMapTypes() {
return deviceMapTypes; return deviceMapTypes;
} }
public Boolean validateType(String type) {
if(type == null || type.trim().isEmpty())
return false;
for(String[] mapType : deviceMapTypes) {
if(type.trim().contentEquals(mapType[typeIndex]))
return true;
}
if(type.trim().contentEquals(EXEC_DEVICE_COMPAT[typeIndex]))
return true;
if(type.trim().contentEquals(TCP_DEVICE_COMPAT[typeIndex]))
return true;
if(type.trim().contentEquals(UDP_DEVICE_COMPAT[typeIndex]))
return true;
return false;
}
} }

View File

@@ -31,37 +31,37 @@ public class HomeManager {
Home aHome = null; Home aHome = null;
//setup the harmony connection if available //setup the harmony connection if available
aHome = new HarmonyHome(bridgeSettings); aHome = new HarmonyHome(bridgeSettings);
resourceList.put(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.resourceIndex], aHome); resourceList.put(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.typeIndex], aHome);
resourceList.put(DeviceMapTypes.HARMONY_BUTTON[DeviceMapTypes.resourceIndex], aHome); resourceList.put(DeviceMapTypes.HARMONY_BUTTON[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.HARMONY_BUTTON[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.HARMONY_BUTTON[DeviceMapTypes.typeIndex], aHome);
//setup the nest connection if available //setup the nest connection if available
aHome = new NestHome(bridgeSettings); aHome = new NestHome(bridgeSettings);
resourceList.put(DeviceMapTypes.NEST_HOMEAWAY[DeviceMapTypes.resourceIndex], aHome); resourceList.put(DeviceMapTypes.NEST_HOMEAWAY[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.NEST_HOMEAWAY[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.NEST_HOMEAWAY[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.NEST_THERMO_SET[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.NEST_THERMO_SET[DeviceMapTypes.typeIndex], aHome);
//setup the hue passtrhu configuration if available //setup the hue passtrhu configuration if available
aHome = new HueHome(bridgeSettings); aHome = new HueHome(bridgeSettings);
resourceList.put(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.resourceIndex], aHome); resourceList.put(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex], aHome);
//setup the hal configuration if available //setup the hal configuration if available
aHome = new HalHome(bridgeSettings); aHome = new HalHome(bridgeSettings);
resourceList.put(DeviceMapTypes.HAL_DEVICE[DeviceMapTypes.resourceIndex], aHome); resourceList.put(DeviceMapTypes.HAL_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.HAL_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.HAL_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.HAL_BUTTON[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.HAL_BUTTON[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.HAL_HOME[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.HAL_HOME[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.HAL_THERMO_SET[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.HAL_THERMO_SET[DeviceMapTypes.typeIndex], aHome);
//setup the mqtt handlers if available //setup the mqtt handlers if available
aHome = new MQTTHome(bridgeSettings); aHome = new MQTTHome(bridgeSettings);
resourceList.put(DeviceMapTypes.MQTT_MESSAGE[DeviceMapTypes.resourceIndex], aHome); resourceList.put(DeviceMapTypes.MQTT_MESSAGE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.MQTT_MESSAGE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.MQTT_MESSAGE[DeviceMapTypes.typeIndex], aHome);
//setup the HomeAssistant configuration if available //setup the HomeAssistant configuration if available
aHome = new HassHome(bridgeSettings); aHome = new HassHome(bridgeSettings);
resourceList.put(DeviceMapTypes.HASS_DEVICE[DeviceMapTypes.resourceIndex], aHome); resourceList.put(DeviceMapTypes.HASS_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.HASS_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.HASS_DEVICE[DeviceMapTypes.typeIndex], aHome);
//setup the command execution Home //setup the command execution Home
aHome = new CommandHome(bridgeSettings); aHome = new CommandHome(bridgeSettings);
homeList.put(DeviceMapTypes.EXEC_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.EXEC_DEVICE_COMPAT[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.CMD_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.CMD_DEVICE[DeviceMapTypes.typeIndex], aHome);
//setup the http handler Home //setup the http handler Home
aHome = new HTTPHome(bridgeSettings); aHome = new HTTPHome(bridgeSettings);
@@ -69,7 +69,6 @@ public class HomeManager {
homeList.put(DeviceMapTypes.CUSTOM_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.CUSTOM_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.VERA_SCENE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.VERA_SCENE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.DEFAULT_DEVICE[DeviceMapTypes.typeIndex], aHome);
//setup the tcp handler Home //setup the tcp handler Home
aHome = new TCPHome(bridgeSettings); aHome = new TCPHome(bridgeSettings);
homeList.put(DeviceMapTypes.TCP_DEVICE[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.TCP_DEVICE[DeviceMapTypes.typeIndex], aHome);
@@ -80,7 +79,8 @@ public class HomeManager {
homeList.put(DeviceMapTypes.UDP_DEVICE_COMPAT[DeviceMapTypes.typeIndex], aHome); homeList.put(DeviceMapTypes.UDP_DEVICE_COMPAT[DeviceMapTypes.typeIndex], aHome);
aHome = new VeraHome(bridgeSettings); aHome = new VeraHome(bridgeSettings);
resourceList.put(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.resourceIndex], aHome); resourceList.put(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex], aHome);
resourceList.put(DeviceMapTypes.VERA_SCENE[DeviceMapTypes.typeIndex], aHome);
} }
public Home findHome(String type) { public Home findHome(String type) {

View File

@@ -157,60 +157,60 @@ public class DeviceResource {
get (API_CONTEXT + "/vera/devices", "application/json", (request, response) -> { get (API_CONTEXT + "/vera/devices", "application/json", (request, response) -> {
log.debug("Get vera devices"); log.debug("Get vera devices");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/vera/scenes", "application/json", (request, response) -> { get (API_CONTEXT + "/vera/scenes", "application/json", (request, response) -> {
log.debug("Get vera scenes"); log.debug("Get vera scenes");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.VERA_SCENE[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.VERA_SCENE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/harmony/activities", "application/json", (request, response) -> { get (API_CONTEXT + "/harmony/activities", "application/json", (request, response) -> {
log.debug("Get harmony activities"); log.debug("Get harmony activities");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/harmony/show", "application/json", (request, response) -> { get (API_CONTEXT + "/harmony/show", "application/json", (request, response) -> {
log.debug("Get harmony current activity"); log.debug("Get harmony current activity");
return homeManager.findResource(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.resourceIndex]).getItems("current_activity"); return homeManager.findResource(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.typeIndex]).getItems("current_activity");
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/harmony/devices", "application/json", (request, response) -> { get (API_CONTEXT + "/harmony/devices", "application/json", (request, response) -> {
log.debug("Get harmony devices"); log.debug("Get harmony devices");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.HARMONY_BUTTON[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.HARMONY_BUTTON[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.HARMONY_BUTTON[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.HARMONY_BUTTON[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/nest/items", "application/json", (request, response) -> { get (API_CONTEXT + "/nest/items", "application/json", (request, response) -> {
log.debug("Get nest items"); log.debug("Get nest items");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.NEST_HOMEAWAY[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.NEST_HOMEAWAY[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.NEST_HOMEAWAY[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.NEST_HOMEAWAY[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/hue/devices", "application/json", (request, response) -> { get (API_CONTEXT + "/hue/devices", "application/json", (request, response) -> {
log.debug("Get hue items"); log.debug("Get hue items");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/hal/devices", "application/json", (request, response) -> { get (API_CONTEXT + "/hal/devices", "application/json", (request, response) -> {
log.debug("Get hal items"); log.debug("Get hal items");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.HAL_DEVICE[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.HAL_DEVICE[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.HAL_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.HAL_DEVICE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/mqtt/devices", "application/json", (request, response) -> { get (API_CONTEXT + "/mqtt/devices", "application/json", (request, response) -> {
log.debug("Get MQTT brokers"); log.debug("Get MQTT brokers");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.MQTT_MESSAGE[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.MQTT_MESSAGE[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.MQTT_MESSAGE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.MQTT_MESSAGE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/hass/devices", "application/json", (request, response) -> { get (API_CONTEXT + "/hass/devices", "application/json", (request, response) -> {
log.debug("Get HomeAssistant Clients"); log.debug("Get HomeAssistant Clients");
response.status(HttpStatus.SC_OK); response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.HASS_DEVICE[DeviceMapTypes.resourceIndex]).getItems(DeviceMapTypes.HASS_DEVICE[DeviceMapTypes.typeIndex]); return homeManager.findResource(DeviceMapTypes.HASS_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.HASS_DEVICE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer()); }, new JsonTransformer());
get (API_CONTEXT + "/map/types", "application/json", (request, response) -> { get (API_CONTEXT + "/map/types", "application/json", (request, response) -> {

View File

@@ -52,9 +52,11 @@ public class HueMulator {
private HueHome myHueHome; private HueHome myHueHome;
private BridgeSettingsDescriptor bridgeSettings; private BridgeSettingsDescriptor bridgeSettings;
private Gson aGsonHandler; private Gson aGsonHandler;
private DeviceMapTypes validMapTypes;
public HueMulator(BridgeSettingsDescriptor theBridgeSettings, DeviceRepository aDeviceRepository, HomeManager aHomeManager) { public HueMulator(BridgeSettingsDescriptor theBridgeSettings, DeviceRepository aDeviceRepository, HomeManager aHomeManager) {
repository = aDeviceRepository; repository = aDeviceRepository;
validMapTypes = new DeviceMapTypes();
bridgeSettings = theBridgeSettings; bridgeSettings = theBridgeSettings;
homeManager= aHomeManager; homeManager= aHomeManager;
myHueHome = (HueHome) homeManager.findHome(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex]); myHueHome = (HueHome) homeManager.findHome(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex]);
@@ -780,11 +782,11 @@ public class HueMulator {
else else
aMultiUtil.setSetCount(1); aMultiUtil.setSetCount(1);
// code for backwards compatibility // code for backwards compatibility
if((callItems[i].getType() == null || callItems[i].getType().trim().length() == 0)) { if((callItems[i].getType() == null || callItems[i].getType().trim().isEmpty())) {
if(device.getMapType() != null && device.getMapType().length() > 0) if(validMapTypes.validateType(device.getMapType()))
callItems[i].setType(device.getMapType()); callItems[i].setType(device.getMapType().trim());
else if(device.getDeviceType() != null && device.getDeviceType().length() > 0) else if(validMapTypes.validateType(device.getDeviceType()))
callItems[i].setType(device.getDeviceType()); callItems[i].setType(device.getDeviceType().trim());
else else
callItems[i].setType(DeviceMapTypes.CUSTOM_DEVICE[DeviceMapTypes.typeIndex]); callItems[i].setType(DeviceMapTypes.CUSTOM_DEVICE[DeviceMapTypes.typeIndex]);
} }

View File

@@ -154,7 +154,6 @@ public class NestHome implements com.bwssystems.HABridge.Home {
+ lightId + "state\"}}]"; + lightId + "state\"}}]";
} }
} }
log.info("device handler not implemented");
return responseString; return responseString;
} }
@@ -165,10 +164,9 @@ public class NestHome implements com.bwssystems.HABridge.Home {
nestItems = null; nestItems = null;
validNest = bridgeSettings.isValidNest(); validNest = bridgeSettings.isValidNest();
aGsonHandler = null; aGsonHandler = null;
log.info("Nest Home created." + (validNest ? "" : " No Nest configured."));
if(!validNest) { if(validNest) {
log.debug("not a valid nest");
} else {
aGsonHandler = new GsonBuilder().create(); aGsonHandler = new GsonBuilder().create();
isFarenheit = bridgeSettings.isFarenheit(); isFarenheit = bridgeSettings.isFarenheit();

View File

@@ -79,7 +79,7 @@ public class CommandHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
// noop log.info("Command Home for system program execution created.");
return this; return this;
} }

View File

@@ -21,6 +21,7 @@ import com.bwssystems.HABridge.hue.MultiCommandUtil;
public class HalHome implements Home { public class HalHome implements Home {
private static final Logger log = LoggerFactory.getLogger(HalHome.class); private static final Logger log = LoggerFactory.getLogger(HalHome.class);
private Map<String, HalInfo> hals; private Map<String, HalInfo> hals;
private Boolean validHal;
public HalHome(BridgeSettingsDescriptor bridgeSettings) { public HalHome(BridgeSettingsDescriptor bridgeSettings) {
super(); super();
@@ -29,6 +30,8 @@ public class HalHome implements Home {
@Override @Override
public Object getItems(String type) { public Object getItems(String type) {
if(!validHal)
return null;
log.debug("consolidating devices for hues"); log.debug("consolidating devices for hues");
List<HalDevice> theResponse = null; List<HalDevice> theResponse = null;
Iterator<String> keys = hals.keySet().iterator(); Iterator<String> keys = hals.keySet().iterator();
@@ -92,6 +95,8 @@ public class HalHome implements Home {
} }
private Boolean addHalDevices(List<HalDevice> theDeviceList, List<HalDevice> theSourceList, String theKey) { private Boolean addHalDevices(List<HalDevice> theDeviceList, List<HalDevice> theSourceList, String theKey) {
if(!validHal)
return null;
Iterator<HalDevice> devices = theSourceList.iterator(); Iterator<HalDevice> devices = theSourceList.iterator();
while(devices.hasNext()) { while(devices.hasNext()) {
HalDevice theDevice = devices.next(); HalDevice theDevice = devices.next();
@@ -115,9 +120,11 @@ public class HalHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
hals = new HashMap<String, HalInfo>(); validHal = bridgeSettings.isValidHal();
if(!bridgeSettings.isValidHal()) log.info("HAL Home created." + (validHal ? "" : " No HAL devices configured."));
if(!validHal)
return null; return null;
hals = new HashMap<String, HalInfo>();
Iterator<NamedIP> theList = bridgeSettings.getHaladdress().getDevices().iterator(); Iterator<NamedIP> theList = bridgeSettings.getHaladdress().getDevices().iterator();
while(theList.hasNext()) { while(theList.hasNext()) {
NamedIP aHal = theList.next(); NamedIP aHal = theList.next();

View File

@@ -40,6 +40,8 @@ public class HarmonyHome implements Home {
@Override @Override
public void closeHome() { public void closeHome() {
if(!validHarmony)
return;
if(isDevMode || hubs == null) if(isDevMode || hubs == null)
return; return;
Iterator<String> keys = hubs.keySet().iterator(); Iterator<String> keys = hubs.keySet().iterator();
@@ -52,6 +54,8 @@ public class HarmonyHome implements Home {
} }
public HarmonyHandler getHarmonyHandler(String aName) { public HarmonyHandler getHarmonyHandler(String aName) {
if(!validHarmony)
return null;
HarmonyHandler aHandler = null; HarmonyHandler aHandler = null;
if(aName == null || aName.equals("")) { if(aName == null || aName.equals("")) {
aName = "default"; aName = "default";
@@ -73,6 +77,8 @@ public class HarmonyHome implements Home {
public List<HarmonyActivity> getActivities() { public List<HarmonyActivity> getActivities() {
Iterator<String> keys = hubs.keySet().iterator(); Iterator<String> keys = hubs.keySet().iterator();
ArrayList<HarmonyActivity> activityList = new ArrayList<HarmonyActivity>(); ArrayList<HarmonyActivity> activityList = new ArrayList<HarmonyActivity>();
if(!validHarmony)
return null;
while(keys.hasNext()) { while(keys.hasNext()) {
String key = keys.next(); String key = keys.next();
Iterator<Activity> activities = hubs.get(key).getMyHarmony().getActivities().iterator(); Iterator<Activity> activities = hubs.get(key).getMyHarmony().getActivities().iterator();
@@ -88,6 +94,8 @@ public class HarmonyHome implements Home {
public List<HarmonyActivity> getCurrentActivities() { public List<HarmonyActivity> getCurrentActivities() {
Iterator<String> keys = hubs.keySet().iterator(); Iterator<String> keys = hubs.keySet().iterator();
ArrayList<HarmonyActivity> activityList = new ArrayList<HarmonyActivity>(); ArrayList<HarmonyActivity> activityList = new ArrayList<HarmonyActivity>();
if(!validHarmony)
return null;
while(keys.hasNext()) { while(keys.hasNext()) {
String key = keys.next(); String key = keys.next();
Activity theActivity = hubs.get(key).getMyHarmony().getCurrentActivity(); Activity theActivity = hubs.get(key).getMyHarmony().getCurrentActivity();
@@ -101,6 +109,8 @@ public class HarmonyHome implements Home {
public List<HarmonyDevice> getDevices() { public List<HarmonyDevice> getDevices() {
Iterator<String> keys = hubs.keySet().iterator(); Iterator<String> keys = hubs.keySet().iterator();
ArrayList<HarmonyDevice> deviceList = new ArrayList<HarmonyDevice>(); ArrayList<HarmonyDevice> deviceList = new ArrayList<HarmonyDevice>();
if(!validHarmony)
return null;
while(keys.hasNext()) { while(keys.hasNext()) {
String key = keys.next(); String key = keys.next();
Iterator<Device> devices = hubs.get(key).getMyHarmony().getDevices().iterator(); Iterator<Device> devices = hubs.get(key).getMyHarmony().getDevices().iterator();
@@ -195,9 +205,8 @@ public class HarmonyHome implements Home {
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
isDevMode = Boolean.parseBoolean(System.getProperty("dev.mode", "false")); isDevMode = Boolean.parseBoolean(System.getProperty("dev.mode", "false"));
validHarmony = bridgeSettings.isValidHarmony(); validHarmony = bridgeSettings.isValidHarmony();
if(!validHarmony && !isDevMode) { log.info("Harmony Home created." + (validHarmony ? "" : " No Harmony devices configured.") + (isDevMode ? " DevMode is set." : ""));
log.debug("No valid Harmony config"); if(validHarmony || isDevMode) {
} else {
hubs = new HashMap<String, HarmonyServer>(); hubs = new HashMap<String, HarmonyServer>();
aGsonHandler = aGsonHandler =
new GsonBuilder() new GsonBuilder()

View File

@@ -37,9 +37,8 @@ public class HassHome implements Home {
hassMap = null; hassMap = null;
aGsonHandler = null; aGsonHandler = null;
validHass = bridgeSettings.isValidHass(); validHass = bridgeSettings.isValidHass();
if(!validHass){ log.info("HomeAssistant Home created." + (validHass ? "" : " No HomeAssistants configured."));
log.debug("not a valid hass"); if(validHass) {
} else {
hassMap = new HashMap<String,HomeAssistant>(); hassMap = new HashMap<String,HomeAssistant>();
aGsonHandler = aGsonHandler =
new GsonBuilder() new GsonBuilder()
@@ -95,6 +94,8 @@ public class HassHome implements Home {
} }
private Boolean addHassDevices(List<HassDevice> theDeviceList, List<State> theSourceList, String theKey) { private Boolean addHassDevices(List<HassDevice> theDeviceList, List<State> theSourceList, String theKey) {
if(!validHass)
return null;
Iterator<State> devices = theSourceList.iterator(); Iterator<State> devices = theSourceList.iterator();
while(devices.hasNext()) { while(devices.hasNext()) {
State theDevice = devices.next(); State theDevice = devices.next();
@@ -155,6 +156,8 @@ public class HassHome implements Home {
@Override @Override
public void closeHome() { public void closeHome() {
if(!validHass)
return;
Iterator<String> keys = hassMap.keySet().iterator(); Iterator<String> keys = hassMap.keySet().iterator();
while(keys.hasNext()) { while(keys.hasNext()) {
String key = keys.next(); String key = keys.next();

View File

@@ -80,6 +80,7 @@ public class HTTPHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
anHttpHandler = new HTTPHandler(); anHttpHandler = new HTTPHandler();
log.info("Http Home created.");
return this; return this;
} }

View File

@@ -35,6 +35,8 @@ public class HueHome implements Home {
@Override @Override
public Object getItems(String type) { public Object getItems(String type) {
log.debug("consolidating devices for hues"); log.debug("consolidating devices for hues");
if(!validHue)
return null;
Iterator<String> keys = hues.keySet().iterator(); Iterator<String> keys = hues.keySet().iterator();
ArrayList<HueDevice> deviceList = new ArrayList<HueDevice>(); ArrayList<HueDevice> deviceList = new ArrayList<HueDevice>();
while(keys.hasNext()) { while(keys.hasNext()) {
@@ -66,6 +68,8 @@ public class HueHome implements Home {
} }
public DeviceResponse getHueDeviceInfo(HueDeviceIdentifier deviceId, DeviceDescriptor device) { public DeviceResponse getHueDeviceInfo(HueDeviceIdentifier deviceId, DeviceDescriptor device) {
if(!validHue)
return null;
DeviceResponse deviceResponse = null; DeviceResponse deviceResponse = null;
HueInfo aHueInfo = hues.get(device.getTargetDevice()); HueInfo aHueInfo = hues.get(device.getTargetDevice());
deviceResponse = aHueInfo.getHueDeviceInfo(deviceId.getDeviceId(), device); deviceResponse = aHueInfo.getHueDeviceInfo(deviceId.getDeviceId(), device);
@@ -75,6 +79,8 @@ public class HueHome implements Home {
@Override @Override
public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int iterationCount, public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int iterationCount,
DeviceState state, StateChangeBody theStateChanges, boolean stateHasBri, boolean stateHasBriInc, DeviceDescriptor device, String body) { DeviceState state, StateChangeBody theStateChanges, boolean stateHasBri, boolean stateHasBriInc, DeviceDescriptor device, String body) {
if(!validHue)
return null;
String responseString = null; String responseString = null;
HueDeviceIdentifier deviceId = aGsonHandler.fromJson(anItem.getItem(), HueDeviceIdentifier.class); HueDeviceIdentifier deviceId = aGsonHandler.fromJson(anItem.getItem(), HueDeviceIdentifier.class);
if(deviceId.getHueName() == null || deviceId.getHueName().isEmpty()) if(deviceId.getHueName() == null || deviceId.getHueName().isEmpty())
@@ -106,9 +112,8 @@ public class HueHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
validHue = bridgeSettings.isValidHue(); validHue = bridgeSettings.isValidHue();
if(!validHue) { log.info("Hue passthru Home created." + (validHue ? "" : " No Hue passtrhu systems configured."));
log.debug("No Hue Configuration"); if(validHue) {
} else {
hues = new HashMap<String, HueInfo>(); hues = new HashMap<String, HueInfo>();
Iterator<NamedIP> theList = bridgeSettings.getHueaddress().getDevices().iterator(); Iterator<NamedIP> theList = bridgeSettings.getHueaddress().getDevices().iterator();
while(theList.hasNext()) { while(theList.hasNext()) {
@@ -122,6 +127,8 @@ public class HueHome implements Home {
@Override @Override
public void closeHome() { public void closeHome() {
if(!validHue)
return;
Iterator<String> keys = hues.keySet().iterator(); Iterator<String> keys = hues.keySet().iterator();
while(keys.hasNext()) { while(keys.hasNext()) {
String key = keys.next(); String key = keys.next();

View File

@@ -36,6 +36,7 @@ public class HueInfo {
} }
public HueApiResponse getHueApiResponse() { public HueApiResponse getHueApiResponse() {
log.debug("Get hue info to hue " + hueAddress.getName());
HueApiResponse theHueApiResponse = null; HueApiResponse theHueApiResponse = null;
if(hueAddress.getUsername() == null) { if(hueAddress.getUsername() == null) {
@@ -103,7 +104,7 @@ public class HueInfo {
HttpClient anHttpClient = httpClient.getHttpClient(); HttpClient anHttpClient = httpClient.getHttpClient();
try { try {
response = anHttpClient.execute(postRequest); response = anHttpClient.execute(postRequest);
log.debug("POST execute on URL responded: " + response.getStatusLine().getStatusCode()); log.debug("registerWithHue - POST execute on " + hueAddress.getName() + "URL responded: " + response.getStatusLine().getStatusCode());
if(response.getStatusLine().getStatusCode() >= 200 && response.getStatusLine().getStatusCode() < 300){ if(response.getStatusLine().getStatusCode() >= 200 && response.getStatusLine().getStatusCode() < 300){
String theBody = EntityUtils.toString(response.getEntity()); String theBody = EntityUtils.toString(response.getEntity());
log.debug("registerWithHue response data: " + theBody); log.debug("registerWithHue response data: " + theBody);
@@ -127,6 +128,7 @@ public class HueInfo {
} }
public DeviceResponse getHueDeviceInfo(String hueDeviceId, DeviceDescriptor device) { public DeviceResponse getHueDeviceInfo(String hueDeviceId, DeviceDescriptor device) {
log.debug("Get hue device info to "+ hueAddress.getName() + " passthru id " + hueDeviceId);
String responseString = null; String responseString = null;
DeviceResponse deviceResponse = null; DeviceResponse deviceResponse = null;
if(hueAddress.getUsername() == null) if(hueAddress.getUsername() == null)
@@ -157,6 +159,7 @@ public class HueInfo {
} }
public String changeState(HueDeviceIdentifier deviceId, String lightId, String body) { public String changeState(HueDeviceIdentifier deviceId, String lightId, String body) {
log.debug("Changing state for ha-bridge id " + lightId + " to " + deviceId.getHueName() + " passthru id " + deviceId.getDeviceId() + " with state " + body );
String responseString = null; String responseString = null;
if(hueAddress.getUsername() == null) if(hueAddress.getUsername() == null)
registerWithHue(); registerWithHue();

View File

@@ -117,9 +117,8 @@ public class MQTTHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
validMqtt = bridgeSettings.isValidMQTT(); validMqtt = bridgeSettings.isValidMQTT();
if(!validMqtt) { log.info("MQTT Home created." + (validMqtt ? "" : " No MQTT Clients configured."));
log.debug("No MQTT configuration"); if(validMqtt) {
} else {
aGsonHandler = aGsonHandler =
new GsonBuilder() new GsonBuilder()
.create(); .create();

View File

@@ -88,8 +88,8 @@ public class TCPHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
// noop log.info("TCP Home created.");
return null; return this;
} }
@Override @Override

View File

@@ -87,8 +87,8 @@ public class UDPHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
// TODO Auto-generated method stub log.info("UDP Home created.");
return null; return this;
} }
@Override @Override

View File

@@ -94,9 +94,8 @@ public class VeraHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
validVera = bridgeSettings.isValidVera(); validVera = bridgeSettings.isValidVera();
if(!validVera) { log.info("Vera Home created." + (validVera ? "" : " No Veras configured."));
log.debug("No valid veras"); if(validVera) {
} else {
veras = new HashMap<String, VeraInfo>(); veras = new HashMap<String, VeraInfo>();
Iterator<NamedIP> theList = bridgeSettings.getVeraAddress().getDevices().iterator(); Iterator<NamedIP> theList = bridgeSettings.getVeraAddress().getDevices().iterator();
while(theList.hasNext()) { while(theList.hasNext()) {

View File

@@ -52,6 +52,7 @@ app.config(function ($routeProvider) {
app.run( function (bridgeService) { app.run( function (bridgeService) {
bridgeService.loadBridgeSettings(); bridgeService.loadBridgeSettings();
bridgeService.getHABridgeVersion(); bridgeService.getHABridgeVersion();
bridgeService.viewMapTypes();
}); });
String.prototype.replaceAll = function(search, replace) String.prototype.replaceAll = function(search, replace)
@@ -68,7 +69,7 @@ String.prototype.replaceAll = function(search, replace)
app.service('bridgeService', function ($http, $window, ngToast) { app.service('bridgeService', function ($http, $window, ngToast) {
var self = this; var self = this;
this.state = {base: window.location.origin + "/api/devices", bridgelocation: window.location.origin, systemsbase: window.location.origin + "/system", huebase: window.location.origin + "/api", configs: [], backups: [], devices: [], device: [], mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], olddevicename: "", logShowAll: false, isInControl: false, showVera: false, showHarmony: false, showNest: false, showHue: false, showHal: false, showMqtt: false, showHass: false, habridgeversion: ""}; this.state = {base: window.location.origin + "/api/devices", bridgelocation: window.location.origin, systemsbase: window.location.origin + "/system", huebase: window.location.origin + "/api", configs: [], backups: [], devices: [], device: [], mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], mapTypes: [], olddevicename: "", logShowAll: false, isInControl: false, showVera: false, showHarmony: false, showNest: false, showHue: false, showHal: false, showMqtt: false, showHass: false, habridgeversion: ""};
this.displayWarn = function(errorTitle, error) { this.displayWarn = function(errorTitle, error) {
var toastContent = errorTitle; var toastContent = errorTitle;
@@ -384,6 +385,28 @@ app.service('bridgeService', function ($http, $window, ngToast) {
); );
}; };
this.viewMapTypes = function () {
return $http.get(this.state.base + "/map/types").then(
function (response) {
self.state.mapTypes = response.data;
},
function (error) {
self.displayWarn("Get mapTypes Error: ", error);
}
);
};
this.getMapType = function(aMapType) {
var i, s, len = self.state.mapTypes.length;
for (i=0; i<len; ++i) {
if (i in self.state.mapTypes) {
s = self.state.mapTypes[i];
if(aMapType == s[0])
return self.state.mapTypes[i];
}
}
return null;
}
this.updateLogLevels = function(logComponents) { this.updateLogLevels = function(logComponents) {
return $http.put(this.state.systemsbase + "/logmgmt/update", logComponents ).then( return $http.put(this.state.systemsbase + "/logmgmt/update", logComponents ).then(
function (response) { function (response) {
@@ -732,6 +755,7 @@ app.service('bridgeService', function ($http, $window, ngToast) {
app.controller('SystemController', function ($scope, $location, $http, $window, bridgeService) { app.controller('SystemController', function ($scope, $location, $http, $window, bridgeService) {
bridgeService.viewConfigs(); bridgeService.viewConfigs();
bridgeService.loadBridgeSettings();
$scope.bridge = bridgeService.state; $scope.bridge = bridgeService.state;
$scope.optionalbackupname = ""; $scope.optionalbackupname = "";
$scope.bridge.isInControl = false; $scope.bridge.isInControl = false;
@@ -2002,8 +2026,10 @@ app.controller('HassController', function ($scope, $location, $http, bridgeServi
}); });
app.controller('EditController', function ($scope, $location, $http, bridgeService) { app.controller('EditController', function ($scope, $location, $http, bridgeService) {
bridgeService.viewMapTypes();
$scope.bridge = bridgeService.state; $scope.bridge = bridgeService.state;
$scope.device = $scope.bridge.device; $scope.device = $scope.bridge.device;
$scope.mapTypeSelected = bridgeService.getMapType($scope.device.mapType);
$scope.device_dim_control = ""; $scope.device_dim_control = "";
$scope.bulk = { devices: [] }; $scope.bulk = { devices: [] };
$scope.imgButtonsUrl = "glyphicon glyphicon-plus"; $scope.imgButtonsUrl = "glyphicon glyphicon-plus";
@@ -2016,7 +2042,7 @@ app.controller('EditController', function ($scope, $location, $http, bridgeServi
$scope.addDevice = function () { $scope.addDevice = function () {
if($scope.device.name == "" && $scope.device.onUrl == "") if($scope.device.name == "" && $scope.device.onUrl == "")
return; return;
bridgeService.buildUrls($scope.device.onUrl, $scope.device.dimUrl, $scope.device.offUrl, true, null, null, $scope.device.deviceType, null, null, null); $scope.device.mapType = $scope.mapTypeSelected[0];
bridgeService.addDevice($scope.device).then( bridgeService.addDevice($scope.device).then(
function () { function () {
$scope.clearDevice(); $scope.clearDevice();

View File

@@ -36,8 +36,7 @@
</div> </div>
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-group"> <div class="form-group">
<label class="col-xs-12 col-sm-2 control-label" for="device-name">Name <label class="col-xs-12 col-sm-2 control-label" for="device-name">Name</label>
</label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<input type="text" class="form-control" id="device-name" <input type="text" class="form-control" id="device-name"
@@ -47,20 +46,17 @@
ng-click="addDevice()">Update Bridge Device</button> ng-click="addDevice()">Update Bridge Device</button>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-xs-12 col-sm-2 control-label" for="device-target">Target <label class="col-xs-12 col-sm-2 control-label" for="device-target">Target</label>
</label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<input type="text" class="form-control" id="device-target" <input type="text" class="form-control" id="device-target"
ng-model="device.targetDevice" placeholder="default"> ng-model="device.targetDevice" placeholder="default">
</div> </div>
<button class="btn btn-primary" ng-click="copyDevice()">Add <button class="btn btn-primary" ng-click="copyDevice()">Add Bridge Device</button>
Bridge Device</button>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<label class="col-xs-12 col-sm-2 control-label" for="device-type">Device <label class="col-xs-12 col-sm-2 control-label" for="device-type">Device Type</label>
Type </label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<select name="device-type" id="device-type" <select name="device-type" id="device-type"
@@ -89,24 +85,9 @@
for="device-map-type">Map Type</label> for="device-map-type">Map Type</label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<select name="device-map-type" id="device-map-type" <select ng-options="mapType as mapType[1] for mapType in bridge.mapTypes track by mapType[0]" ng-model="mapTypeSelected"></select>
ng-model="device.mapType">
<option value="">---Please select---</option>
<!-- not selected / blank option -->
<option value="veraDevice">Vera Device</option>
<option value="veraScene">Vera Scene</option>
<option value="harmonyActivity">Harmony Activity</option>
<option value="harmonyButton">Harmony Button</option>
<option value="nestHomeAway">Nest Home Status</option>
<option value="nestThermoSet">Nest Thermostat</option>
<option value="hueDevice">Hue Device</option>
<option value="halDevice">HAL Device</option>
<option value="halHome">HAL Home Status</option>
<option value="halThermoSet">HAL Thermostat</option>
</select>
</div> </div>
<button class="btn btn-danger" ng-click="clearDevice()"> <button class="btn btn-danger" ng-click="clearDevice()">Clear Device</button>
Clear Device</button>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -118,8 +99,7 @@
</div> </div>
</div> </div>
<div ng-if="device.mapType" class="form-group"> <div ng-if="device.mapType" class="form-group">
<label class="col-xs-12 col-sm-2 control-label" for="device-map-id">Map <label class="col-xs-12 col-sm-2 control-label" for="device-map-id">Map ID</label>
ID </label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<input type="text" class="form-control" id="device-map-id" <input type="text" class="form-control" id="device-map-id"
@@ -128,8 +108,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<label class="col-xs-12 col-sm-2 control-label" for="device-on-url">On <label class="col-xs-12 col-sm-2 control-label" for="device-on-url">On URL</label>
URL </label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<textarea rows="3" class="form-control" id="device-on-url" <textarea rows="3" class="form-control" id="device-on-url"
@@ -139,8 +118,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<label class="col-xs-12 col-sm-2 control-label" for="device-dim-url">Dim <label class="col-xs-12 col-sm-2 control-label" for="device-dim-url">Dim URL</label>
URL </label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<textarea rows="3" class="form-control" id="device-dim-url" <textarea rows="3" class="form-control" id="device-dim-url"
@@ -150,8 +128,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<label class="col-xs-12 col-sm-2 control-label" for="device-off-url">Off <label class="col-xs-12 col-sm-2 control-label" for="device-off-url">Off URL</label>
URL </label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<textarea rows="3" class="form-control" id="device-off-url" <textarea rows="3" class="form-control" id="device-off-url"
@@ -161,8 +138,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<label class="col-xs-12 col-sm-2 control-label" for="device-headers">HTTP <label class="col-xs-12 col-sm-2 control-label" for="device-headers">HTTP Headers</label>
Headers </label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<textarea rows="3" class="form-control" id="device-headers" <textarea rows="3" class="form-control" id="device-headers"

View File

@@ -53,8 +53,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<label class="col-xs-12 col-sm-2 control-label" for="device-type">Device <label class="col-xs-12 col-sm-2 control-label" for="device-type">Device Type</label>
Type </label>
<div class="col-xs-8 col-sm-7"> <div class="col-xs-8 col-sm-7">
<select name="device-type" id="device-type" <select name="device-type" id="device-type"
@@ -65,10 +64,28 @@
<option value="UDP">UDP</option> <option value="UDP">UDP</option>
<option value="TCP">TCP</option> <option value="TCP">TCP</option>
<option value="exec">Execute Script/Program</option> <option value="exec">Execute Script/Program</option>
<option value="switch">Switch</option>
<option value="scene">Scene</option>
<option value="macro">Macro</option>
<option value="group">Group</option>
<option value="activity">Activity</option>
<option value="button">Button</option>
<option value="thermo">Thermo</option>
<option value="passthru">Pass Thru</option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group">
<div class="row">
<label class="col-xs-12 col-sm-2 control-label" for="device-map-type">Device Map
Type </label>
<div class="col-xs-8 col-sm-7">
<select ng-options="mapType as mapType[1] for mapType in bridge.mapTypes track by mapType[0]" ng-model="mapTypeSelected"></select>
</div>
</div>
</div>
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<label class="col-xs-12 col-sm-2 control-label" for="device-on-url">On <label class="col-xs-12 col-sm-2 control-label" for="device-on-url">On