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,
) -> 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
@ -60,9 +60,9 @@ class RussoundBaseEntity(Entity):
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"] = (
@ -82,12 +82,12 @@ class RussoundBaseEntity(Entity):
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
)

View file

@ -7,5 +7,5 @@
"iot_class": "local_push",
"loggers": ["aiorussound"],
"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
from aiorussound import Source, Zone
from aiorussound import RussoundClient, Source, Zone
from aiorussound.models import CallbackType
from homeassistant.components.media_player import (
MediaPlayerDeviceClass,
@ -130,25 +131,26 @@ class RussoundZoneDevice(RussoundBaseEntity, MediaPlayerEntity):
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()

View file

@ -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

View file

@ -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