Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump aioshelly to 12.3.2 #136486

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions homeassistant/components/shelly/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

from .const import (
BLU_TRV_TEMPERATURE_SETTINGS,
BLU_TRV_TIMEOUT,
DOMAIN,
LOGGER,
NOT_CALIBRATED_ISSUE_ID,
Expand Down Expand Up @@ -604,4 +605,5 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
"method": "Trv.SetTarget",
"params": {"id": 0, "target_C": target_temp},
},
timeout=BLU_TRV_TIMEOUT,
)
3 changes: 3 additions & 0 deletions homeassistant/components/shelly/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,6 @@ class BLEScannerMode(StrEnum):
API_WS_URL = "/api/shelly/ws"

COMPONENT_ID_PATTERN = re.compile(r"[a-z\d]+:\d+")

# value confirmed by Shelly team
BLU_TRV_TIMEOUT = 60
9 changes: 7 additions & 2 deletions homeassistant/components/shelly/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,20 @@ def _update_callback(self) -> None:
"""Handle device update."""
self.async_write_ha_state()

async def call_rpc(self, method: str, params: Any) -> Any:
async def call_rpc(
self, method: str, params: Any, timeout: float | None = None
) -> Any:
"""Call RPC method."""
LOGGER.debug(
"Call RPC for entity %s, method: %s, params: %s",
"Call RPC for entity %s, method: %s, params: %s, timeout: %s",
self.name,
method,
params,
timeout,
)
try:
if timeout:
return await self.coordinator.device.call_rpc(method, params, timeout)
return await self.coordinator.device.call_rpc(method, params)
except DeviceConnectionError as err:
self.coordinator.last_update_success = False
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/shelly/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"integration_type": "device",
"iot_class": "local_push",
"loggers": ["aioshelly"],
"requirements": ["aioshelly==12.3.1"],
"requirements": ["aioshelly==12.3.2"],
"zeroconf": [
{
"type": "_http._tcp.local.",
Expand Down
13 changes: 12 additions & 1 deletion homeassistant/components/shelly/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.entity_registry import RegistryEntry

from .const import CONF_SLEEP_PERIOD, LOGGER, VIRTUAL_NUMBER_MODE_MAP
from .const import BLU_TRV_TIMEOUT, CONF_SLEEP_PERIOD, LOGGER, VIRTUAL_NUMBER_MODE_MAP
from .coordinator import ShellyBlockCoordinator, ShellyConfigEntry, ShellyRpcCoordinator
from .entity import (
BlockEntityDescription,
Expand Down Expand Up @@ -127,6 +127,17 @@
connections={(CONNECTION_BLUETOOTH, ble_addr)}
)

async def async_set_native_value(self, value: float) -> None:
"""Change the value."""
if TYPE_CHECKING:
assert isinstance(self._id, int)

await self.call_rpc(

Check warning on line 135 in homeassistant/components/shelly/number.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/shelly/number.py#L135

Added line #L135 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this could use some coverage

self.entity_description.method,
self.entity_description.method_params_fn(self._id, value),
timeout=BLU_TRV_TIMEOUT,
)


NUMBERS: dict[tuple[str, str], BlockNumberDescription] = {
("device", "valvePos"): BlockNumberDescription(
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/components/shelly/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
HVACAction,
HVACMode,
)
from homeassistant.components.shelly.const import DOMAIN
from homeassistant.components.shelly.const import BLU_TRV_TIMEOUT, DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntryState
from homeassistant.const import (
Expand Down Expand Up @@ -804,6 +804,7 @@ async def test_blu_trv_climate_set_temperature(
"method": "Trv.SetTarget",
"params": {"id": 0, "target_C": 28.0},
},
BLU_TRV_TIMEOUT,
)

assert get_entity_attribute(hass, entity_id, ATTR_TEMPERATURE) == 28
Expand Down