diff --git a/homeassistant/components/yoto/coordinator.py b/homeassistant/components/yoto/coordinator.py index d7c64d4930dc..ef555aa48bcd 100644 --- a/homeassistant/components/yoto/coordinator.py +++ b/homeassistant/components/yoto/coordinator.py @@ -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.""" diff --git a/homeassistant/components/yoto/manifest.json b/homeassistant/components/yoto/manifest.json index d86dd751ce90..c84bc1b0cce5 100644 --- a/homeassistant/components/yoto/manifest.json +++ b/homeassistant/components/yoto/manifest.json @@ -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"] } diff --git a/homeassistant/components/yoto/media_player.py b/homeassistant/components/yoto/media_player.py index b3d98f9e817f..5908025f5614 100644 --- a/homeassistant/components/yoto/media_player.py +++ b/homeassistant/components/yoto/media_player.py @@ -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: diff --git a/requirements_all.txt b/requirements_all.txt index b186d664b755..2ddba04effd8 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/tests/components/yoto/conftest.py b/tests/components/yoto/conftest.py index 230a5e394361..49e37d6496be 100644 --- a/tests/components/yoto/conftest.py +++ b/tests/components/yoto/conftest.py @@ -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, diff --git a/tests/components/yoto/test_init.py b/tests/components/yoto/test_init.py index fd718403c1f9..6a4af13fc161 100644 --- a/tests/components/yoto/test_init.py +++ b/tests/components/yoto/test_init.py @@ -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( diff --git a/tests/components/yoto/test_media_player.py b/tests/components/yoto/test_media_player.py index 406ff4a5a64a..fdecace2b935 100644 --- a/tests/components/yoto/test_media_player.py +++ b/tests/components/yoto/test_media_player.py @@ -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)