mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 16:17:30 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2565183ee9 | ||
|
|
a6bb1ae3aa | ||
|
|
4bc91be88b | ||
|
|
315fd31270 |
14
README.md
14
README.md
@@ -14,8 +14,8 @@ java -jar -Dupnp.config.address=A.B.C.D -Dvera.address=E.F.G.H -Dharmony.addres
|
||||
## Available Arguments
|
||||
### -Dupnp.config.address=`<ip address>`
|
||||
The server defaults to the first available address on the host if this is not given. This default may NOT be the correct IP that is your public IP for your host on the network. It is best to set this parameter to not have discovery issues. Replace the -Dupnp.config.address=`<ip address>` value with the server ipv4 address you would like to use as the address that any upnp device will call after discovery.
|
||||
### -Dvera.address=`<ip address>`
|
||||
The argument for the vera address should be given as it the system does not have a way to find the address. Supply -Dvera.address=X.Y.Z.A on the command line to provide it. If a vera is not used, do not set it.
|
||||
### -Dvera.address=`<ip address>` | `<{devices:[{name:avera,ip:x.y.w.z},{name:anothervera,ip:a.b.c.d}]}>`
|
||||
The argument for the vera address should be given as it the system does not have a way to find the address. Supply -Dvera.address=X.Y.Z.A on the command line to provide it. If a vera is not used, do not set it. To provide multiple veras, use the json style notation outlined above to provide the list. This argument is backwards compatible.
|
||||
### -Dserver.port=`<port>`
|
||||
The server defaults to running on port 8080. If you're already running a server (like openHAB) on 8080, -Dserver.port=`<port>` on the command line.
|
||||
### -Dupnp.device.db=`<filepath>`
|
||||
@@ -306,7 +306,9 @@ comment | string | Comment configured with device. Not always present.
|
||||
"status":"0",
|
||||
"level":"0",
|
||||
"state":"-1",
|
||||
"comment":""
|
||||
"comment":"",
|
||||
"veraname":"default",
|
||||
"veraddress":"192.168.1.2"
|
||||
},
|
||||
{
|
||||
"name":"Couch Right Lamp",
|
||||
@@ -320,6 +322,8 @@ comment | string | Comment configured with device. Not always present.
|
||||
"level":"0",
|
||||
"state":"-1",
|
||||
"comment":""
|
||||
"veraname":"default",
|
||||
"veraddress":"192.168.1.2"
|
||||
}]
|
||||
```
|
||||
### Get Vera Scenes
|
||||
@@ -340,12 +344,16 @@ room | string | Room name assigned to scene.
|
||||
"name":"AccentLightsOff",
|
||||
"id":"27",
|
||||
"room":"no room"
|
||||
"veraname":"default",
|
||||
"veraddress":"192.168.1.2"
|
||||
},
|
||||
{
|
||||
"active":"0",
|
||||
"name":"AccentLightsOn",
|
||||
"id":"26",
|
||||
"room":"no room"
|
||||
"veraname":"default",
|
||||
"veraddress":"192.168.1.2"
|
||||
}]
|
||||
```
|
||||
### Get Harmony Activities
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.bwssystems.HABridge</groupId>
|
||||
<artifactId>ha-bridge</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>1.3.5</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
|
||||
@@ -7,7 +7,7 @@ public class BridgeSettings {
|
||||
private String serverport;
|
||||
private String upnpresponseport;
|
||||
private String upnpdevicedb;
|
||||
private String veraaddress;
|
||||
private IpList veraaddress;
|
||||
private IpList harmonyaddress;
|
||||
private String harmonyuser;
|
||||
private String harmonypwd;
|
||||
@@ -43,10 +43,10 @@ public class BridgeSettings {
|
||||
public void setUpnpDeviceDb(String upnpDeviceDb) {
|
||||
this.upnpdevicedb = upnpDeviceDb;
|
||||
}
|
||||
public String getVeraAddress() {
|
||||
public IpList getVeraAddress() {
|
||||
return veraaddress;
|
||||
}
|
||||
public void setVeraAddress(String veraAddress) {
|
||||
public void setVeraAddress(IpList veraAddress) {
|
||||
this.veraaddress = veraAddress;
|
||||
}
|
||||
public IpList getHarmonyAddress() {
|
||||
@@ -110,7 +110,8 @@ public class BridgeSettings {
|
||||
this.nestconfigured = isNestConfigured;
|
||||
}
|
||||
public Boolean isValidVera() {
|
||||
if(this.veraaddress.contains(Configuration.DEFAULT_ADDRESS))
|
||||
List<NamedIP> devicesList = this.veraaddress.getDevices();
|
||||
if(devicesList.get(0).getIp().contains(Configuration.DEFAULT_ADDRESS))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,19 @@ public class HABridge {
|
||||
|
||||
bridgeSettings.setUpnpDeviceDb(System.getProperty("upnp.device.db", Configuration.DEVICE_DB_DIRECTORY));
|
||||
bridgeSettings.setUpnpResponsePort(System.getProperty("upnp.response.port", Configuration.UPNP_RESPONSE_PORT));
|
||||
bridgeSettings.setVeraAddress(System.getProperty("vera.address", Configuration.DEFAULT_ADDRESS));
|
||||
IpList theVeraList;
|
||||
|
||||
try {
|
||||
theVeraList = new Gson().fromJson(System.getProperty("vera.address", Configuration.DEFAULT_HARMONY_ADDRESS_LIST), IpList.class);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
theVeraList = new Gson().fromJson("{devices:[{name:default,ip:" + System.getProperty("vera.address", Configuration.DEFAULT_ADDRESS) + "}]}", IpList.class);
|
||||
} catch (Exception et) {
|
||||
log.error("Cannot parse vera.address, Exiting with message: " + e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
bridgeSettings.setVeraAddress(theVeraList);
|
||||
IpList theHarmonyList;
|
||||
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.bwssystems.HABridge.dao;
|
||||
|
||||
public class BackupFilename {
|
||||
private String filename;
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,17 @@ package com.bwssystems.HABridge.dao;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@@ -33,8 +38,16 @@ public class DeviceRepository {
|
||||
|
||||
public DeviceRepository(String deviceDb) {
|
||||
super();
|
||||
repositoryPath = Paths.get(deviceDb);
|
||||
String jsonContent = repositoryReader(repositoryPath);
|
||||
_loadRepository(deviceDb);
|
||||
}
|
||||
|
||||
private void _loadRepository(String aFilePath){
|
||||
repositoryPath = Paths.get(aFilePath);
|
||||
_loadRepository(repositoryPath);
|
||||
}
|
||||
|
||||
private void _loadRepository(Path aPath){
|
||||
String jsonContent = repositoryReader(aPath);
|
||||
devices = new HashMap<String, DeviceDescriptor>();
|
||||
|
||||
if(jsonContent != null)
|
||||
@@ -47,7 +60,8 @@ public class DeviceRepository {
|
||||
put(theDevice.getId(), theDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<DeviceDescriptor> findAll() {
|
||||
List<DeviceDescriptor> list = new ArrayList<DeviceDescriptor>(devices.values());
|
||||
@@ -79,6 +93,66 @@ public class DeviceRepository {
|
||||
log.debug("Save device: " + aDescriptor.getName());
|
||||
}
|
||||
|
||||
public String backup(String aFilename) {
|
||||
if(aFilename == null || aFilename.equalsIgnoreCase("")) {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
|
||||
aFilename = "devicedb-" + dateFormat.format(Calendar.getInstance().getTime()) + ".bk";
|
||||
}
|
||||
else
|
||||
aFilename = aFilename + ".bk";
|
||||
try {
|
||||
Files.copy(repositoryPath, FileSystems.getDefault().getPath(repositoryPath.getParent().toString(), aFilename), StandardCopyOption.COPY_ATTRIBUTES);
|
||||
} catch (IOException e) {
|
||||
log.error("Could not backup to file: " + aFilename + " message: " + e.getMessage(), e);
|
||||
}
|
||||
log.debug("Backup repository: " + aFilename);
|
||||
return aFilename;
|
||||
}
|
||||
|
||||
public String deleteBackup(String aFilename) {
|
||||
log.debug("Delete backup repository: " + aFilename);
|
||||
try {
|
||||
Files.delete(FileSystems.getDefault().getPath(repositoryPath.getParent().toString(), aFilename));
|
||||
} catch (IOException e) {
|
||||
log.error("Could not delete file: " + aFilename + " message: " + e.getMessage(), e);
|
||||
}
|
||||
return aFilename;
|
||||
}
|
||||
|
||||
public String restoreBackup(String aFilename) {
|
||||
log.debug("Restore backup repository: " + aFilename);
|
||||
try {
|
||||
Path target = null;
|
||||
if(Files.exists(repositoryPath)) {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
|
||||
target = FileSystems.getDefault().getPath(repositoryPath.getParent().toString(), "devicedb-" + dateFormat.format(Calendar.getInstance().getTime()) + ".bk");
|
||||
Files.move(repositoryPath, target);
|
||||
}
|
||||
Files.copy(FileSystems.getDefault().getPath(repositoryPath.getParent().toString(), aFilename), repositoryPath, StandardCopyOption.COPY_ATTRIBUTES);
|
||||
} catch (IOException e) {
|
||||
log.error("Error restoring the file: " + aFilename + " message: " + e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
_loadRepository(repositoryPath);
|
||||
return aFilename;
|
||||
}
|
||||
|
||||
public List<String> getBackups() {
|
||||
List<String> theFilenames = new ArrayList<String>();
|
||||
Path dir = repositoryPath.getParent();
|
||||
try (DirectoryStream<Path> stream =
|
||||
Files.newDirectoryStream(dir, "*.{bk}")) {
|
||||
for (Path entry: stream) {
|
||||
theFilenames.add(entry.getFileName().toString());
|
||||
}
|
||||
} catch (IOException x) {
|
||||
// IOException can never be thrown by the iteration.
|
||||
// In this snippet, it can // only be thrown by newDirectoryStream.
|
||||
log.error("Issue getting direcotyr listing for backups - " + x.getMessage());
|
||||
}
|
||||
return theFilenames;
|
||||
}
|
||||
|
||||
public String delete(DeviceDescriptor aDescriptor) {
|
||||
if (aDescriptor != null) {
|
||||
devices.remove(aDescriptor.getId());
|
||||
|
||||
@@ -18,11 +18,13 @@ import org.slf4j.LoggerFactory;
|
||||
import com.bwssystems.HABridge.BridgeSettings;
|
||||
import com.bwssystems.HABridge.JsonTransformer;
|
||||
import com.bwssystems.HABridge.Version;
|
||||
import com.bwssystems.HABridge.dao.BackupFilename;
|
||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||
import com.bwssystems.HABridge.dao.DeviceRepository;
|
||||
import com.bwssystems.NestBridge.NestHome;
|
||||
import com.bwssystems.harmony.HarmonyHome;
|
||||
import com.bwssystems.luupRequests.Sdata;
|
||||
import com.bwssystems.vera.VeraHome;
|
||||
import com.bwssystems.vera.VeraInfo;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@@ -34,7 +36,7 @@ public class DeviceResource {
|
||||
private static final Logger log = LoggerFactory.getLogger(DeviceResource.class);
|
||||
|
||||
private DeviceRepository deviceRepository;
|
||||
private VeraInfo veraInfo;
|
||||
private VeraHome veraHome;
|
||||
private Version version;
|
||||
private HarmonyHome myHarmonyHome;
|
||||
private NestHome nestHome;
|
||||
@@ -42,7 +44,12 @@ public class DeviceResource {
|
||||
|
||||
public DeviceResource(BridgeSettings theSettings, Version theVersion, HarmonyHome theHarmonyHome, NestHome aNestHome) {
|
||||
this.deviceRepository = new DeviceRepository(theSettings.getUpnpDeviceDb());
|
||||
this.veraInfo = new VeraInfo(theSettings.getVeraAddress(), theSettings.isValidVera());
|
||||
|
||||
if(theSettings.isValidVera())
|
||||
this.veraHome = new VeraHome(theSettings);
|
||||
else
|
||||
this.veraHome = null;
|
||||
|
||||
if(theSettings.isValidHarmony())
|
||||
this.myHarmonyHome = theHarmonyHome;
|
||||
else
|
||||
@@ -52,6 +59,7 @@ public class DeviceResource {
|
||||
this.nestHome = aNestHome;
|
||||
else
|
||||
this.nestHome = null;
|
||||
|
||||
this.version = theVersion;
|
||||
setupEndpoints();
|
||||
}
|
||||
@@ -174,25 +182,23 @@ public class DeviceResource {
|
||||
|
||||
get (API_CONTEXT + "/vera/devices", "application/json", (request, response) -> {
|
||||
log.debug("Get vera devices");
|
||||
Sdata sData = veraInfo.getSdata();
|
||||
if(sData == null){
|
||||
if(veraHome == null){
|
||||
response.status(HttpStatus.SC_NOT_FOUND);
|
||||
return null;
|
||||
}
|
||||
|
||||
response.status(HttpStatus.SC_OK);
|
||||
return sData.getDevices();
|
||||
return veraHome.getDevices();
|
||||
}, new JsonTransformer());
|
||||
|
||||
get (API_CONTEXT + "/vera/scenes", "application/json", (request, response) -> {
|
||||
log.debug("Get vera scenes");
|
||||
Sdata sData = veraInfo.getSdata();
|
||||
if(sData == null){
|
||||
if(veraHome == null){
|
||||
response.status(HttpStatus.SC_NOT_FOUND);
|
||||
return null;
|
||||
}
|
||||
response.status(HttpStatus.SC_OK);
|
||||
return sData.getScenes();
|
||||
return veraHome.getScenes();
|
||||
}, new JsonTransformer());
|
||||
|
||||
get (API_CONTEXT + "/harmony/activities", "application/json", (request, response) -> {
|
||||
@@ -234,5 +240,66 @@ public class DeviceResource {
|
||||
response.status(HttpStatus.SC_OK);
|
||||
return nestHome.getItems();
|
||||
}, new JsonTransformer());
|
||||
|
||||
get (API_CONTEXT + "/backup/available", "application/json", (request, response) -> {
|
||||
log.debug("Get backup filenames");
|
||||
response.status(HttpStatus.SC_OK);
|
||||
return deviceRepository.getBackups();
|
||||
}, new JsonTransformer());
|
||||
|
||||
// http://ip_address:port/api/devices/backup/create CORS request
|
||||
options(API_CONTEXT + "/backup/create", "application/json", (request, response) -> {
|
||||
response.status(HttpStatus.SC_OK);
|
||||
response.header("Access-Control-Allow-Origin", request.headers("Origin"));
|
||||
response.header("Access-Control-Allow-Methods", "PUT");
|
||||
response.header("Access-Control-Allow-Headers", request.headers("Access-Control-Request-Headers"));
|
||||
response.header("Content-Type", "text/html; charset=utf-8");
|
||||
return "";
|
||||
});
|
||||
put (API_CONTEXT + "/backup/create", "application/json", (request, response) -> {
|
||||
log.debug("Create backup: " + request.body());
|
||||
BackupFilename aFilename = new Gson().fromJson(request.body(), BackupFilename.class);
|
||||
BackupFilename returnFilename = new BackupFilename();
|
||||
returnFilename.setFilename(deviceRepository.backup(aFilename.getFilename()));
|
||||
return returnFilename;
|
||||
}, new JsonTransformer());
|
||||
|
||||
// http://ip_address:port/api/devices/backup/delete CORS request
|
||||
options(API_CONTEXT + "/backup/delete", "application/json", (request, response) -> {
|
||||
response.status(HttpStatus.SC_OK);
|
||||
response.header("Access-Control-Allow-Origin", request.headers("Origin"));
|
||||
response.header("Access-Control-Allow-Methods", "POST");
|
||||
response.header("Access-Control-Allow-Headers", request.headers("Access-Control-Request-Headers"));
|
||||
response.header("Content-Type", "text/html; charset=utf-8");
|
||||
return "";
|
||||
});
|
||||
post (API_CONTEXT + "/backup/delete", "application/json", (request, response) -> {
|
||||
log.debug("Delete backup: " + request.body());
|
||||
BackupFilename aFilename = new Gson().fromJson(request.body(), BackupFilename.class);
|
||||
if(aFilename != null)
|
||||
deviceRepository.deleteBackup(aFilename.getFilename());
|
||||
else
|
||||
log.warn("No filename given for delete backup.");
|
||||
return null;
|
||||
}, new JsonTransformer());
|
||||
|
||||
// http://ip_address:port/api/devices/backup/restore CORS request
|
||||
options(API_CONTEXT + "/backup/restore", "application/json", (request, response) -> {
|
||||
response.status(HttpStatus.SC_OK);
|
||||
response.header("Access-Control-Allow-Origin", request.headers("Origin"));
|
||||
response.header("Access-Control-Allow-Methods", "POST");
|
||||
response.header("Access-Control-Allow-Headers", request.headers("Access-Control-Request-Headers"));
|
||||
response.header("Content-Type", "text/html; charset=utf-8");
|
||||
return "";
|
||||
});
|
||||
post (API_CONTEXT + "/backup/restore", "application/json", (request, response) -> {
|
||||
log.debug("Restore backup: " + request.body());
|
||||
BackupFilename aFilename = new Gson().fromJson(request.body(), BackupFilename.class);
|
||||
if(aFilename != null)
|
||||
deviceRepository.restoreBackup(aFilename.getFilename());
|
||||
else
|
||||
log.warn("No filename given for restore backup.");
|
||||
return null;
|
||||
}, new JsonTransformer());
|
||||
}
|
||||
}
|
||||
@@ -334,16 +334,25 @@ public class HueMulator {
|
||||
}
|
||||
else if(device.getDeviceType().toLowerCase().contains("button") || (device.getMapType() != null && device.getMapType().equalsIgnoreCase("harmonyButton")))
|
||||
{
|
||||
log.debug("executing HUE api request to button press to Harmony: " + url);
|
||||
ButtonPress aDeviceButton = new Gson().fromJson(url, ButtonPress.class);
|
||||
log.debug("executing HUE api request to button press(es) to Harmony: " + url);
|
||||
if(url.substring(0, 1).equalsIgnoreCase("{")) {
|
||||
url = "[" + url +"]";
|
||||
}
|
||||
ButtonPress[] deviceButtons = new Gson().fromJson(url, ButtonPress[].class);
|
||||
HarmonyHandler myHarmony = myHarmonyHome.getHarmonyHandler(device.getTargetDevice());
|
||||
if(myHarmony == null)
|
||||
{
|
||||
log.warn("Should not get here, no harmony hub available");
|
||||
responseString = "[{\"error\":{\"type\": 6, \"address\": \"/lights/" + lightId + ",\"description\": \"Should not get here, no harmony hub available\", \"parameter\": \"/lights/" + lightId + "state\"}}]";
|
||||
}
|
||||
else
|
||||
myHarmony.pressButton(aDeviceButton);
|
||||
else {
|
||||
for(int i = 0; i < deviceButtons.length; i++) {
|
||||
if( i > 0)
|
||||
Thread.sleep(100);
|
||||
log.debug("pressing button: " + deviceButtons[i].getDevice() + " - " + deviceButtons[i].getButton() + " - iteration: " + String.valueOf(i));
|
||||
myHarmony.pressButton(deviceButtons[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(device.getDeviceType().toLowerCase().contains("home") || (device.getMapType() != null && device.getMapType().equalsIgnoreCase("nestHomeAway")))
|
||||
{
|
||||
|
||||
@@ -13,6 +13,8 @@ public class Device {
|
||||
private String level;
|
||||
private String state;
|
||||
private String comment;
|
||||
private String veraname;
|
||||
private String veraaddress;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -79,5 +81,17 @@ public class Device {
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
public String getVeraname() {
|
||||
return veraname;
|
||||
}
|
||||
public void setVeraname(String veraname) {
|
||||
this.veraname = veraname;
|
||||
}
|
||||
public String getVeraaddress() {
|
||||
return veraaddress;
|
||||
}
|
||||
public void setVeraaddress(String veraaddress) {
|
||||
this.veraaddress = veraaddress;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ public class Scene {
|
||||
private String name;
|
||||
private String id;
|
||||
private String room;
|
||||
private String veraname;
|
||||
private String veraaddress;
|
||||
public String getActive() {
|
||||
return active;
|
||||
}
|
||||
@@ -29,5 +31,17 @@ public class Scene {
|
||||
public void setRoom(String room) {
|
||||
this.room = room;
|
||||
}
|
||||
public String getVeraname() {
|
||||
return veraname;
|
||||
}
|
||||
public void setVeraname(String veraname) {
|
||||
this.veraname = veraname;
|
||||
}
|
||||
public String getVeraaddress() {
|
||||
return veraaddress;
|
||||
}
|
||||
public void setVeraaddress(String veraaddress) {
|
||||
this.veraaddress = veraaddress;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
58
src/main/java/com/bwssystems/vera/VeraHome.java
Normal file
58
src/main/java/com/bwssystems/vera/VeraHome.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.bwssystems.vera;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.bwssystems.HABridge.BridgeSettings;
|
||||
import com.bwssystems.HABridge.NamedIP;
|
||||
import com.bwssystems.luupRequests.Device;
|
||||
import com.bwssystems.luupRequests.Scene;
|
||||
|
||||
public class VeraHome {
|
||||
private static final Logger log = LoggerFactory.getLogger(VeraHome.class);
|
||||
private Map<String, VeraInfo> veras;
|
||||
|
||||
public VeraHome(BridgeSettings bridgeSettings) {
|
||||
veras = new HashMap<String, VeraInfo>();
|
||||
if(!bridgeSettings.isValidVera())
|
||||
return;
|
||||
Iterator<NamedIP> theList = bridgeSettings.getVeraAddress().getDevices().iterator();
|
||||
while(theList.hasNext()) {
|
||||
NamedIP aVera = theList.next();
|
||||
veras.put(aVera.getName(), new VeraInfo(aVera, bridgeSettings.isValidVera()));
|
||||
}
|
||||
}
|
||||
|
||||
public List<Device> getDevices() {
|
||||
log.debug("consolidating devices for veras");
|
||||
Iterator<String> keys = veras.keySet().iterator();
|
||||
ArrayList<Device> deviceList = new ArrayList<Device>();
|
||||
while(keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
Iterator<Device> devices = veras.get(key).getSdata().getDevices().iterator();
|
||||
while(devices.hasNext()) {
|
||||
deviceList.add(devices.next());
|
||||
}
|
||||
}
|
||||
return deviceList;
|
||||
}
|
||||
public List<Scene> getScenes() {
|
||||
log.debug("consolidating scenes for veras");
|
||||
Iterator<String> keys = veras.keySet().iterator();
|
||||
ArrayList<Scene> sceneList = new ArrayList<Scene>();
|
||||
while(keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
Iterator<Scene> scenes = veras.get(key).getSdata().getScenes().iterator();
|
||||
while(scenes.hasNext()) {
|
||||
sceneList.add(scenes.next());
|
||||
}
|
||||
}
|
||||
return sceneList;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.bwssystems.HABridge.NamedIP;
|
||||
import com.bwssystems.luupRequests.Categorie;
|
||||
import com.bwssystems.luupRequests.Device;
|
||||
import com.bwssystems.luupRequests.Room;
|
||||
@@ -25,13 +26,13 @@ public class VeraInfo {
|
||||
private static final Logger log = LoggerFactory.getLogger(VeraInfo.class);
|
||||
private HttpClient httpClient;
|
||||
private static final String SDATA_REQUEST = ":3480/data_request?id=sdata&output_format=json";
|
||||
private String veraAddressString;
|
||||
private NamedIP veraAddress;
|
||||
private Boolean validVera;
|
||||
|
||||
public VeraInfo(String addressString, Boolean isValidVera) {
|
||||
public VeraInfo(NamedIP addressName, Boolean isValidVera) {
|
||||
super();
|
||||
httpClient = HttpClients.createDefault();
|
||||
veraAddressString = addressString;
|
||||
veraAddress = addressName;
|
||||
validVera = isValidVera;
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ public class VeraInfo {
|
||||
if(!validVera)
|
||||
return new Sdata();
|
||||
|
||||
String theUrl = "http://" + veraAddressString + SDATA_REQUEST;
|
||||
String theUrl = "http://" + veraAddress.getIp() + SDATA_REQUEST;
|
||||
String theData;
|
||||
|
||||
theData = doHttpGETRequest(theUrl);
|
||||
@@ -71,6 +72,8 @@ public class VeraInfo {
|
||||
theDevice.setCategory(categoryMap.get(theDevice.getCategory()).getName());
|
||||
else
|
||||
theDevice.setCategory("<unknown>");
|
||||
theDevice.setVeraaddress(veraAddress.getIp());
|
||||
theDevice.setVeraname(veraAddress.getName());
|
||||
}
|
||||
|
||||
ListIterator<Scene> theSecneIter = theSdata.getScenes().listIterator();
|
||||
@@ -81,6 +84,8 @@ public class VeraInfo {
|
||||
theScene.setRoom(roomMap.get(theScene.getRoom()).getName());
|
||||
else
|
||||
theScene.setRoom("no room");
|
||||
theScene.setVeraaddress(veraAddress.getIp());
|
||||
theScene.setVeraname(veraAddress.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
var app = angular.module('habridge', [
|
||||
'ngRoute'
|
||||
]);
|
||||
var app = angular.module('habridge', ['ngRoute']);
|
||||
|
||||
app.config(function ($routeProvider) {
|
||||
$routeProvider.when('/#', {
|
||||
@@ -35,69 +33,12 @@ app.config(function ($routeProvider) {
|
||||
|
||||
app.run( function (bridgeService) {
|
||||
bridgeService.loadBridgeSettings();
|
||||
bridgeService.updateShowVera();
|
||||
bridgeService.updateShowHarmony();
|
||||
bridgeService.updateShowNest();
|
||||
bridgeService.getHABridgeVersion();
|
||||
});
|
||||
|
||||
app.factory('BridgeSettings', function() {
|
||||
var BridgeSettings = {};
|
||||
|
||||
BridgeSettings.upnpconfigaddress = "";
|
||||
BridgeSettings.serverport = "";
|
||||
BridgeSettings.upnpdevicedb = "";
|
||||
BridgeSettings.upnpresponseport = "";
|
||||
BridgeSettings.veraaddress = "";
|
||||
BridgeSettings.harmonyaddress = "";
|
||||
BridgeSettings.upnpstrict = "";
|
||||
BridgeSettings.traceupnp = "";
|
||||
BridgeSettings.devmode = "";
|
||||
BridgeSettings.nestconfigured = "";
|
||||
|
||||
BridgeSettings.setupnpconfigaddress = function(aconfigaddress){
|
||||
BridgeSettings.upnpconfigaddress = aconfigaddress;
|
||||
};
|
||||
|
||||
BridgeSettings.setserverport = function(aserverport){
|
||||
BridgeSettings.serverport = aserverport;
|
||||
};
|
||||
|
||||
BridgeSettings.setupnpdevicedb = function(aupnpdevicedb){
|
||||
BridgeSettings.upnpdevicedb = aupnpdevicedb;
|
||||
};
|
||||
|
||||
BridgeSettings.setupnpresponseport = function(aupnpresponseport){
|
||||
BridgeSettings.upnpresponseport = aupnpresponseport;
|
||||
};
|
||||
|
||||
BridgeSettings.setveraaddress = function(averaaddress){
|
||||
BridgeSettings.veraaddress = averaaddress;
|
||||
};
|
||||
BridgeSettings.setharmonyaddress = function(aharmonyaddress){
|
||||
BridgeSettings.harmonyaddress = aharmonyaddress;
|
||||
};
|
||||
BridgeSettings.setupnpstrict = function(aupnpstrict){
|
||||
BridgeSettings.upnpstrict = aupnpstrict;
|
||||
};
|
||||
BridgeSettings.settraceupnp = function(atraceupnp){
|
||||
BridgeSettings.traceupnp = atraceupnp;
|
||||
};
|
||||
BridgeSettings.setdevmode = function(adevmode){
|
||||
BridgeSettings.devmode = adevmode;
|
||||
};
|
||||
|
||||
BridgeSettings.setnestconfigured = function(anestconfigured){
|
||||
BridgeSettings.nestconfigured = anestconfigured;
|
||||
};
|
||||
|
||||
return BridgeSettings;
|
||||
});
|
||||
|
||||
app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
app.service('bridgeService', function ($http, $window) {
|
||||
var self = this;
|
||||
self.BridgeSettings = BridgeSettings;
|
||||
this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", huebase: window.location.origin + "/api", devices: [], device: [], error: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""};
|
||||
this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", huebase: window.location.origin + "/api", backups: [], devices: [], device: [], settings: [], error: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""};
|
||||
|
||||
this.viewDevices = function () {
|
||||
this.state.error = "";
|
||||
@@ -138,7 +79,7 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
}
|
||||
|
||||
this.updateShowVera = function () {
|
||||
if(this.aContainsB(self.BridgeSettings.veraaddress, "1.1.1.1") || self.BridgeSettings.veraaddress == "" || self.BridgeSettings.veraaddress == null)
|
||||
if(this.aContainsB(self.state.settings.veraaddress.devices[0].ip, "1.1.1.1") || self.state.settings.veraaddress == "" || self.state.settings.veraaddress == null)
|
||||
this.state.showVera = false;
|
||||
else
|
||||
this.state.showVera = true;
|
||||
@@ -146,7 +87,7 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
}
|
||||
|
||||
this.updateShowNest = function () {
|
||||
if(self.BridgeSettings.nestconfigured == true)
|
||||
if(self.state.settings.nestconfigured == true)
|
||||
this.state.showNest = true;
|
||||
else
|
||||
this.state.showNest = false;
|
||||
@@ -154,8 +95,8 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
}
|
||||
|
||||
this.updateShowHarmony = function () {
|
||||
if(self.BridgeSettings.harmonyaddress.devices) {
|
||||
if(this.aContainsB(self.BridgeSettings.harmonyaddress.devices[0].ip, "1.1.1.1") || self.BridgeSettings.harmonyaddress == "" || self.BridgeSettings.harmonyaddress == null)
|
||||
if(self.state.settings.harmonyaddress.devices) {
|
||||
if(this.aContainsB(self.state.settings.harmonyaddress.devices[0].ip, "1.1.1.1") || self.state.settings.harmonyaddress == "" || self.state.settings.harmonyaddress == null)
|
||||
this.state.showHarmony = false;
|
||||
else
|
||||
this.state.showHarmony = true;
|
||||
@@ -170,16 +111,10 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
this.state.error = "";
|
||||
return $http.get(this.state.upnpbase).then(
|
||||
function (response) {
|
||||
self.BridgeSettings.setupnpconfigaddress(response.data.upnpconfigaddress);
|
||||
self.BridgeSettings.setserverport(response.data.serverport);
|
||||
self.BridgeSettings.setupnpdevicedb(response.data.upnpdevicedb);
|
||||
self.BridgeSettings.setupnpresponseport(response.data.upnpresponseport);
|
||||
self.BridgeSettings.setveraaddress(response.data.veraaddress);
|
||||
self.BridgeSettings.setharmonyaddress(response.data.harmonyaddress);
|
||||
self.BridgeSettings.settraceupnp(response.data.traceupnp);
|
||||
self.BridgeSettings.setupnpstrict(response.data.upnpstrict);
|
||||
self.BridgeSettings.setdevmode(response.data.devmode);
|
||||
self.BridgeSettings.setnestconfigured(response.data.nestconfigured);
|
||||
self.state.settings = response.data;
|
||||
self.updateShowVera();
|
||||
self.updateShowHarmony();
|
||||
self.updateShowNest();
|
||||
},
|
||||
function (error) {
|
||||
if (error.data) {
|
||||
@@ -192,11 +127,26 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
);
|
||||
};
|
||||
|
||||
this.viewBackups = function () {
|
||||
this.state.error = "";
|
||||
return $http.get(this.state.base + "/backup/available").then(
|
||||
function (response) {
|
||||
self.state.backups = response.data;
|
||||
},
|
||||
function (error) {
|
||||
if (error.data) {
|
||||
$window.alert("Get Backups Error: " + error.data.message);
|
||||
} else {
|
||||
$window.alert("Get Backups Error: unknown");
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.viewNestItems = function () {
|
||||
this.state.error = "";
|
||||
if(!this.state.showNest)
|
||||
return;
|
||||
this.state.error = "";
|
||||
return $http.get(this.state.base + "/nest/items").then(
|
||||
function (response) {
|
||||
self.state.nestitems = response.data;
|
||||
@@ -215,7 +165,6 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
this.state.error = "";
|
||||
if(!this.state.showVera)
|
||||
return;
|
||||
this.state.error = "";
|
||||
return $http.get(this.state.base + "/vera/devices").then(
|
||||
function (response) {
|
||||
self.state.veradevices = response.data;
|
||||
@@ -304,6 +253,8 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
this.state.error = "";
|
||||
if(device.httpVerb != null && device.httpVerb != "")
|
||||
device.deviceType = "custom";
|
||||
if(device.targetDevice == null || device.targetDevice == "")
|
||||
device.targetDevice = "Encapsulated";
|
||||
if (device.id) {
|
||||
var putUrl = this.state.base + "/" + device.id;
|
||||
return $http.put(putUrl, {
|
||||
@@ -333,8 +284,6 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
} else {
|
||||
if(device.deviceType == null || device.deviceType == "")
|
||||
device.deviceType = "custom";
|
||||
if(device.httpVerb != null && device.httpVerb != "")
|
||||
device.deviceType = "custom";
|
||||
return $http.post(this.state.base, {
|
||||
name: device.name,
|
||||
mapId: device.mapId,
|
||||
@@ -361,6 +310,58 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
}
|
||||
};
|
||||
|
||||
this.backupDeviceDb = function (afilename) {
|
||||
this.state.error = "";
|
||||
return $http.put(this.state.base + "/backup/create", {
|
||||
filename: afilename
|
||||
}).then(
|
||||
function (response) {
|
||||
self.viewBackups();
|
||||
},
|
||||
function (error) {
|
||||
if (error.data) {
|
||||
self.state.error = error.data.message;
|
||||
}
|
||||
$window.alert("Backup Device Db Error: unknown");
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.restoreBackup = function (afilename) {
|
||||
this.state.error = "";
|
||||
return $http.post(this.state.base + "/backup/restore", {
|
||||
filename: afilename
|
||||
}).then(
|
||||
function (response) {
|
||||
self.viewBackups();
|
||||
self.viewDevices();
|
||||
},
|
||||
function (error) {
|
||||
if (error.data) {
|
||||
self.state.error = error.data.message;
|
||||
}
|
||||
$window.alert("Backup Db Restore Error: unknown");
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.deleteBackup = function (afilename) {
|
||||
this.state.error = "";
|
||||
return $http.post(this.state.base + "/backup/delete", {
|
||||
filename: afilename
|
||||
}).then(
|
||||
function (response) {
|
||||
self.viewBackups();
|
||||
},
|
||||
function (error) {
|
||||
if (error.data) {
|
||||
self.state.error = error.data.message;
|
||||
}
|
||||
$window.alert("Backup Db Frlryr Error: unknown");
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.deleteDevice = function (id) {
|
||||
this.state.error = "";
|
||||
return $http.delete(this.state.base + "/" + id).then(
|
||||
@@ -413,16 +414,16 @@ app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||
};
|
||||
});
|
||||
|
||||
app.controller('ViewingController', function ($scope, $location, $http, $window, bridgeService, BridgeSettings) {
|
||||
app.controller('ViewingController', function ($scope, $location, $http, $window, bridgeService) {
|
||||
|
||||
$scope.BridgeSettings = bridgeService.BridgeSettings;
|
||||
bridgeService.viewDevices();
|
||||
bridgeService.viewBackups();
|
||||
$scope.bridge = bridgeService.state;
|
||||
bridgeService.updateShowVera();
|
||||
bridgeService.updateShowHarmony();
|
||||
bridgeService.updateShowNest();
|
||||
$scope.optionalbackupname = "";
|
||||
$scope.visible = false;
|
||||
$scope.imgUrl = "glyphicon glyphicon-plus";
|
||||
$scope.visibleBk = false;
|
||||
$scope.imgBkUrl = "glyphicon glyphicon-plus";
|
||||
$scope.predicate = '';
|
||||
$scope.reverse = true;
|
||||
$scope.order = function(predicate) {
|
||||
@@ -446,6 +447,15 @@ app.controller('ViewingController', function ($scope, $location, $http, $window,
|
||||
bridgeService.editDevice(device);
|
||||
$location.path('/editdevice');
|
||||
};
|
||||
$scope.backupDeviceDb = function (optionalbackupname) {
|
||||
bridgeService.backupDeviceDb(optionalbackupname);
|
||||
};
|
||||
$scope.restoreBackup = function (backupname) {
|
||||
bridgeService.restoreBackup(backupname);
|
||||
};
|
||||
$scope.deleteBackup = function (backupname) {
|
||||
bridgeService.deleteBackup(backupname);
|
||||
};
|
||||
$scope.toggle = function () {
|
||||
$scope.visible = !$scope.visible;
|
||||
if($scope.visible)
|
||||
@@ -453,45 +463,57 @@ app.controller('ViewingController', function ($scope, $location, $http, $window,
|
||||
else
|
||||
$scope.imgUrl = "glyphicon glyphicon-plus";
|
||||
};
|
||||
$scope.toggleBk = function () {
|
||||
$scope.visibleBk = !$scope.visibleBk;
|
||||
if($scope.visibleBk)
|
||||
$scope.imgBkUrl = "glyphicon glyphicon-minus";
|
||||
else
|
||||
$scope.imgBkUrl = "glyphicon glyphicon-plus";
|
||||
};
|
||||
});
|
||||
|
||||
app.controller('AddingController', function ($scope, $location, $http, bridgeService, BridgeSettings) {
|
||||
|
||||
$scope.device = {id: "", name: "", deviceType: "custom", onUrl: "", offUrl: ""};
|
||||
$scope.vera = {base: "", port: "3480", id: ""};
|
||||
$scope.vera.base = "http://" + BridgeSettings.veraaddress;
|
||||
bridgeService.device = $scope.device;
|
||||
app.controller('AddingController', function ($scope, $location, $http, bridgeService) {
|
||||
$scope.bridge = bridgeService.state;
|
||||
$scope.device = $scope.bridge.device;
|
||||
$scope.device_dim_control = "";
|
||||
$scope.bulk = { devices: [] };
|
||||
$scope.vera = {base: "http://" + $scope.bridge.settings.veraaddress, port: "3480", id: ""};
|
||||
bridgeService.viewVeraDevices();
|
||||
bridgeService.viewVeraScenes();
|
||||
bridgeService.viewHarmonyActivities();
|
||||
bridgeService.viewHarmonyDevices();
|
||||
bridgeService.viewNestItems();
|
||||
$scope.bridge = bridgeService.state;
|
||||
bridgeService.updateShowVera();
|
||||
bridgeService.updateShowHarmony();
|
||||
bridgeService.updateShowNest();
|
||||
$scope.device = bridgeService.state.device;
|
||||
$scope.activitiesVisible = false;
|
||||
$scope.imgButtonsUrl = "glyphicon glyphicon-plus";
|
||||
$scope.buttonsVisible = false;
|
||||
$scope.imgActivitiesUrl = "glyphicon glyphicon-plus";
|
||||
$scope.devicesVisible = false;
|
||||
$scope.imgDevicesUrl = "glyphicon glyphicon-plus";
|
||||
$scope.scenesVisible = false;
|
||||
$scope.imgScenesUrl = "glyphicon glyphicon-plus";
|
||||
|
||||
$scope.predicate = '';
|
||||
$scope.reverse = true;
|
||||
$scope.device_dim_control = "";
|
||||
$scope.order = function(predicate) {
|
||||
$scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
|
||||
$scope.predicate = predicate;
|
||||
};
|
||||
|
||||
$scope.buildUrlsUsingDevice = function (dim_control) {
|
||||
$scope.clearDevice = function () {
|
||||
$scope.device.id = "";
|
||||
$scope.device.mapType = null;
|
||||
$scope.device.mapId = null;
|
||||
$scope.device.name = "";
|
||||
$scope.device.onUrl = "";
|
||||
$scope.device.deviceType = "custom";
|
||||
$scope.device.targetDevice = null;
|
||||
$scope.device.offUrl = "";
|
||||
$scope.device.httpVerb = null;
|
||||
$scope.device.contentType = null;
|
||||
$scope.device.contentBody = null;
|
||||
$scope.device.contentBodyOff = null;
|
||||
};
|
||||
|
||||
$scope.buildUrlsUsingDevice = function (dim_control) {
|
||||
if ($scope.vera.base.indexOf("http") < 0) {
|
||||
$scope.vera.base = "http://" + $scope.vera.base;
|
||||
}
|
||||
$scope.device.deviceType = "switch";
|
||||
$scope.device.targetDevice = $scope.bridge.settings.veraaddress;
|
||||
$scope.device.mapType = "veraDevice";
|
||||
$scope.device.mapId = $scope.vera.id;
|
||||
if(dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)
|
||||
@@ -514,6 +536,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
$scope.vera.base = "http://" + $scope.vera.base;
|
||||
}
|
||||
$scope.device.deviceType = "scene";
|
||||
$scope.device.targetDevice = $scope.bridge.settings.veraaddress;
|
||||
$scope.device.mapType = "veraScene";
|
||||
$scope.device.mapId = $scope.vera.id;
|
||||
$scope.device.onUrl = $scope.vera.base + ":" + $scope.vera.port
|
||||
@@ -530,6 +553,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
}
|
||||
$scope.device.deviceType = "switch";
|
||||
$scope.device.name = veradevice.name;
|
||||
$scope.device.targetDevice = veradevice.veraname;
|
||||
$scope.device.mapType = "veraDevice";
|
||||
$scope.device.mapId = veradevice.id;
|
||||
if(dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)
|
||||
@@ -553,6 +577,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
}
|
||||
$scope.device.deviceType = "scene";
|
||||
$scope.device.name = verascene.name;
|
||||
$scope.device.targetDevice = verascene.veraname;
|
||||
$scope.device.mapType = "veraScene";
|
||||
$scope.device.mapId = verascene.id;
|
||||
$scope.device.onUrl = $scope.vera.base + ":" + $scope.vera.port
|
||||
@@ -574,18 +599,27 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
};
|
||||
|
||||
$scope.buildButtonUrls = function (harmonydevice, onbutton, offbutton) {
|
||||
$scope.device.deviceType = "button";
|
||||
$scope.device.targetDevice = harmonydevice.hub;
|
||||
$scope.device.name = harmonydevice.device.label;
|
||||
$scope.device.mapType = "harmonyButton";
|
||||
$scope.device.mapId = harmonydevice.device.id + "-" + onbutton + "-" + offbutton;
|
||||
$scope.device.onUrl = "{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + onbutton + "\"}";
|
||||
$scope.device.offUrl = "{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + offbutton + "\"}";
|
||||
var currentOn = $scope.device.onUrl;
|
||||
var currentOff = $scope.device.offUrl;
|
||||
if( $scope.device.mapType == "harmonyButton") {
|
||||
$scope.device.onUrl = currentOn.substr(0, currentOn.indexOf("]")) + ",{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + onbutton + "\"}]";
|
||||
$scope.device.offUrl = currentOff.substr(0, currentOff.indexOf("]")) + ",{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + offbutton + "\"}]";
|
||||
}
|
||||
else if ($scope.device.mapType == null || $scope.device.mapType == "") {
|
||||
$scope.device.deviceType = "button";
|
||||
$scope.device.targetDevice = harmonydevice.hub;
|
||||
$scope.device.name = harmonydevice.device.label;
|
||||
$scope.device.mapType = "harmonyButton";
|
||||
$scope.device.mapId = harmonydevice.device.id + "-" + onbutton + "-" + offbutton;
|
||||
$scope.device.onUrl = "[{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + onbutton + "\"}]";
|
||||
$scope.device.offUrl = "[{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + offbutton + "\"}]";
|
||||
}
|
||||
};
|
||||
|
||||
$scope.buildNestHomeUrls = function (nestitem) {
|
||||
$scope.device.deviceType = "home";
|
||||
$scope.device.name = nestitem.name;
|
||||
$scope.device.targetDevice = nestitem.name;
|
||||
$scope.device.mapType = "nestHomeAway";
|
||||
$scope.device.mapId = nestitem.id;
|
||||
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"away\":false,\"control\":\"status\"}";
|
||||
@@ -595,6 +629,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
$scope.buildNestTempUrls = function (nestitem) {
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Temperature";
|
||||
$scope.device.targetDevice = nestitem.location;
|
||||
$scope.device.mapType = "nestThermoSet";
|
||||
$scope.device.mapId = nestitem.id + "-SetTemp";
|
||||
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"temp\",\"temp\":\"${intensity.percent}\"}";
|
||||
@@ -604,6 +639,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
$scope.buildNestHeatUrls = function (nestitem) {
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Heat";
|
||||
$scope.device.targetDevice = nestitem.location;
|
||||
$scope.device.mapType = "nestThermoSet";
|
||||
$scope.device.mapId = nestitem.id + "-SetHeat";
|
||||
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"heat\"}";
|
||||
@@ -613,6 +649,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
$scope.buildNestCoolUrls = function (nestitem) {
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Cool";
|
||||
$scope.device.targetDevice = nestitem.location;
|
||||
$scope.device.mapType = "nestThermoSet";
|
||||
$scope.device.mapId = nestitem.id + "-SetCool";
|
||||
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"cool\"}";
|
||||
@@ -622,6 +659,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
$scope.buildNestRangeUrls = function (nestitem) {
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Range";
|
||||
$scope.device.targetDevice = nestitem.location;
|
||||
$scope.device.mapType = "nestThermoSet";
|
||||
$scope.device.mapId = nestitem.id + "-SetRange";
|
||||
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"range\"}";
|
||||
@@ -631,6 +669,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
$scope.buildNestOffUrls = function (nestitem) {
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Thermostat";
|
||||
$scope.device.targetDevice = nestitem.location;
|
||||
$scope.device.mapType = "nestThermoSet";
|
||||
$scope.device.mapId = nestitem.id + "-TurnOff";
|
||||
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"range\"}";
|
||||
@@ -640,46 +679,56 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
$scope.buildNestFanUrls = function (nestitem) {
|
||||
$scope.device.deviceType = "thermo";
|
||||
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Fan";
|
||||
$scope.device.targetDevice = nestitem.location;
|
||||
$scope.device.mapType = "nestThermoSet";
|
||||
$scope.device.mapId = nestitem.id + "-SetFan";
|
||||
$scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-on\"}";
|
||||
$scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"fan-auto\"}";
|
||||
};
|
||||
|
||||
|
||||
$scope.testUrl = function (device, type) {
|
||||
bridgeService.testUrl(device, type);
|
||||
};
|
||||
|
||||
$scope.addDevice = function () {
|
||||
if($scope.device.name == "" && $scope.device.onUrl == "")
|
||||
return;
|
||||
bridgeService.addDevice($scope.device).then(
|
||||
function () {
|
||||
$scope.device.id = "";
|
||||
$scope.device.mapType = null;
|
||||
$scope.device.mapId = null;
|
||||
$scope.device.name = "";
|
||||
$scope.device.onUrl = "";
|
||||
$scope.device.deviceType = "custom";
|
||||
$scope.device.targetDevice = null;
|
||||
$scope.device.offUrl = "";
|
||||
$scope.device.httpVerb = null;
|
||||
$scope.device.contentType = null;
|
||||
$scope.device.contentBody = null;
|
||||
$scope.device.contentBodyOff = null;
|
||||
$location.path('/#');
|
||||
$scope.clearDevice();
|
||||
},
|
||||
function (error) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$scope.toggleActivities = function () {
|
||||
$scope.activitiesVisible = !$scope.activitiesVisible;
|
||||
if($scope.activitiesVisible)
|
||||
$scope.imgActivitiesUrl = "glyphicon glyphicon-minus";
|
||||
else
|
||||
$scope.imgActivitiesUrl = "glyphicon glyphicon-plus";
|
||||
};
|
||||
|
||||
$scope.bulkAddDevices = function(dim_control) {
|
||||
for(var i = 0; i < $scope.bulk.devices.length; i++) {
|
||||
for(var x = 0; x < bridgeService.state.veradevices.length; x++) {
|
||||
if(bridgeService.state.veradevices[x].id == $scope.bulk.devices[i]) {
|
||||
$scope.buildDeviceUrls(bridgeService.state.veradevices[x],dim_control);
|
||||
$scope.addDevice();
|
||||
}
|
||||
}
|
||||
}
|
||||
$scope.bulk = { devices: [] };
|
||||
};
|
||||
|
||||
$scope.toggleSelection = function toggleSelection(deviceId) {
|
||||
var idx = $scope.bulk.devices.indexOf(deviceId);
|
||||
|
||||
// is currently selected
|
||||
if (idx > -1) {
|
||||
$scope.bulk.devices.splice(idx, 1);
|
||||
}
|
||||
|
||||
// is newly selected
|
||||
else {
|
||||
$scope.bulk.devices.push(deviceId);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleButtons = function () {
|
||||
$scope.buttonsVisible = !$scope.buttonsVisible;
|
||||
if($scope.buttonsVisible)
|
||||
@@ -687,23 +736,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
||||
else
|
||||
$scope.imgButtonsUrl = "glyphicon glyphicon-plus";
|
||||
};
|
||||
|
||||
$scope.toggleDevices = function () {
|
||||
$scope.devicesVisible = !$scope.devicesVisible;
|
||||
if($scope.devicesVisible)
|
||||
$scope.imgDevicesUrl = "glyphicon glyphicon-minus";
|
||||
else
|
||||
$scope.imgDevicesUrl = "glyphicon glyphicon-plus";
|
||||
};
|
||||
|
||||
$scope.toggleScenes = function () {
|
||||
$scope.scenesVisible = !$scope.scenesVisible;
|
||||
if($scope.scenesVisible)
|
||||
$scope.imgScenesUrl = "glyphicon glyphicon-minus";
|
||||
else
|
||||
$scope.imgScenesUrl = "glyphicon glyphicon-plus";
|
||||
};
|
||||
|
||||
|
||||
$scope.deleteDeviceByMapId = function (id, mapType) {
|
||||
bridgeService.deleteDeviceByMapId(id, mapType);
|
||||
};
|
||||
@@ -744,7 +777,7 @@ app.filter('availableVeraDeviceId', function(bridgeService) {
|
||||
if(input == null)
|
||||
return out;
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(!bridgeService.findDeviceByMapId(input[i].id, null, "veraDevice")){
|
||||
if(!bridgeService.findDeviceByMapId(input[i].id, input[i].veraname, "veraDevice")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
@@ -758,7 +791,7 @@ return function(input) {
|
||||
if(input == null)
|
||||
return out;
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(bridgeService.findDeviceByMapId(input[i].id, null, "veraDevice")){
|
||||
if(bridgeService.findDeviceByMapId(input[i].id, input[i].veraname, "veraDevice")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
@@ -772,7 +805,7 @@ app.filter('availableVeraSceneId', function(bridgeService) {
|
||||
if(input == null)
|
||||
return out;
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(!bridgeService.findDeviceByMapId(input[i].id, null, "veraScene")){
|
||||
if(!bridgeService.findDeviceByMapId(input[i].id, input[i].veraname, "veraScene")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
@@ -786,7 +819,7 @@ return function(input) {
|
||||
if(input == null)
|
||||
return out;
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(bridgeService.findDeviceByMapId(input[i].id, null, "veraScene")){
|
||||
if(bridgeService.findDeviceByMapId(input[i].id,input[i].veraname, "veraScene")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Current devices</h2>
|
||||
<h2 class="panel-title">Current devices ({{bridge.devices.length}}) </h2>
|
||||
</div>
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('id')">ID</a>
|
||||
<span class="sortorder" ng-show="predicate === 'id'" ng-class="{reverse:reverse}"></span></th>
|
||||
@@ -45,6 +46,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="device in bridge.devices | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{device.id}}</td>
|
||||
<td>{{device.name}}</td>
|
||||
<td>{{device.deviceType}}</td>
|
||||
@@ -65,7 +67,7 @@
|
||||
|
||||
<div class="panel panel-default bridgeServer">
|
||||
<div class="panel-heading">
|
||||
<h1 class="panel-title">Bridge settings <a ng-click="toggle()"><span class={{imgUrl}} aria-hidden="true"></a></h1>
|
||||
<h1 class="panel-title">Bridge Settings <a ng-click="toggle()"><span class={{imgUrl}} aria-hidden="true"></a></h1>
|
||||
</div>
|
||||
<div ng-if="visible" class="animate-if" class="panel-body">
|
||||
|
||||
@@ -93,44 +95,81 @@
|
||||
</thead>
|
||||
<tr>
|
||||
<td>upnp.config.address</td>
|
||||
<td>{{BridgeSettings.upnpconfigaddress}}</td>
|
||||
<td>{{bridge.settings.upnpconfigaddress}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>server.port</td>
|
||||
<td>{{BridgeSettings.serverport}}</td>
|
||||
<td>{{bridge.settings.serverport}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>upnp.devices.db</td>
|
||||
<td>{{BridgeSettings.upnpdevicedb}}</td>
|
||||
<td>{{bridge.settings.upnpdevicedb}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>upnp.response.port</td>
|
||||
<td>{{BridgeSettings.upnpresponseport}}</td>
|
||||
<td>{{bridge.settings.upnpresponseport}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vera.address</td>
|
||||
<td>{{BridgeSettings.veraaddress}}</td>
|
||||
<td>{{bridge.settings.veraaddress}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>harmony.address</td>
|
||||
<td>{{BridgeSettings.harmonyaddress}}</td>
|
||||
<td>{{bridge.settings.harmonyaddress}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>upnp.strict</td>
|
||||
<td>{{BridgeSettings.upnpstrict}}</td>
|
||||
<td>{{bridge.settings.upnpstrict}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>trace.upnp</td>
|
||||
<td>{{BridgeSettings.traceupnp}}</td>
|
||||
<td>{{bridge.settings.traceupnp}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dev.mode</td>
|
||||
<td>{{BridgeSettings.devmode}}</td>
|
||||
<td>{{bridge.settings.devmode}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>nest.configured</td>
|
||||
<td>{{BridgeSettings.nestconfigured}}</td>
|
||||
<td>{{bridge.settings.nestconfigured}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default backup">
|
||||
<div class="panel-heading">
|
||||
<h1 class="panel-title">Bridge Device DB Backup <a ng-click="toggleBk()"><span class={{imgBkUrl}} aria-hidden="true"></a></h1>
|
||||
</div>
|
||||
<div ng-if="visibleBk" class="animate-if" class="panel-body">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="backup-name">Backup File Name</label>
|
||||
|
||||
<div class="col-xs-8 col-sm-7">
|
||||
<input id="backup-name" class="form-control" type="text"
|
||||
ng-model="optionalbackupname" placeholder="Optional">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"
|
||||
ng-click="backupDeviceDb(optionalbackupname)">Backup Device DB</button>
|
||||
</div>
|
||||
</form>
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="backup in bridge.backups">
|
||||
<td>{{backup}}</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" type="submit"
|
||||
ng-click="restoreBackup(backup)">Restore</button>
|
||||
<button class="btn btn-warning" type="submit"
|
||||
ng-click="deleteBackup(backup)">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
updating these fields as you may break the settings used by the bridge to call a specific end point device.</p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<form class="form-horizontal" ng-submit="addDevice()">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-name">Name
|
||||
</label>
|
||||
@@ -26,7 +26,7 @@
|
||||
<input type="text" class="form-control" id="device-name"
|
||||
ng-model="device.name" placeholder="Device Name">
|
||||
</div>
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary">
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary" ng-click="addDevice()">
|
||||
Update Bridge Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -37,6 +37,8 @@
|
||||
<input type="text" class="form-control" id="device-target"
|
||||
ng-model="device.targetDevice" placeholder="default">
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
the http verb type below and configure a payload for either on or off methods. Currently, https is not supported.</p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<form class="form-horizontal" ng-submit="addDevice()">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-name">Name
|
||||
@@ -88,7 +88,7 @@
|
||||
<input type="text" class="form-control" id="device-name"
|
||||
ng-model="device.name" placeholder="Device Name">
|
||||
</div>
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary">
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary" ng-click="addDevice()">
|
||||
Add Bridge Device</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -101,6 +101,8 @@
|
||||
<textarea rows="3" class="form-control" id="device-on-url"
|
||||
ng-model="device.onUrl" placeholder="URL to turn device on"></textarea>
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('label')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -37,6 +38,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="harmonyactivity in bridge.harmonyactivities | availableHarmonyActivityId | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{harmonyactivity.activity.label}}</td>
|
||||
<td>{{harmonyactivity.activity.id}}</td>
|
||||
<td>{{harmonyactivity.hub}}</td>
|
||||
@@ -50,13 +52,14 @@
|
||||
</li>
|
||||
</ul>
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Already Configured Activities <a ng-click="toggleActivities()"><span class={{imgActivitiesUrl}} aria-hidden="true"></a></h2>
|
||||
<h2 class="panel-title">Already Configured Activities <a ng-click="toggleButtons()"><span class={{imgButtonsUrl}} aria-hidden="true"></span></a></h2>
|
||||
</div>
|
||||
<ul ng-if="activitiesVisible" class="list-group">
|
||||
<ul ng-if="buttonsVisible" class="list-group">
|
||||
<li class="list-group-item">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('label')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -73,6 +76,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="harmonyactivity in bridge.harmonyactivities | unavailableHarmonyActivityId | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{harmonyactivity.activity.label}}</td>
|
||||
<td>{{harmonyactivity.activity.id}}</td>
|
||||
<td>{{harmonyactivity.hub}}</td>
|
||||
@@ -89,7 +93,7 @@
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<form class="form-horizontal" ng-submit="addDevice()">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-name">Name
|
||||
</label>
|
||||
@@ -98,7 +102,7 @@
|
||||
<input type="text" class="form-control" id="device-name"
|
||||
ng-model="device.name" placeholder="Device Name">
|
||||
</div>
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary">
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary" ng-click="addDevice()">
|
||||
Add Bridge Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -110,6 +114,8 @@
|
||||
<textarea rows="3" class="form-control" id="device-on-url"
|
||||
ng-model="device.onUrl" placeholder="URL to turn device on"></textarea>
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -14,13 +14,15 @@
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<p class="text-muted">For any Harmony Device and Buttons, use the action buttons to generate the device addition information below automatically.
|
||||
<p class="text-muted">For any Harmony Device and Buttons, use the build button to generate the configuration for this bridge device. You can add button presses by
|
||||
selecting yoru devic and buttons and then selecting the Build Button. This will allow multiple button presses to be built for a given device.
|
||||
Then you can modify the name to anything you want that will be the keyword for Alexa. Click the 'Add Bridge Device' to finish that selection setup.
|
||||
The 'Already Configured Harmony Buttons' list below will show what is already setup for your Harmony Hubs.</p>
|
||||
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('label')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -39,27 +41,28 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="harmonydevice in bridge.harmonydevices | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{harmonydevice.device.label}}</td>
|
||||
<td>{{harmonydevice.device.id}}</td>
|
||||
<td>{{harmonydevice.hub}}</td>
|
||||
<td>
|
||||
<select name="device-ctrlon" id="device-ctrlon" ng-model="devicectrlon">
|
||||
<optgroup ng-repeat="ctrlon in harmonydevice.device.controlGroup" label="{{ctrlon.name}}">
|
||||
<option ng-repeat="funcon in ctrlon.function">{{funcon.name}}</option>
|
||||
<option ng-repeat="funcon in ctrlon.function" value="{{funcon.label}}">{{funcon.name}}</option>
|
||||
</optgroup >
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select name="device-ctrloff" id="device-ctrloff" ng-model="devicectrloff">
|
||||
<optgroup ng-repeat="ctrloff in harmonydevice.device.controlGroup" label="{{ctrloff.name}}">
|
||||
<option ng-repeat="funcoff in ctrloff.function">{{funcoff.name}}</option>
|
||||
<option ng-repeat="funcoff in ctrloff.function" value="{{funcoff.label}}">{{funcoff.name}}</option>
|
||||
</optgroup >
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-success" type="submit"
|
||||
ng-click="buildButtonUrls(harmonydevice, devicectrlon, devicectrloff)">Generate
|
||||
Button URLs</button>
|
||||
ng-click="buildButtonUrls(harmonydevice, devicectrlon, devicectrloff)">Build
|
||||
A Button</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -73,6 +76,7 @@
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('name')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -93,6 +97,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="device in bridge.devices | configuredButtons | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{device.name}}</td>
|
||||
<td>{{device.id}}</td>
|
||||
<td>{{device.targetDevice}}</td>
|
||||
@@ -112,7 +117,7 @@
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<form class="form-horizontal" ng-submit="addDevice()">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-name">Name
|
||||
</label>
|
||||
@@ -121,7 +126,7 @@
|
||||
<input type="text" class="form-control" id="device-name"
|
||||
ng-model="device.name" placeholder="Device Name">
|
||||
</div>
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary">
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary" ng-click="addDevice()">
|
||||
Add Bridge Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -133,6 +138,8 @@
|
||||
<textarea rows="3" class="form-control" id="device-on-url"
|
||||
ng-model="device.onUrl" placeholder="URL to turn device on"></textarea>
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('name')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -37,6 +38,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="nestitem in bridge.nestitems | availableNestItemId | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{nestitem.name}}</td>
|
||||
<td>{{nestitem.type}}</td>
|
||||
<td>{{nestitem.location}}</td>
|
||||
@@ -71,13 +73,14 @@
|
||||
</li>
|
||||
</ul>
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Already Configured Nest Items <a ng-click="toggleActivities()"><span class={{imgActivitiesUrl}} aria-hidden="true"></a></h2>
|
||||
<h2 class="panel-title">Already Configured Nest Items <a ng-click="toggleButtons()"><span class={{imgButtonsUrl}} aria-hidden="true"></span></a></h2>
|
||||
</div>
|
||||
<ul ng-if="activitiesVisible" class="list-group">
|
||||
<ul ng-if="buttonsVisible" class="list-group">
|
||||
<li class="list-group-item">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('name')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -94,6 +97,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="device in bridge.devices | unavailableNestItemId | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{device.name}}</td>
|
||||
<td>{{device.id}}</td>
|
||||
<td>{{device.mapId}}</td>
|
||||
@@ -110,7 +114,7 @@
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<form class="form-horizontal" ng-submit="addDevice()">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-name">Name
|
||||
</label>
|
||||
@@ -119,7 +123,7 @@
|
||||
<input type="text" class="form-control" id="device-name"
|
||||
ng-model="device.name" placeholder="Device Name">
|
||||
</div>
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary">
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary" ng-click="addDevice()">
|
||||
Add Bridge Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -131,6 +135,8 @@
|
||||
<textarea rows="3" class="form-control" id="device-on-url"
|
||||
ng-model="device.onUrl" placeholder="URL to turn device on"></textarea>
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
|
||||
<div class="panel panel-default bridgeServer" ng-if="!bridge.error">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Vera Device List</h2>
|
||||
<h2 class="panel-title">Vera Device List ({{bridge.veradevices.length}})</h2>
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<p class="text-muted">For any Vera Device, use the action buttons to generate the device addition information below automatically.
|
||||
Then you can modify the name to anything you want that will be the keyword for Alexa. Click the 'Add Bridge Device' to finish that selection setup.
|
||||
The 'Already Configured Vera Devices' list below will show what is already setup for your Vera.</p><p>Also, use this select menu for which type of dim
|
||||
The 'Already Configured Vera Devices' list below will show what is already setup for your Vera.</p>
|
||||
<p>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>
|
||||
@@ -25,9 +26,13 @@
|
||||
<option value="${intensity.math(X*1)}">Custom Math</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>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 Vera.
|
||||
</p>
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('name')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -43,15 +48,21 @@
|
||||
<th>
|
||||
<a href="" ng-click="order('room')">Room</a>
|
||||
<span class="sortorder" ng-show="predicate === 'room'" ng-class="{reverse:reverse}"></span>
|
||||
</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('vera')">Vera</a>
|
||||
<span class="sortorder" ng-show="predicate === 'vera'" ng-class="{reverse:reverse}"></span>
|
||||
</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="veradevice in bridge.veradevices | availableVeraDeviceId | orderBy:predicate:reverse">
|
||||
<td>{{veradevice.name}}</td>
|
||||
<td>{{$index+1}}</td>
|
||||
<td><input type="checkbox" name="bulk.devices[]" value="{{veradevice.id}}" ng-checked="bulk.devices.indexOf(veradevice.id) > -1" ng-click="toggleSelection(veradevice.id)"> {{veradevice.name}}</td>
|
||||
<td>{{veradevice.id}}</td>
|
||||
<td>{{veradevice.category}}</td>
|
||||
<td>{{veradevice.room}}</td>
|
||||
<td>{{veradevice.veraname}}</td>
|
||||
<td>
|
||||
<button class="btn btn-success" type="submit"
|
||||
ng-click="buildDeviceUrls(veradevice, device_dim_control)">Generate
|
||||
@@ -59,16 +70,21 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<button class="btn btn-success" type="submit"
|
||||
ng-click="bulkAddDevices(device_dim_control)">Bulk Add ({{bulk.devices.length}})</button>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Already Configured Vera Devices <a ng-click="toggleDevices()"><span class={{imgDevicesUrl}} aria-hidden="true"></a></h2>
|
||||
<h2 class="panel-title">Already Configured Vera Devices <a ng-click="toggleButtons()"><span class={{imgButtonsUrl}} aria-hidden="true"></span></a></a></h2>
|
||||
</div>
|
||||
<ul ng-if="devicesVisible" class="list-group">
|
||||
<ul ng-if="buttonsVisible" class="list-group">
|
||||
<li class="list-group-item">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('name')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -84,15 +100,21 @@
|
||||
<th>
|
||||
<a href="" ng-click="order('room')">Room</a>
|
||||
<span class="sortorder" ng-show="predicate === 'room'" ng-class="{reverse:reverse}"></span>
|
||||
</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('vera')">Vera</a>
|
||||
<span class="sortorder" ng-show="predicate === 'vera'" ng-class="{reverse:reverse}"></span>
|
||||
</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="veradevice in bridge.veradevices | unavailableVeraDeviceId | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{veradevice.name}}</td>
|
||||
<td>{{veradevice.id}}</td>
|
||||
<td>{{veradevice.category}}</td>
|
||||
<td>{{veradevice.room}}</td>
|
||||
<td>{{veradevice.veraname}}</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" type="submit"
|
||||
ng-click="deleteDeviceByMapId(veradevice.id, 'veraDevice')">Delete</button>
|
||||
@@ -108,7 +130,7 @@
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<form class="form-horizontal" ng-submit="addDevice()">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-name">Name
|
||||
</label>
|
||||
@@ -117,7 +139,7 @@
|
||||
<input type="text" class="form-control" id="device-name"
|
||||
ng-model="device.name" placeholder="Device Name">
|
||||
</div>
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary">
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary" ng-click="addDevice()">
|
||||
Add Bridge Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -129,6 +151,8 @@
|
||||
<textarea rows="3" class="form-control" id="device-on-url"
|
||||
ng-model="device.onUrl" placeholder="URL to turn device on"></textarea>
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('name')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -32,14 +33,20 @@
|
||||
<th>
|
||||
<a href="" ng-click="order('room')">Room</a>
|
||||
<span class="sortorder" ng-show="predicate === 'room'" ng-class="{reverse:reverse}"></span>
|
||||
</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('vera')">Vera</a>
|
||||
<span class="sortorder" ng-show="predicate === 'vera'" ng-class="{reverse:reverse}"></span>
|
||||
</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="verascene in bridge.verascenes | availableVeraSceneId | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{verascene.name}}</td>
|
||||
<td>{{verascene.id}}</td>
|
||||
<td>{{verascene.room}}</td>
|
||||
<td>{{verascene.veraname}}</td>
|
||||
<td>
|
||||
<button class="btn btn-success" type="submit"
|
||||
ng-click="buildSceneUrls(verascene)">Generate
|
||||
@@ -50,13 +57,14 @@
|
||||
</li>
|
||||
</ul>
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Already Configured Vera Scenes <a ng-click="toggleScenes()"><span class={{imgScenesUrl}} aria-hidden="true"></a></h2>
|
||||
<h2 class="panel-title">Already Configured Vera Scenes <a ng-click="toggleButtons()"><span class={{imgButtonsUrl}} aria-hidden="true"></span></a></h2>
|
||||
</div>
|
||||
<ul ng-if="scenesVisible" class="list-group">
|
||||
<ul ng-if="buttonsVisible" class="list-group">
|
||||
<li class="list-group-item">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('name')">Name</a>
|
||||
<span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
|
||||
@@ -68,14 +76,20 @@
|
||||
<th>
|
||||
<a href="" ng-click="order('room')">Room</a>
|
||||
<span class="sortorder" ng-show="predicate === 'room'" ng-class="{reverse:reverse}"></span>
|
||||
</th>
|
||||
<th>
|
||||
<a href="" ng-click="order('vera')">Vera</a>
|
||||
<span class="sortorder" ng-show="predicate === 'vera'" ng-class="{reverse:reverse}"></span>
|
||||
</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr ng-repeat="verascene in bridge.verascenes | unavailableVeraSceneId | orderBy:predicate:reverse">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{verascene.name}}</td>
|
||||
<td>{{verascene.id}}</td>
|
||||
<td>{{verascene.room}}</td>
|
||||
<td>{{verascene.veraname}}</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" type="submit"
|
||||
ng-click="deleteDeviceByMapId(verascene.id, 'veraScene')">Delete</button>
|
||||
@@ -91,7 +105,7 @@
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<form class="form-horizontal" ng-submit="addDevice()">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-name">Name
|
||||
</label>
|
||||
@@ -100,7 +114,7 @@
|
||||
<input type="text" class="form-control" id="device-name"
|
||||
ng-model="device.name" placeholder="Device Name">
|
||||
</div>
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary">
|
||||
<button type="submit" class="col-xs-4 col-sm-2 btn btn-primary" ng-click="addDevice()">
|
||||
Add Bridge Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -112,6 +126,8 @@
|
||||
<textarea rows="3" class="form-control" id="device-on-url"
|
||||
ng-model="device.onUrl" placeholder="URL to turn device on"></textarea>
|
||||
</div>
|
||||
<button class="btn btn-danger" ng-click="clearDevice()">
|
||||
Clear Device</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user