Bump aiorussound to 3.1.5 (#126664)

This commit is contained in:
Noah Husby 2024-09-24 15:10:01 -04:00 committed by GitHub
parent e3e7aec73c
commit 739165585a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 18 deletions

View File

@ -43,7 +43,7 @@ class RussoundBaseEntity(Entity):
controller: Controller, controller: Controller,
) -> None: ) -> None:
"""Initialize the entity.""" """Initialize the entity."""
self._instance = controller.instance self._client = controller.client
self._controller = controller self._controller = controller
self._primary_mac_address = ( self._primary_mac_address = (
controller.mac_address or controller.parent_controller.mac_address controller.mac_address or controller.parent_controller.mac_address
@ -60,9 +60,9 @@ class RussoundBaseEntity(Entity):
model=controller.controller_type, model=controller.controller_type,
sw_version=controller.firmware_version, 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"] = ( self._attr_device_info["configuration_url"] = (
f"http://{self._instance.connection_handler.host}" f"http://{self._client.connection_handler.host}"
) )
if controller.parent_controller: if controller.parent_controller:
self._attr_device_info["via_device"] = ( self._attr_device_info["via_device"] = (
@ -82,12 +82,12 @@ class RussoundBaseEntity(Entity):
async def async_added_to_hass(self) -> None: async def async_added_to_hass(self) -> None:
"""Register callbacks.""" """Register callbacks."""
self._instance.connection_handler.add_connection_callback( self._client.connection_handler.add_connection_callback(
self._is_connected_updated self._is_connected_updated
) )
async def async_will_remove_from_hass(self) -> None: async def async_will_remove_from_hass(self) -> None:
"""Remove callbacks.""" """Remove callbacks."""
self._instance.connection_handler.remove_connection_callback( self._client.connection_handler.remove_connection_callback(
self._is_connected_updated self._is_connected_updated
) )

View File

@ -7,5 +7,5 @@
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["aiorussound"], "loggers": ["aiorussound"],
"quality_scale": "silver", "quality_scale": "silver",
"requirements": ["aiorussound==3.0.5"] "requirements": ["aiorussound==3.1.5"]
} }

View File

@ -4,7 +4,8 @@ from __future__ import annotations
import logging import logging
from aiorussound import Source, Zone from aiorussound import RussoundClient, Source, Zone
from aiorussound.models import CallbackType
from homeassistant.components.media_player import ( from homeassistant.components.media_player import (
MediaPlayerDeviceClass, MediaPlayerDeviceClass,
@ -130,25 +131,26 @@ class RussoundZoneDevice(RussoundBaseEntity, MediaPlayerEntity):
self._attr_name = zone.name self._attr_name = zone.name
self._attr_unique_id = f"{self._primary_mac_address}-{zone.device_str()}" self._attr_unique_id = f"{self._primary_mac_address}-{zone.device_str()}"
for flag, feature in MP_FEATURES_BY_FLAG.items(): 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 self._attr_supported_features |= feature
def _callback_handler(self, device_str, *args): async def _state_update_callback(
if ( self, _client: RussoundClient, _callback_type: CallbackType
device_str == self._zone.device_str() ) -> None:
or device_str == self._current_source().device_str() """Call when the device is notified of changes."""
): self.async_write_ha_state()
self.schedule_update_ha_state()
async def async_added_to_hass(self) -> None: async def async_added_to_hass(self) -> None:
"""Register callback handlers.""" """Register callback handlers."""
await super().async_added_to_hass() 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: async def async_will_remove_from_hass(self) -> None:
"""Remove callbacks.""" """Remove callbacks."""
await super().async_will_remove_from_hass() 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: def _current_source(self) -> Source:
return self._zone.fetch_current_source() return self._zone.fetch_current_source()

View File

@ -356,7 +356,7 @@ aioridwell==2024.01.0
aioruckus==0.41 aioruckus==0.41
# homeassistant.components.russound_rio # homeassistant.components.russound_rio
aiorussound==3.0.5 aiorussound==3.1.5
# homeassistant.components.ruuvi_gateway # homeassistant.components.ruuvi_gateway
aioruuvigateway==0.1.0 aioruuvigateway==0.1.0

View File

@ -338,7 +338,7 @@ aioridwell==2024.01.0
aioruckus==0.41 aioruckus==0.41
# homeassistant.components.russound_rio # homeassistant.components.russound_rio
aiorussound==3.0.5 aiorussound==3.1.5
# homeassistant.components.ruuvi_gateway # homeassistant.components.ruuvi_gateway
aioruuvigateway==0.1.0 aioruuvigateway==0.1.0