Skip to content

Commit

Permalink
Refactoring processing of virtual connector (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 22, 2023
1 parent 467ba2a commit 851454d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/Controllers/CharacteristicsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ private function readCharacteristic(
* @throws MetadataExceptions\InvalidArgument
* @throws MetadataExceptions\InvalidState
* @throws MetadataExceptions\MalformedInput
* @throws Utils\JsonException
*/
public function writeCharacteristic(
Uuid\UuidInterface $connectorId,
Expand Down Expand Up @@ -705,13 +704,12 @@ public function writeCharacteristic(
$this->channelsPropertiesStateManager->writeValue(
$row->getProperty(),
Utils\ArrayHash::from([
DevicesStates\Property::VALID_FIELD => true,
DevicesStates\Property::EXPECTED_VALUE_FIELD => $row->getValue(),
DevicesStates\Property::PENDING_FIELD => true,
]),
);
}
} catch (Exceptions\InvalidState $ex) {
} catch (DevicesExceptions\InvalidState | Utils\JsonException $ex) {
$this->logger->warning(
'State value could not be converted to mapped parent',
[
Expand Down
8 changes: 2 additions & 6 deletions src/Writers/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use FastyBird\Library\Metadata\Documents as MetadataDocuments;
use FastyBird\Library\Metadata\Exceptions as MetadataExceptions;
use FastyBird\Library\Metadata\Types as MetadataTypes;
use FastyBird\Library\Metadata\Utilities as MetadataUtilities;
use FastyBird\Module\Devices\Events as DevicesEvents;
use FastyBird\Module\Devices\Exceptions as DevicesExceptions;
use FastyBird\Module\Devices\Models as DevicesModels;
Expand Down Expand Up @@ -299,12 +298,9 @@ private function processProperty(

if ($parent instanceof MetadataDocuments\DevicesModule\ChannelDynamicProperty) {
try {
$characteristic->setActualValue(MetadataUtilities\ValueHelper::normalizeValue(
$entity->getDataType(),
$characteristic->setActualValue(
$entity->getExpectedValue() ?? $entity->getActualValue(),
$entity->getFormat(),
$entity->getInvalid(),
));
);
} catch (Exceptions\InvalidState $ex) {
$this->logger->warning(
'State value could not be converted from mapped parent',
Expand Down

0 comments on commit 851454d

Please sign in to comment.