From c8b1827150e20b6f647a6e9ce76ece7c74c92b83 Mon Sep 17 00:00:00 2001 From: Monica Goward Date: Thu, 16 Mar 2017 12:59:43 +0000 Subject: [PATCH] Fixes post merge to comply with updated js code json --- .../HABridge/plugins/somfy/SomfyHome.java | 4 ++-- src/main/resources/public/scripts/app.js | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/bwssystems/HABridge/plugins/somfy/SomfyHome.java b/src/main/java/com/bwssystems/HABridge/plugins/somfy/SomfyHome.java index bdab8a3..01520e1 100644 --- a/src/main/java/com/bwssystems/HABridge/plugins/somfy/SomfyHome.java +++ b/src/main/java/com/bwssystems/HABridge/plugins/somfy/SomfyHome.java @@ -72,8 +72,8 @@ public class SomfyHome implements Home { } else { if (anItem.getType() != null && anItem.getType().trim().equalsIgnoreCase(DeviceMapTypes.SOMFY_DEVICE[DeviceMapTypes.typeIndex])) { - log.debug("executing HUE api request to change activity to Somfy: " + anItem.getItem().getAsString()); - String jsonToPost = anItem.getItem().getAsString(); + log.debug("executing HUE api request to change activity to Somfy: " + anItem.getItem().toString()); + String jsonToPost = anItem.getItem().toString(); SomfyInfo somfyHandler = getSomfyHandler(device.getTargetDevice()); if(somfyHandler == null) { diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index 1fffbbe..e73742f 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -2462,7 +2462,7 @@ app.controller('SomfyController', function ($scope, $location, $http, bridgeServ $scope.device = bridgeService.state.device; }; - $scope.buildDeviceUrls = function (somfydevice) { + $scope.buildDeviceUrls = function (somfydevice, dim_control, buildonly) { //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\":[]}]}]}"; @@ -2470,18 +2470,20 @@ app.controller('SomfyController', function ($scope, $location, $http, bridgeServ bridgeService.buildUrls(onpayload, dimpayload, offpayload, true, somfydevice.id, somfydevice.name, somfydevice.somfyname, "switch", "somfyDevice", null, null); $scope.device = bridgeService.state.device; - bridgeService.editNewDevice($scope.device); - $location.path('/editdevice'); - + if (!buildonly) { + bridgeService.editNewDevice($scope.device); + $location.path('/editdevice'); + } }; $scope.bulkAddDevices = function(dim_control) { var devicesList = []; + $scope.clearDevice(); for(var i = 0; i < $scope.bulk.devices.length; i++) { for(var x = 0; x < bridgeService.state.somfydevices.length; x++) { if(bridgeService.state.somfydevices[x].id === $scope.bulk.devices[i]) { - $scope.buildDeviceUrls(bridgeService.state.somfydevices[x],dim_control); + $scope.buildDeviceUrls(bridgeService.state.somfydevices[x],dim_control, true); devicesList[i] = { name: $scope.device.name, mapId: $scope.device.mapId, @@ -2498,6 +2500,7 @@ app.controller('SomfyController', function ($scope, $location, $http, bridgeServ contentBodyDim: $scope.device.contentBodyDim, contentBodyOff: $scope.device.contentBodyOff }; + $scope.clearDevice(); } } }