mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Support VLC 4 pause (#77302)
* Support VLC 4 pause * Clean vlc tests types
This commit is contained in:
parent
fc62ba58a6
commit
2a94c42cea
@ -260,7 +260,12 @@ class VlcDevice(MediaPlayerEntity):
|
||||
@catch_vlc_errors
|
||||
async def async_media_play(self) -> None:
|
||||
"""Send play command."""
|
||||
await self._vlc.play()
|
||||
status = await self._vlc.status()
|
||||
if status.state == "paused":
|
||||
# If already paused, play by toggling pause.
|
||||
await self._vlc.pause()
|
||||
else:
|
||||
await self._vlc.play()
|
||||
self._attr_state = MediaPlayerState.PLAYING
|
||||
|
||||
@catch_vlc_errors
|
||||
@ -268,8 +273,7 @@ class VlcDevice(MediaPlayerEntity):
|
||||
"""Send pause command."""
|
||||
status = await self._vlc.status()
|
||||
if status.state != "paused":
|
||||
# Make sure we're not already paused since VLCTelnet.pause() toggles
|
||||
# pause.
|
||||
# Make sure we're not already paused as pausing again will unpause.
|
||||
await self._vlc.pause()
|
||||
|
||||
self._attr_state = MediaPlayerState.PAUSED
|
||||
|
@ -15,8 +15,6 @@ from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
# mypy: allow-untyped-calls
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"input_data, entry_data",
|
||||
@ -139,7 +137,7 @@ async def test_errors(
|
||||
|
||||
async def test_reauth_flow(hass: HomeAssistant) -> None:
|
||||
"""Test successful reauth flow."""
|
||||
entry_data = {
|
||||
entry_data: dict[str, Any] = {
|
||||
"password": "old-password",
|
||||
"host": "1.1.1.1",
|
||||
"port": 8888,
|
||||
|
Loading…
x
Reference in New Issue
Block a user