Skip to content

Commit

Permalink
fix: unstow
Browse files Browse the repository at this point in the history
  • Loading branch information
SRWieZ committed Jan 7, 2025
1 parent d192b66 commit fe09667
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
15 changes: 11 additions & 4 deletions cli/starlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@
}

$dishy = new Dishy;
$history = $dishy->getStatsHistory();

foreach ($history as $key => $value) {
echo $key.': '.(is_array($value) ? count($value) : $value).PHP_EOL;
}
$dishy->stow();

sleep(10);

$dishy->unstow();

// $history = $dishy->getStatsHistory();

// foreach ($history as $key => $value) {
// echo $key.': '.(is_array($value) ? count($value) : $value).PHP_EOL;
// }

// dump($history['outages']);

Expand Down
13 changes: 9 additions & 4 deletions src/Dishy.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function handle(Message $request, ?int $timeout = null): Response
/** @var object{code: int, details: string, metadata:array} $status */
[$response, $status] = $this->client->Handle(
argument: new Request([
self::getRequestKey($request) => new $request,
self::getRequestKey($request) => $request,
]),
options: $options
)->wait();
Expand Down Expand Up @@ -172,16 +172,21 @@ public function getStatsHistory(): array
return $array;
}

// Can take a few seconds
public function unstow(): void
{
$this->stow(false);
}

public function stow(bool $stow = true): void
{
$this->handle(new DishStowRequest(
array_filter(['unstow' => ! $stow])
));
$request = new DishStowRequest;

if ($stow === false) {
$request->setUnstow(true);
}

$this->handle($request, timeout: 5);
}

public function reboot(): void
Expand Down

0 comments on commit fe09667

Please sign in to comment.