mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-16 18:24:36 +00:00
Updated code in the html and javascript to select the coorect name for
the button press command. Fixed the calculation of celsius conversion for setting nest temperatures. Fixes #33 Fixes #34
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.bwssystems.HABridge</groupId>
|
<groupId>com.bwssystems.HABridge</groupId>
|
||||||
<artifactId>ha-bridge</artifactId>
|
<artifactId>ha-bridge</artifactId>
|
||||||
<version>1.3.5</version>
|
<version>1.3.6</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ public class HueMulator {
|
|||||||
else {
|
else {
|
||||||
if(thermoSetting.getControl().equalsIgnoreCase("temp")) {
|
if(thermoSetting.getControl().equalsIgnoreCase("temp")) {
|
||||||
if(request.body().contains("bri")) {
|
if(request.body().contains("bri")) {
|
||||||
thermoSetting.setTemp(String.valueOf(Math.round((Integer.parseInt(replaceIntensityValue(thermoSetting.getTemp(), state.getBri())) - 32)/1.8)));
|
thermoSetting.setTemp(String.valueOf((Double.parseDouble(replaceIntensityValue(thermoSetting.getTemp(), state.getBri())) - 32.0)/1.8));
|
||||||
log.debug("Setting thermostat: " + thermoSetting.getName() + " to " + thermoSetting.getTemp() + "C");
|
log.debug("Setting thermostat: " + thermoSetting.getName() + " to " + thermoSetting.getTemp() + "C");
|
||||||
theNest.getThermostat(thermoSetting.getName()).setTargetTemperature(Float.parseFloat(thermoSetting.getTemp()));
|
theNest.getThermostat(thermoSetting.getName()).setTargetTemperature(Float.parseFloat(thermoSetting.getTemp()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -601,18 +601,20 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
|||||||
$scope.buildButtonUrls = function (harmonydevice, onbutton, offbutton) {
|
$scope.buildButtonUrls = function (harmonydevice, onbutton, offbutton) {
|
||||||
var currentOn = $scope.device.onUrl;
|
var currentOn = $scope.device.onUrl;
|
||||||
var currentOff = $scope.device.offUrl;
|
var currentOff = $scope.device.offUrl;
|
||||||
|
var actionOn = angular.fromJson(onbutton);
|
||||||
|
var actionOff = angular.fromJson(offbutton);
|
||||||
if( $scope.device.mapType == "harmonyButton") {
|
if( $scope.device.mapType == "harmonyButton") {
|
||||||
$scope.device.onUrl = currentOn.substr(0, currentOn.indexOf("]")) + ",{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + onbutton + "\"}]";
|
$scope.device.onUrl = currentOn.substr(0, currentOn.indexOf("]")) + ",{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + actionOn.command + "\"}]";
|
||||||
$scope.device.offUrl = currentOff.substr(0, currentOff.indexOf("]")) + ",{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + offbutton + "\"}]";
|
$scope.device.offUrl = currentOff.substr(0, currentOff.indexOf("]")) + ",{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + actionOff.command + "\"}]";
|
||||||
}
|
}
|
||||||
else if ($scope.device.mapType == null || $scope.device.mapType == "") {
|
else if ($scope.device.mapType == null || $scope.device.mapType == "") {
|
||||||
$scope.device.deviceType = "button";
|
$scope.device.deviceType = "button";
|
||||||
$scope.device.targetDevice = harmonydevice.hub;
|
$scope.device.targetDevice = harmonydevice.hub;
|
||||||
$scope.device.name = harmonydevice.device.label;
|
$scope.device.name = harmonydevice.device.label;
|
||||||
$scope.device.mapType = "harmonyButton";
|
$scope.device.mapType = "harmonyButton";
|
||||||
$scope.device.mapId = harmonydevice.device.id + "-" + onbutton + "-" + offbutton;
|
$scope.device.mapId = harmonydevice.device.id + "-" + actionOn.command + "-" + actionOff.command;
|
||||||
$scope.device.onUrl = "[{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + onbutton + "\"}]";
|
$scope.device.onUrl = "[{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + actionOn.command + "\"}]";
|
||||||
$scope.device.offUrl = "[{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + offbutton + "\"}]";
|
$scope.device.offUrl = "[{\"device\":\"" + harmonydevice.device.id + "\",\"button\":\"" + actionOff.command + "\"}]";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,21 +48,20 @@
|
|||||||
<td>
|
<td>
|
||||||
<select name="device-ctrlon" id="device-ctrlon" ng-model="devicectrlon">
|
<select name="device-ctrlon" id="device-ctrlon" ng-model="devicectrlon">
|
||||||
<optgroup ng-repeat="ctrlon in harmonydevice.device.controlGroup" label="{{ctrlon.name}}">
|
<optgroup ng-repeat="ctrlon in harmonydevice.device.controlGroup" label="{{ctrlon.name}}">
|
||||||
<option ng-repeat="funcon in ctrlon.function" value="{{funcon.label}}">{{funcon.name}}</option>
|
<option ng-repeat="funcon in ctrlon.function" value="{{funcon.action}}">{{funcon.label}}</option>
|
||||||
</optgroup >
|
</optgroup >
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select name="device-ctrloff" id="device-ctrloff" ng-model="devicectrloff">
|
<select name="device-ctrloff" id="device-ctrloff" ng-model="devicectrloff">
|
||||||
<optgroup ng-repeat="ctrloff in harmonydevice.device.controlGroup" label="{{ctrloff.name}}">
|
<optgroup ng-repeat="ctrloff in harmonydevice.device.controlGroup" label="{{ctrloff.name}}">
|
||||||
<option ng-repeat="funcoff in ctrloff.function" value="{{funcoff.label}}">{{funcoff.name}}</option>
|
<option ng-repeat="funcoff in ctrloff.function" value="{{funcoff.action}}">{{funcoff.label}}</option>
|
||||||
</optgroup >
|
</optgroup >
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-success" type="submit"
|
<button class="btn btn-success" type="submit"
|
||||||
ng-click="buildButtonUrls(harmonydevice, devicectrlon, devicectrloff)">Build
|
ng-click="buildButtonUrls(harmonydevice, devicectrlon, devicectrloff)">Build A Button</button>
|
||||||
A Button</button>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user