Bump yoto-api to 4.0.2 (#173238)

This commit is contained in:
Paul Bottein
2026-06-07 22:07:36 -04:00
committed by GitHub
parent 35cb7c6147
commit d7673a08c8
7 changed files with 10 additions and 12 deletions
+1 -1
View File
@@ -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."""
+1 -1
View File
@@ -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:
+1 -1
View File
@@ -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
+1 -3
View File
@@ -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,
+4 -4
View File
@@ -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(
+1 -1
View File
@@ -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)