diff --git a/homeassistant/components/shelly/number.py b/homeassistant/components/shelly/number.py index 83606df5a4d..ab09ad1976a 100644 --- a/homeassistant/components/shelly/number.py +++ b/homeassistant/components/shelly/number.py @@ -66,6 +66,8 @@ class RpcNumber(ShellyRpcAttributeEntity, NumberEntity): """Represent a RPC number entity.""" entity_description: RpcNumberDescription + attribute_value: float | None + _id: int | None def __init__( self, @@ -93,9 +95,6 @@ class RpcNumber(ShellyRpcAttributeEntity, NumberEntity): @property def native_value(self) -> float | None: """Return value of number.""" - if TYPE_CHECKING: - assert isinstance(self.attribute_value, float | None) - return self.attribute_value @rpc_call @@ -104,7 +103,6 @@ class RpcNumber(ShellyRpcAttributeEntity, NumberEntity): method = getattr(self.coordinator.device, self.entity_description.method) if TYPE_CHECKING: - assert isinstance(self._id, int) assert method is not None await method(self._id, value) diff --git a/homeassistant/components/shelly/text.py b/homeassistant/components/shelly/text.py index 8bca94603be..811467f9e43 100644 --- a/homeassistant/components/shelly/text.py +++ b/homeassistant/components/shelly/text.py @@ -3,7 +3,7 @@ from __future__ import annotations from dataclasses import dataclass -from typing import TYPE_CHECKING, Final +from typing import Final from aioshelly.const import RPC_GENERATIONS @@ -76,14 +76,12 @@ class RpcText(ShellyRpcAttributeEntity, TextEntity): """Represent a RPC text entity.""" entity_description: RpcTextDescription + attribute_value: str | None _id: int @property def native_value(self) -> str | None: """Return value of sensor.""" - if TYPE_CHECKING: - assert isinstance(self.attribute_value, str | None) - return self.attribute_value @rpc_call