Skip to content

Commit

Permalink
Bump aiorussound to 3.1.5 (#126664)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahhusby committed Sep 24, 2024
1 parent e3e7aec commit 7391655
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
10 changes: 5 additions & 5 deletions homeassistant/components/russound_rio/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
controller: Controller,
) -> None:
"""Initialize the entity."""
self._instance = controller.instance
self._client = controller.client
self._controller = controller
self._primary_mac_address = (
controller.mac_address or controller.parent_controller.mac_address
Expand All @@ -60,9 +60,9 @@ def __init__(
model=controller.controller_type,
sw_version=controller.firmware_version,
)
if isinstance(self._instance.connection_handler, RussoundTcpConnectionHandler):
if isinstance(self._client.connection_handler, RussoundTcpConnectionHandler):
self._attr_device_info["configuration_url"] = (
f"http://{self._instance.connection_handler.host}"
f"http://{self._client.connection_handler.host}"
)
if controller.parent_controller:
self._attr_device_info["via_device"] = (
Expand All @@ -82,12 +82,12 @@ def _is_connected_updated(self, connected: bool) -> None:

async def async_added_to_hass(self) -> None:
"""Register callbacks."""
self._instance.connection_handler.add_connection_callback(
self._client.connection_handler.add_connection_callback(
self._is_connected_updated
)

async def async_will_remove_from_hass(self) -> None:
"""Remove callbacks."""
self._instance.connection_handler.remove_connection_callback(
self._client.connection_handler.remove_connection_callback(
self._is_connected_updated
)
2 changes: 1 addition & 1 deletion homeassistant/components/russound_rio/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"iot_class": "local_push",
"loggers": ["aiorussound"],
"quality_scale": "silver",
"requirements": ["aiorussound==3.0.5"]
"requirements": ["aiorussound==3.1.5"]
}
22 changes: 12 additions & 10 deletions homeassistant/components/russound_rio/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

import logging

from aiorussound import Source, Zone
from aiorussound import RussoundClient, Source, Zone
from aiorussound.models import CallbackType

from homeassistant.components.media_player import (
MediaPlayerDeviceClass,
Expand Down Expand Up @@ -130,25 +131,26 @@ def __init__(self, zone: Zone, sources: dict[int, Source]) -> None:
self._attr_name = zone.name
self._attr_unique_id = f"{self._primary_mac_address}-{zone.device_str()}"
for flag, feature in MP_FEATURES_BY_FLAG.items():
if flag in zone.instance.supported_features:
if flag in zone.client.supported_features:
self._attr_supported_features |= feature

def _callback_handler(self, device_str, *args):
if (
device_str == self._zone.device_str()
or device_str == self._current_source().device_str()
):
self.schedule_update_ha_state()
async def _state_update_callback(
self, _client: RussoundClient, _callback_type: CallbackType
) -> None:
"""Call when the device is notified of changes."""
self.async_write_ha_state()

async def async_added_to_hass(self) -> None:
"""Register callback handlers."""
await super().async_added_to_hass()
self._zone.add_callback(self._callback_handler)
await self._client.register_state_update_callbacks(self._state_update_callback)

async def async_will_remove_from_hass(self) -> None:
"""Remove callbacks."""
await super().async_will_remove_from_hass()
self._zone.remove_callback(self._callback_handler)
await self._client.unregister_state_update_callbacks(
self._state_update_callback
)

def _current_source(self) -> Source:
return self._zone.fetch_current_source()
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ aioridwell==2024.01.0
aioruckus==0.41

# homeassistant.components.russound_rio
aiorussound==3.0.5
aiorussound==3.1.5

# homeassistant.components.ruuvi_gateway
aioruuvigateway==0.1.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ aioridwell==2024.01.0
aioruckus==0.41

# homeassistant.components.russound_rio
aiorussound==3.0.5
aiorussound==3.1.5

# homeassistant.components.ruuvi_gateway
aioruuvigateway==0.1.0
Expand Down

0 comments on commit 7391655

Please sign in to comment.