Skip to content

Commit

Permalink
Fix shut & reveal actions, v4.5.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
fracz committed Jun 24, 2024
1 parent f02f745 commit 0a292eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions backend/models/supla/SuplaApiReal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supla-scripts",
"version": "4.5.6",
"version": "4.5.7",
"description": "",
"license": "MIT",
"private": true,
Expand Down

0 comments on commit 0a292eb

Please sign in to comment.