diff --git a/pom.xml b/pom.xml
index bc1c75a5..85fe04d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,11 +5,11 @@
com.bwssystems.HABridge
ha-bridge
- 1.3.0
+ 1.3.1
jar
HA Bridge
- Emulates a Philips Hue bridge to allow the Amazon Echo to hook up to other HA systems, i.e. Vera or Harmony Hub, using lightweight frameworks
+ Emulates a Philips Hue bridge to allow the Amazon Echo to hook up to other HA systems, i.e. Vera or Harmony Hub or Nest, using lightweight frameworks
1.8
@@ -33,7 +33,7 @@
com.github.bwssytems
nest-controller
- 1.0.1
+ 1.0.3
com.sparkjava
diff --git a/src/main/java/com/bwssystems/HABridge/hue/HueMulator.java b/src/main/java/com/bwssystems/HABridge/hue/HueMulator.java
index af877563..a0f77257 100644
--- a/src/main/java/com/bwssystems/HABridge/hue/HueMulator.java
+++ b/src/main/java/com/bwssystems/HABridge/hue/HueMulator.java
@@ -321,7 +321,7 @@ public void setupServer() {
if(device.getDeviceType().toLowerCase().contains("activity") || (device.getMapType() != null && device.getMapType().equalsIgnoreCase("harmonyActivity")))
{
- log.debug("executing activity to Harmony: " + url);
+ log.debug("executing HUE api request to change activity to Harmony: " + url);
RunActivity anActivity = new Gson().fromJson(url, RunActivity.class);
HarmonyHandler myHarmony = myHarmonyHome.getHarmonyHandler(device.getTargetDevice());
if(myHarmony == null)
@@ -334,7 +334,7 @@ public void setupServer() {
}
else if(device.getDeviceType().toLowerCase().contains("button") || (device.getMapType() != null && device.getMapType().equalsIgnoreCase("harmonyButton")))
{
- log.debug("executing button press to Harmony: " + url);
+ log.debug("executing HUE api request to button press to Harmony: " + url);
ButtonPress aDeviceButton = new Gson().fromJson(url, ButtonPress.class);
HarmonyHandler myHarmony = myHarmonyHome.getHarmonyHandler(device.getTargetDevice());
if(myHarmony == null)
@@ -347,7 +347,7 @@ else if(device.getDeviceType().toLowerCase().contains("button") || (device.getMa
}
else if(device.getDeviceType().toLowerCase().contains("home") || (device.getMapType() != null && device.getMapType().equalsIgnoreCase("nestHomeAway")))
{
- log.debug("executing set away for nest home: " + url);
+ log.debug("executing HUE api request to set away for nest home: " + url);
NestInstruction homeAway = new Gson().fromJson(url, NestInstruction.class);
if(theNest == null)
{
@@ -359,7 +359,7 @@ else if(device.getDeviceType().toLowerCase().contains("home") || (device.getMapT
}
else if(device.getDeviceType().toLowerCase().contains("thermo") || (device.getMapType() != null && device.getMapType().equalsIgnoreCase("nestThermoSet")))
{
- log.debug("executing set thermostat for nest: " + url);
+ log.debug("executing HUE api request to set thermostat for nest: " + url);
NestInstruction thermoSetting = new Gson().fromJson(url, NestInstruction.class);
if(theNest == null)
{
@@ -369,17 +369,28 @@ else if(device.getDeviceType().toLowerCase().contains("thermo") || (device.getMa
else {
if(thermoSetting.getControl().equalsIgnoreCase("temp")) {
if(request.body().contains("bri")) {
- thermoSetting.setTemp(replaceIntensityValue(thermoSetting.getTemp(), state.getBri()));
+ thermoSetting.setTemp(String.valueOf(Math.round((Integer.parseInt(replaceIntensityValue(thermoSetting.getTemp(), state.getBri())) - 32)/1.8)));
+ log.debug("Setting thermostat: " + thermoSetting.getName() + " to " + thermoSetting.getTemp() + "C");
theNest.getThermostat(thermoSetting.getName()).setTargetTemperature(Float.parseFloat(thermoSetting.getTemp()));
}
}
- else if (!thermoSetting.getControl().equalsIgnoreCase("status")) {
+ else if (thermoSetting.getControl().contains("range") ||thermoSetting.getControl().contains("heat") ||thermoSetting.getControl().contains("cool") ||thermoSetting.getControl().contains("off")) {
+ log.debug("Setting thermostat target type: " + thermoSetting.getName() + " to " + thermoSetting.getControl());
theNest.getThermostat(thermoSetting.getName()).setTargetType(thermoSetting.getControl());
}
+ else if(thermoSetting.getControl().contains("fan")) {
+ log.debug("Setting thermostat fan mode: " + thermoSetting.getName() + " to " + thermoSetting.getControl().substring(4));
+ theNest.getThermostat(thermoSetting.getName()).setFanMode(thermoSetting.getControl().substring(4));
+ }
+ else {
+ log.warn("no valid Nest control info: " + thermoSetting.getControl());
+ responseString = "[{\"error\":{\"type\": 6, \"address\": \"/lights/" + lightId + ",\"description\": \"no valid Nest control info\", \"parameter\": \"/lights/" + lightId + "state\"}}]";
+ }
}
}
else if(url.startsWith("udp://"))
{
+ log.debug("executing HUE api request to UDP: " + url);
try {
String intermediate = url.substring(6);
String ipAddr = intermediate.substring(0, intermediate.indexOf(':'));
@@ -402,7 +413,7 @@ else if(url.startsWith("udp://"))
}
else
{
- log.debug("executing activity to Http " + (device.getHttpVerb() == null?"GET":device.getHttpVerb()) + ": " + url);
+ log.debug("executing HUE api request to Http " + (device.getHttpVerb() == null?"GET":device.getHttpVerb()) + ": " + url);
// quick template
String body;
url = replaceIntensityValue(url, state.getBri());
diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js
index 5601385b..ed58e320 100644
--- a/src/main/resources/public/scripts/app.js
+++ b/src/main/resources/public/scripts/app.js
@@ -587,63 +587,63 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
$scope.device.deviceType = "home";
$scope.device.name = nestitem.name;
$scope.device.mapType = "nestHomeAway";
- $scope.device.mapId = nestitem.Id;
- $scope.device.onUrl = "{\"name\":\"" + nestitem.Id + "\",\"away\":false,\"control\":\"status\"}";
- $scope.device.offUrl = "{\"name\":\"" + nestitem.Id + "\",\"away\":true,\"control\":\"status\"}";
+ $scope.device.mapId = nestitem.id;
+ $scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"away\":false,\"control\":\"status\"}";
+ $scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"away\":true,\"control\":\"status\"}";
};
$scope.buildNestTempUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Temperature";
$scope.device.mapType = "nestThermoSet";
- $scope.device.mapId = nestitem.Id + "-SetTemp";
- $scope.device.onUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"temp\",\"temp\":\"${intensity.percent}\"}";
- $scope.device.offUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"temp\",\"temp\":\"${intensity.percent}\"}";
+ $scope.device.mapId = nestitem.id + "-SetTemp";
+ $scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"temp\",\"temp\":\"${intensity.percent}\"}";
+ $scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"temp\",\"temp\":\"${intensity.percent}\"}";
};
$scope.buildNestHeatUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Heat";
$scope.device.mapType = "nestThermoSet";
- $scope.device.mapId = nestitem.Id + "-SetHeat";
- $scope.device.onUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"heat\"}";
- $scope.device.offUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"off\"}";
+ $scope.device.mapId = nestitem.id + "-SetHeat";
+ $scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"heat\"}";
+ $scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"off\"}";
};
$scope.buildNestCoolUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Cool";
$scope.device.mapType = "nestThermoSet";
- $scope.device.mapId = nestitem.Id + "-SetCool";
- $scope.device.onUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"cool\"}";
- $scope.device.offUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"off\"}";
+ $scope.device.mapId = nestitem.id + "-SetCool";
+ $scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"cool\"}";
+ $scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"off\"}";
};
$scope.buildNestRangeUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Range";
$scope.device.mapType = "nestThermoSet";
- $scope.device.mapId = nestitem.Id + "-SetRange";
- $scope.device.onUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"range\"}";
- $scope.device.offUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"off\"}";
+ $scope.device.mapId = nestitem.id + "-SetRange";
+ $scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"range\"}";
+ $scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"off\"}";
};
$scope.buildNestOffUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Thermostat";
$scope.device.mapType = "nestThermoSet";
- $scope.device.mapId = nestitem.Id + "-TurnOff";
- $scope.device.onUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"range\"}";
- $scope.device.offUrl = "{\"name\":\"" + nestitem.Id + "\",\"control\":\"off\"}";
+ $scope.device.mapId = nestitem.id + "-TurnOff";
+ $scope.device.onUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"range\"}";
+ $scope.device.offUrl = "{\"name\":\"" + nestitem.id + "\",\"control\":\"off\"}";
};
$scope.buildNestFanUrls = function (nestitem) {
$scope.device.deviceType = "thermo";
$scope.device.name = nestitem.name.substr(0, nestitem.name.indexOf("(")) + " Fan";
$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.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) {