Skip to content

Commit

Permalink
Fixed discovery timer (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 29, 2024
1 parent 1088a15 commit 6c5fc0d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Commands/Discover.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace FastyBird\Connector\Tuya\Commands;

use DateTimeImmutable;
use DateTimeInterface;
use FastyBird\Connector\Tuya\Documents;
use FastyBird\Connector\Tuya\Exceptions;
Expand Down Expand Up @@ -110,6 +111,10 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $
return Console\Command\Command::FAILURE;
}

$executedTime = $this->clock->getNow();
assert($executedTime instanceof DateTimeImmutable);
$this->executedTime = $executedTime->modify('-5 second');

$io = new Style\SymfonyStyle($input, $output);

$io->title((string) $this->translator->translate('//tuya-connector.cmd.discover.title'));
Expand Down Expand Up @@ -282,8 +287,6 @@ function (string|int|null $answer) use ($connectors): Documents\Connectors\Conne

$io->info((string) $this->translator->translate('//tuya-connector.cmd.discover.messages.starting'));

$this->executedTime = $this->clock->getNow();

$serviceCmd = $symfonyApp->find(DevicesCommands\Connector::NAME);

$result = $serviceCmd->run(new Input\ArrayInput([
Expand Down
3 changes: 3 additions & 0 deletions src/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace FastyBird\Connector\Tuya\Commands;

use DateTimeImmutable;
use Doctrine\DBAL;
use FastyBird\Connector\Tuya;
use FastyBird\Connector\Tuya\Entities;
Expand Down Expand Up @@ -909,6 +910,8 @@ private function discoverDevices(Style\SymfonyStyle $io, Entities\Connectors\Con
}

$executedTime = $this->clock->getNow();
assert($executedTime instanceof DateTimeImmutable);
$executedTime = $executedTime->modify('-5 second');

$symfonyApp = $this->getApplication();

Expand Down
1 change: 1 addition & 0 deletions src/Translations/tuya-connector.en_us.neon
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ cmd:
india: "India"

data:
id: "ID"
name: "Name"
mode: "Mode"
model: "Model"
Expand Down

0 comments on commit 6c5fc0d

Please sign in to comment.