Skip to content

Commit

Permalink
call blutrv only for gw gen3
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli74 committed Dec 17, 2024
1 parent ed115f4 commit 13501dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions aioshelly/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,8 @@ class ShellyDevice:
MODEL_VINTAGE_V2,
}

BLU_TRV_IDENTIFIER = "blutrv"


class UndefinedType(Enum):
"""Singleton type for use with not set sentinel values."""
Expand Down
7 changes: 6 additions & 1 deletion aioshelly/rpc_device/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
process_ip_or_options,
)
from ..const import (
BLU_TRV_IDENTIFIER,
CONNECT_ERRORS,
DEVICE_INIT_TIMEOUT,
DEVICE_IO_TIMEOUT,
DEVICE_POLL_TIMEOUT,
FIRMWARE_PATTERN,
MODEL_BLU_GATEWAY_GEN3,
NOTIFY_WS_CLOSED,
VIRTUAL_COMPONENTS,
VIRTUAL_COMPONENTS_MIN_FIRMWARE,
Expand Down Expand Up @@ -545,13 +547,16 @@ def _parse_dynamic_components(self, components: dict[str, Any]) -> None:

async def _retrieve_blutrv_components(self, components: dict[str, Any]) -> None:
"""Retrieve BLU TRV components."""
if self.model != MODEL_BLU_GATEWAY_GEN3:
return

Check warning on line 551 in aioshelly/rpc_device/device.py

View check run for this annotation

Codecov / codecov/patch

aioshelly/rpc_device/device.py#L550-L551

Added lines #L550 - L551 were not covered by tests

if TYPE_CHECKING:
assert self._config
assert self._status

Check warning on line 555 in aioshelly/rpc_device/device.py

View check run for this annotation

Codecov / codecov/patch

aioshelly/rpc_device/device.py#L553-L555

Added lines #L553 - L555 were not covered by tests

for component in components.get("components", []):
_key = component["key"].split(":")
if _key[0] == "blutrv":
if _key[0] == BLU_TRV_IDENTIFIER:
calls = [

Check warning on line 560 in aioshelly/rpc_device/device.py

View check run for this annotation

Codecov / codecov/patch

aioshelly/rpc_device/device.py#L557-L560

Added lines #L557 - L560 were not covered by tests
("BluTrv.GetRemoteConfig", {"id": _key[1]}),
("BluTrv.GetRemoteStatus", {"id": _key[1]}),
Expand Down

0 comments on commit 13501dc

Please sign in to comment.