mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +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
|
@catch_vlc_errors
|
||||||
async def async_media_play(self) -> None:
|
async def async_media_play(self) -> None:
|
||||||
"""Send play command."""
|
"""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
|
self._attr_state = MediaPlayerState.PLAYING
|
||||||
|
|
||||||
@catch_vlc_errors
|
@catch_vlc_errors
|
||||||
@ -268,8 +273,7 @@ class VlcDevice(MediaPlayerEntity):
|
|||||||
"""Send pause command."""
|
"""Send pause command."""
|
||||||
status = await self._vlc.status()
|
status = await self._vlc.status()
|
||||||
if status.state != "paused":
|
if status.state != "paused":
|
||||||
# Make sure we're not already paused since VLCTelnet.pause() toggles
|
# Make sure we're not already paused as pausing again will unpause.
|
||||||
# pause.
|
|
||||||
await self._vlc.pause()
|
await self._vlc.pause()
|
||||||
|
|
||||||
self._attr_state = MediaPlayerState.PAUSED
|
self._attr_state = MediaPlayerState.PAUSED
|
||||||
|
@ -15,8 +15,6 @@ from homeassistant.data_entry_flow import FlowResultType
|
|||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
# mypy: allow-untyped-calls
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"input_data, entry_data",
|
"input_data, entry_data",
|
||||||
@ -139,7 +137,7 @@ async def test_errors(
|
|||||||
|
|
||||||
async def test_reauth_flow(hass: HomeAssistant) -> None:
|
async def test_reauth_flow(hass: HomeAssistant) -> None:
|
||||||
"""Test successful reauth flow."""
|
"""Test successful reauth flow."""
|
||||||
entry_data = {
|
entry_data: dict[str, Any] = {
|
||||||
"password": "old-password",
|
"password": "old-password",
|
||||||
"host": "1.1.1.1",
|
"host": "1.1.1.1",
|
||||||
"port": 8888,
|
"port": 8888,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user