mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Bump aiorussound to 4.1.0 (#130382)
This commit is contained in:
parent
313309a7e0
commit
e97a5f927c
@ -17,7 +17,7 @@ RUSSOUND_RIO_EXCEPTIONS = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
CONNECT_TIMEOUT = 5
|
CONNECT_TIMEOUT = 15
|
||||||
|
|
||||||
MP_FEATURES_BY_FLAG = {
|
MP_FEATURES_BY_FLAG = {
|
||||||
FeatureFlag.COMMANDS_ZONE_MUTE_OFF_ON: MediaPlayerEntityFeature.VOLUME_MUTE
|
FeatureFlag.COMMANDS_ZONE_MUTE_OFF_ON: MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["aiorussound"],
|
"loggers": ["aiorussound"],
|
||||||
"quality_scale": "silver",
|
"quality_scale": "silver",
|
||||||
"requirements": ["aiorussound==4.0.5"]
|
"requirements": ["aiorussound==4.1.0"]
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aiorussound import Controller
|
from aiorussound import Controller
|
||||||
from aiorussound.models import Source
|
from aiorussound.models import PlayStatus, Source
|
||||||
from aiorussound.rio import ZoneControlSurface
|
from aiorussound.rio import ZoneControlSurface
|
||||||
|
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
@ -132,20 +132,18 @@ class RussoundZoneDevice(RussoundBaseEntity, MediaPlayerEntity):
|
|||||||
def state(self) -> MediaPlayerState | None:
|
def state(self) -> MediaPlayerState | None:
|
||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
status = self._zone.status
|
status = self._zone.status
|
||||||
mode = self._source.mode
|
play_status = self._source.play_status
|
||||||
if status == "ON":
|
if not status:
|
||||||
if mode == "playing":
|
return MediaPlayerState.OFF
|
||||||
|
if play_status == PlayStatus.PLAYING:
|
||||||
return MediaPlayerState.PLAYING
|
return MediaPlayerState.PLAYING
|
||||||
if mode == "paused":
|
if play_status == PlayStatus.PAUSED:
|
||||||
return MediaPlayerState.PAUSED
|
return MediaPlayerState.PAUSED
|
||||||
if mode == "transitioning":
|
if play_status == PlayStatus.TRANSITIONING:
|
||||||
return MediaPlayerState.BUFFERING
|
return MediaPlayerState.BUFFERING
|
||||||
if mode == "stopped":
|
if play_status == PlayStatus.STOPPED:
|
||||||
return MediaPlayerState.IDLE
|
return MediaPlayerState.IDLE
|
||||||
return MediaPlayerState.ON
|
return MediaPlayerState.ON
|
||||||
if status == "OFF":
|
|
||||||
return MediaPlayerState.OFF
|
|
||||||
return None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source(self):
|
def source(self):
|
||||||
@ -184,7 +182,7 @@ class RussoundZoneDevice(RussoundBaseEntity, MediaPlayerEntity):
|
|||||||
Value is returned based on a range (0..50).
|
Value is returned based on a range (0..50).
|
||||||
Therefore float divide by 50 to get to the required range.
|
Therefore float divide by 50 to get to the required range.
|
||||||
"""
|
"""
|
||||||
return float(self._zone.volume or "0") / 50.0
|
return self._zone.volume / 50.0
|
||||||
|
|
||||||
@command
|
@command
|
||||||
async def async_turn_off(self) -> None:
|
async def async_turn_off(self) -> None:
|
||||||
|
@ -357,7 +357,7 @@ aioridwell==2024.01.0
|
|||||||
aioruckus==0.41
|
aioruckus==0.41
|
||||||
|
|
||||||
# homeassistant.components.russound_rio
|
# homeassistant.components.russound_rio
|
||||||
aiorussound==4.0.5
|
aiorussound==4.1.0
|
||||||
|
|
||||||
# homeassistant.components.ruuvi_gateway
|
# homeassistant.components.ruuvi_gateway
|
||||||
aioruuvigateway==0.1.0
|
aioruuvigateway==0.1.0
|
||||||
|
@ -339,7 +339,7 @@ aioridwell==2024.01.0
|
|||||||
aioruckus==0.41
|
aioruckus==0.41
|
||||||
|
|
||||||
# homeassistant.components.russound_rio
|
# homeassistant.components.russound_rio
|
||||||
aiorussound==4.0.5
|
aiorussound==4.1.0
|
||||||
|
|
||||||
# homeassistant.components.ruuvi_gateway
|
# homeassistant.components.ruuvi_gateway
|
||||||
aioruuvigateway==0.1.0
|
aioruuvigateway==0.1.0
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
from aiorussound.models import CallbackType
|
from aiorussound.models import CallbackType, PlayStatus
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@ -28,29 +28,29 @@ async def mock_state_update(client: AsyncMock) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("zone_status", "source_mode", "media_player_state"),
|
("zone_status", "source_play_status", "media_player_state"),
|
||||||
[
|
[
|
||||||
("ON", None, STATE_ON),
|
(True, None, STATE_ON),
|
||||||
("ON", "playing", STATE_PLAYING),
|
(True, PlayStatus.PLAYING, STATE_PLAYING),
|
||||||
("ON", "paused", STATE_PAUSED),
|
(True, PlayStatus.PAUSED, STATE_PAUSED),
|
||||||
("ON", "transitioning", STATE_BUFFERING),
|
(True, PlayStatus.TRANSITIONING, STATE_BUFFERING),
|
||||||
("ON", "stopped", STATE_IDLE),
|
(True, PlayStatus.STOPPED, STATE_IDLE),
|
||||||
("OFF", None, STATE_OFF),
|
(False, None, STATE_OFF),
|
||||||
("OFF", "stopped", STATE_OFF),
|
(False, PlayStatus.STOPPED, STATE_OFF),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_entity_state(
|
async def test_entity_state(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mock_russound_client: AsyncMock,
|
mock_russound_client: AsyncMock,
|
||||||
mock_config_entry: MockConfigEntry,
|
mock_config_entry: MockConfigEntry,
|
||||||
zone_status: str,
|
zone_status: bool,
|
||||||
source_mode: str | None,
|
source_play_status: PlayStatus | None,
|
||||||
media_player_state: str,
|
media_player_state: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test media player state."""
|
"""Test media player state."""
|
||||||
await setup_integration(hass, mock_config_entry)
|
await setup_integration(hass, mock_config_entry)
|
||||||
mock_russound_client.controllers[1].zones[1].status = zone_status
|
mock_russound_client.controllers[1].zones[1].status = zone_status
|
||||||
mock_russound_client.sources[1].mode = source_mode
|
mock_russound_client.sources[1].play_status = source_play_status
|
||||||
await mock_state_update(mock_russound_client)
|
await mock_state_update(mock_russound_client)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user