mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 15:31:52 -05:00
Bump yoto-api to 4.0.2 (#173238)
This commit is contained in:
@@ -131,7 +131,7 @@ class YotoDataUpdateCoordinator(DataUpdateCoordinator[dict[str, YotoPlayer]]):
|
||||
# Fire-and-forget: the data/status response lands via the on_update
|
||||
# callback later, which already triggers async_set_updated_data.
|
||||
for device_id in list(self.client.players):
|
||||
await self.client.request_status_push(device_id)
|
||||
await self.client.request_player_status(device_id)
|
||||
|
||||
def _mqtt_event(self, _player: YotoPlayer) -> None:
|
||||
"""Handle a real-time update pushed by the Yoto MQTT broker."""
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
"iot_class": "cloud_push",
|
||||
"loggers": ["yoto_api"],
|
||||
"quality_scale": "bronze",
|
||||
"requirements": ["yoto-api==3.2.0"]
|
||||
"requirements": ["yoto-api==4.0.2"]
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class YotoMediaPlayer(YotoEntity, MediaPlayerEntity):
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return whether the player is reachable through the Yoto cloud."""
|
||||
return super().available and bool(self.player.status.is_online)
|
||||
return super().available and bool(self.player.is_online)
|
||||
|
||||
@property
|
||||
def state(self) -> MediaPlayerState:
|
||||
|
||||
Generated
+1
-1
@@ -3430,7 +3430,7 @@ yeelightsunflower==0.0.10
|
||||
yolink-api==0.6.5
|
||||
|
||||
# homeassistant.components.yoto
|
||||
yoto-api==3.2.0
|
||||
yoto-api==4.0.2
|
||||
|
||||
# homeassistant.components.youless
|
||||
youless-api==2.2.0
|
||||
|
||||
@@ -15,7 +15,6 @@ from yoto_api import (
|
||||
PlaybackEvent,
|
||||
PlaybackStatus,
|
||||
PlayerInfo,
|
||||
PlayerStatus,
|
||||
Track,
|
||||
YotoPlayer,
|
||||
)
|
||||
@@ -80,16 +79,15 @@ def _build_player() -> YotoPlayer:
|
||||
device_family="v3",
|
||||
generation="gen3",
|
||||
),
|
||||
is_online=True,
|
||||
devices_refreshed_at=now,
|
||||
info_refreshed_at=now,
|
||||
last_event_received_at=now,
|
||||
)
|
||||
player.info = PlayerInfo(
|
||||
device_id=PLAYER_ID,
|
||||
firmware_version="v2.17.5",
|
||||
mac="aa:bb:cc:dd:ee:ff",
|
||||
)
|
||||
player.status = PlayerStatus(device_id=PLAYER_ID, is_online=True)
|
||||
player.last_event = PlaybackEvent(
|
||||
player_id=PLAYER_ID,
|
||||
playback_status=PlaybackStatus.PLAYING,
|
||||
|
||||
@@ -85,13 +85,13 @@ async def test_status_push_tick(
|
||||
"""The status-push timer publishes a request every 60 s."""
|
||||
mock_yoto_client.is_mqtt_connected = True
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
mock_yoto_client.request_status_push.reset_mock()
|
||||
mock_yoto_client.request_player_status.reset_mock()
|
||||
|
||||
freezer.tick(STATUS_PUSH_INTERVAL)
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
mock_yoto_client.request_status_push.assert_called_once_with("player-test")
|
||||
mock_yoto_client.request_player_status.assert_called_once_with("player-test")
|
||||
|
||||
|
||||
async def test_status_push_skipped_when_mqtt_disconnected(
|
||||
@@ -102,14 +102,14 @@ async def test_status_push_skipped_when_mqtt_disconnected(
|
||||
) -> None:
|
||||
"""The status-push timer is a no-op while MQTT is reconnecting."""
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
mock_yoto_client.request_status_push.reset_mock()
|
||||
mock_yoto_client.request_player_status.reset_mock()
|
||||
mock_yoto_client.is_mqtt_connected = False
|
||||
|
||||
freezer.tick(STATUS_PUSH_INTERVAL)
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
mock_yoto_client.request_status_push.assert_not_called()
|
||||
mock_yoto_client.request_player_status.assert_not_called()
|
||||
|
||||
|
||||
async def test_periodic_poll_refreshes_players(
|
||||
|
||||
@@ -145,7 +145,7 @@ async def test_state_unavailable_when_offline(
|
||||
) -> None:
|
||||
"""When the player reports offline the entity is unavailable."""
|
||||
player = next(iter(mock_yoto_client.players.values()))
|
||||
player.status.is_online = False
|
||||
player.is_online = False
|
||||
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user