mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-19 16:41:53 +00:00
Initial fixes and cleanup prior to pull request 1
This commit is contained in:
@@ -21,9 +21,7 @@ import java.util.HashMap;
|
||||
* Currently supports 'turn on' for open window, and 'turn off' for close.
|
||||
*
|
||||
* Known issues:
|
||||
* //TODO - Fix bug on UI where bulk update seems to add the single device twice
|
||||
* //TODO - Fix bug on UI where already configured devices are not shown as such.
|
||||
*
|
||||
* //TODO - Fix bug on UI where bulk update seems to add the single device twice if 'update' is clicked (this is a general bug with Vera too I think)
|
||||
* Enhancements:
|
||||
* //TODO - support 'dimming' for partial window opening.
|
||||
*
|
||||
@@ -77,7 +75,6 @@ public class SomfyHome implements Home {
|
||||
log.debug("executing HUE api request to change activity to Somfy: " + anItem.getItem().getAsString());
|
||||
String jsonToPost = anItem.getItem().getAsString();
|
||||
|
||||
//RunActivity anActivity = new Gson().fromJson(url, RunActivity.class);
|
||||
SomfyInfo somfyHandler = getSomfyHandler(device.getTargetDevice());
|
||||
if(somfyHandler == null) {
|
||||
log.warn("Should not get here, no Somfy configured");
|
||||
@@ -88,7 +85,9 @@ public class SomfyHome implements Home {
|
||||
try {
|
||||
somfyHandler.execApply(jsonToPost);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
log.warn("Error posting request to Somfy");
|
||||
responseString = "[{\"error\":{\"type\": 6, \"address\": \"/lights/" + lightId
|
||||
+ "\",\"description\": \"Error posting request to SomfyTahoma\", \"parameter\": \"/lights/" + lightId + "state\"}}]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -114,6 +113,6 @@ public class SomfyHome implements Home {
|
||||
|
||||
@Override
|
||||
public void closeHome() {
|
||||
|
||||
somfys = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2344,6 +2344,7 @@ app.controller('SomfyController', function ($scope, $location, $http, bridgeServ
|
||||
$scope.bulk = { devices: [] };
|
||||
$scope.selectAll = false;
|
||||
$scope.somfy = {base: "http://", port: "3480", id: ""};
|
||||
bridgeService.viewDevices(); //Needs this if you're navigating to the 'somfy' page directly without going to the home page first..
|
||||
bridgeService.viewSomfyDevices();
|
||||
$scope.imgButtonsUrl = "glyphicon glyphicon-plus";
|
||||
$scope.buttonsVisible = false;
|
||||
@@ -2354,8 +2355,8 @@ app.controller('SomfyController', function ($scope, $location, $http, bridgeServ
|
||||
$scope.device = bridgeService.state.device;
|
||||
};
|
||||
|
||||
$scope.buildDeviceUrls = function (somfydevice, dim_control) {
|
||||
//TODO - support partial window opening
|
||||
$scope.buildDeviceUrls = function (somfydevice) {
|
||||
//TODO - support partial window opening - add back 'dim_control' second param in here, and in somfydevice.html
|
||||
dimpayload = "";
|
||||
onpayload = "{\"label\":\"Label that is ignored probably\",\"actions\":[{\"deviceURL\":\""+ somfydevice.deviceUrl+"\",\"commands\":[{\"name\":\"open\",\"parameters\":[]}]}]}";
|
||||
offpayload = "{\"label\":\"Label that is ignored probably\",\"actions\":[{\"deviceURL\":\""+ somfydevice.deviceUrl+"\",\"commands\":[{\"name\":\"close\",\"parameters\":[]}]}]}";
|
||||
@@ -2732,14 +2733,13 @@ app.filter('configuredDomoticzItems', function (bridgeService) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
app.filter('availableSomfyDeviceId', function(bridgeService) {
|
||||
app.filter('configuredSomfyDevices', function (bridgeService) {
|
||||
return function(input) {
|
||||
var out = [];
|
||||
if(input == null)
|
||||
if(input === undefined || input === null || input.length === undefined)
|
||||
return out;
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(!bridgeService.findDeviceByMapId(input[i].id, input[i].somfyname, "somfyDevice")){
|
||||
if(bridgeService.deviceContainsType(input[i], "somfyDevice")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
@@ -2747,19 +2747,7 @@ app.filter('availableSomfyDeviceId', function(bridgeService) {
|
||||
}
|
||||
});
|
||||
|
||||
app.filter('unavailableSomfyDeviceId', function(bridgeService) {
|
||||
return function(input) {
|
||||
var out = [];
|
||||
if(input == null)
|
||||
return out;
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
if(bridgeService.findDeviceByMapId(input[i].id, input[i].somfyname, "somfyDevice")){
|
||||
out.push(input[i]);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
app.controller('VersionController', function ($scope, bridgeService) {
|
||||
|
||||
@@ -36,20 +36,19 @@
|
||||
done in the edit tab, click the 'Add Bridge Device' to finish that selection
|
||||
setup. The 'Already Configured Somfy Devices' list below will show
|
||||
what is already setup for your Somfy.</p>
|
||||
<p>
|
||||
<!-- TODO - dim support for partial window opening.. --<p>
|
||||
Also, use this select menu for which type of dim control you would
|
||||
like to be generated: <select name="device-somfy-dim-control"
|
||||
id="device-somfy-dim-control" ng-model="device_somfy_dim_control">
|
||||
like to be generated: <select name="device-dim-control"
|
||||
id="device-dim-control" ng-model="device_dim_control">
|
||||
<option value="">none</option>
|
||||
<option value="${intensity.byte}">Pass-thru Value</option>
|
||||
<option value="${intensity.percent}">Percentage</option>
|
||||
<option value="${intensity.math(X*1)}">Custom Math</option>
|
||||
</select>
|
||||
</p>
|
||||
</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 Somfy.</p>
|
||||
feature. Select your items, then click
|
||||
bulk add below. Your items will be added with the name of the device from the Somfy Tahoma.</p>
|
||||
</div>
|
||||
<scrollable-table watch="bridge.somfydevices">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
@@ -80,15 +79,16 @@
|
||||
<td>{{somfydevice.room}}</td>
|
||||
<td>{{somfydevice.somfyname}}</td>
|
||||
<td>
|
||||
<!--TODO - taken device_dim_control out of here since not yet used-->
|
||||
<button class="btn btn-success" type="submit"
|
||||
ng-click="buildDeviceUrls(somfydevice, device_somfy_dim_control)">Build Item</button>
|
||||
ng-click="buildDeviceUrls(somfydevice)">Build Item</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</scrollable-table>
|
||||
<div class="panel-footer">
|
||||
<button class="btn btn-success" type="submit"
|
||||
ng-click="bulkAddDevices(device_somfy_dim_control)">Bulk Add
|
||||
ng-click="bulkAddDevices(device_dim_control)">Bulk Add
|
||||
({{bulk.devices.length}})</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -97,7 +97,7 @@
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">
|
||||
Already Configured Somfy Devices <a ng-click="toggleButtons()"><span
|
||||
class={{imgButtonsUrl}} aria-hidden="true"></span></a></a>
|
||||
class={{imgButtonsUrl}} aria-hidden="true"></span></a>
|
||||
</h2>
|
||||
</div>
|
||||
<div ng-if="buttonsVisible" class="panel-body">
|
||||
@@ -107,10 +107,8 @@
|
||||
<tr>
|
||||
<th>Row</th>
|
||||
<th sortable-header col="name">Name</th>
|
||||
<th sortable-header col="id">Id</th>
|
||||
<th sortable-header col="category">Category</th>
|
||||
<th sortable-header col="room">Room</th>
|
||||
<th sortable-header col="somfyname">Somfy</th>
|
||||
<th sortable-header col="targetDevice">Somfy</th>
|
||||
<th>Map Id</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -118,10 +116,8 @@
|
||||
ng-repeat="device in bridge.devices |configuredSomfyDevices">
|
||||
<td>{{$index+1}}</td>
|
||||
<td>{{device.name}}</td>
|
||||
<td>{{device.id}}</td>
|
||||
<td>{{device.category}}</td>
|
||||
<td>{{device.room}}</td>
|
||||
<td>{{device.somfyname}}</td>
|
||||
<td>{{device.targetDevice}}</td>
|
||||
<td>{{device.mapId}}</td>
|
||||
<td>
|
||||
<p>
|
||||
<button class="btn btn-warning" type="submit"
|
||||
|
||||
Reference in New Issue
Block a user