mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 00:10:20 +00:00
fix requests
This commit is contained in:
@@ -1979,39 +1979,25 @@ app.controller('FibaroController', function ($scope, $location, bridgeService, n
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildDeviceUrls = function (fibarodevice, dim_control, buildonly) {
|
$scope.buildDeviceUrls = function (fibarodevice, dim_control, buildonly) {
|
||||||
if(dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0) {
|
if(dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0)
|
||||||
dimpayload = "http://" + fibarodevice.fibaroaddress + ":" + $scope.fibaro.port
|
dimpayload = "http://" + fibarodevice.fibaroaddress + ":" + $scope.fibaro.port + "/api/callAction?deviceID=" + fibarodevice.id + "&name=setValue&arg1=" + dim_control;
|
||||||
+ "/data_request?id=action&output_format=json&DeviceNum="
|
else
|
||||||
+ fibarodevice.id
|
dimpayload = "http://" + fibarodevice.fibaroaddress + ":" + $scope.fibaro.port + "/api/callAction?deviceID=" + fibarodevice.id + "&name=turnOn";
|
||||||
+ "&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget="
|
|
||||||
+ dim_control;
|
onpayload = "http://" + fibarodevice.fibaroaddress + ":" + $scope.fibaro.port + "/api/callAction?deviceID=" + fibarodevice.id + "&name=turnOn";
|
||||||
}
|
offpayload = "http://" + fibarodevice.fibaroaddress + ":" + $scope.fibaro.port + "/api/callAction?deviceID=" + fibarodevice.id + "&name=turnOff";
|
||||||
else
|
|
||||||
dimpayload = "http://" + fibarodevice.fibaroaddress + ":" + $scope.fibaro.port
|
|
||||||
+ "/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum="
|
|
||||||
+ fibarodevice.id;
|
|
||||||
onpayload = "http://" + fibarodevice.fibaroaddress + ":" + $scope.fibaro.port
|
|
||||||
+ "/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum="
|
|
||||||
+ fibarodevice.id;
|
|
||||||
offpayload = "http://" + fibarodevice.fibaroaddress + ":" + $scope.fibaro.port
|
|
||||||
+ "/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum="
|
|
||||||
+ fibarodevice.id;
|
|
||||||
|
|
||||||
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, fibarodevice.id, fibarodevice.name, fibarodevice.fibaroname, "switch", "fibaroDevice", null, null);
|
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, fibarodevice.id, fibarodevice.name, fibarodevice.fibaroname, "switch", "fibaroDevice", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
if (!buildonly) {
|
if (!buildonly) {
|
||||||
bridgeService.editNewDevice($scope.device);
|
bridgeService.editNewDevice($scope.device);
|
||||||
$location.path('/editdevice');
|
$location.path('/editdevice');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.buildSceneUrls = function (fibaroscene) {
|
$scope.buildSceneUrls = function (fibaroscene) {
|
||||||
onpayload = "http://" + fibaroscene.fibaroaddress + ":" + $scope.fibaro.port
|
onpayload = "http://" + fibaroscene.fibaroaddress + ":" + $scope.fibaro.port + "/api/sceneControl?id=" + fibaroscene.id + "&action=start";
|
||||||
+ "/data_request?id=action&output_format=json&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="
|
offpayload = "http://" + fibaroscene.fibaroaddress + ":" + $scope.fibaro.port + "/api/sceneControl?id=" + fibaroscene.id + "&action=stop";
|
||||||
+ fibaroscene.id;
|
|
||||||
offpayload = "http://" + fibaroscene.fibaroaddress + ":" + $scope.fibaro.port
|
|
||||||
+ "/data_request?id=action&output_format=json&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="
|
|
||||||
+ fibarocene.id;
|
|
||||||
|
|
||||||
bridgeService.buildUrls(onpayload, null, offpayload, false, fibaroscene.id, fibaroscene.name, fibaroscene.fibaroname, "scene", "fibaroScene", null, null);
|
bridgeService.buildUrls(onpayload, null, offpayload, false, fibaroscene.id, fibaroscene.name, fibaroscene.fibaroname, "scene", "fibaroScene", null, null);
|
||||||
$scope.device = bridgeService.state.device;
|
$scope.device = bridgeService.state.device;
|
||||||
|
|||||||
Reference in New Issue
Block a user