From 0a292eb50784e70ff1aa6ad27b1293eb50033818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Fr=C4=85cz?= Date: Mon, 24 Jun 2024 22:58:48 +0200 Subject: [PATCH] Fix shut & reveal actions, v4.5.7 release --- backend/models/supla/SuplaApiReal.php | 12 ++++++++++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/backend/models/supla/SuplaApiReal.php b/backend/models/supla/SuplaApiReal.php index 6950117..5b4f434 100644 --- a/backend/models/supla/SuplaApiReal.php +++ b/backend/models/supla/SuplaApiReal.php @@ -128,11 +128,19 @@ public function getSensorLogs(int $channelId, $fromTime = '-1day', $toTime = 'no } public function shut(int $channelId, int $percent = 100) { - return $this->client->channelShut($channelId, $percent); + $shutPartiallyCallback = function () use ($percent, $channelId) { + return $this->patch('/channels/' . $channelId, ['action' => 'shut-partially', 'percent' => $percent]); + }; + $shutPartially = $shutPartiallyCallback->bindTo($this->client, SuplaApiClient::class); + return $shutPartially(); } public function reveal(int $channelId, int $percent = 100) { - return $this->client->channelReveal($channelId, $percent); + $revealPartiallyCallback = function () use ($percent, $channelId) { + return $this->patch('/channels/' . $channelId, ['action' => 'reveal-partially', 'percent' => $percent]); + }; + $revealPartially = $revealPartiallyCallback->bindTo($this->client, SuplaApiClient::class); + return $revealPartially(); } private function handleError($response) { diff --git a/package-lock.json b/package-lock.json index f6274f8..9e0a58f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supla-scripts", - "version": "4.5.6", + "version": "4.5.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "supla-scripts", - "version": "4.5.6", + "version": "4.5.7", "hasInstallScript": true, "license": "MIT", "devDependencies": { diff --git a/package.json b/package.json index f3222c8..14e6806 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supla-scripts", - "version": "4.5.6", + "version": "4.5.7", "description": "", "license": "MIT", "private": true,