mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add play, pause, previous and next track to kef (#31373)
* KEF: add support for play, pause, next track, and previous track * bump aiokef to 0.2.7 * run isort * do not dynamically change the supported features
This commit is contained in:
parent
c67f53dc43
commit
3275987f17
@ -4,5 +4,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/kef",
|
||||
"dependencies": [],
|
||||
"codeowners": ["@basnijholt"],
|
||||
"requirements": ["aiokef==0.2.6", "getmac==0.8.1"]
|
||||
"requirements": ["aiokef==0.2.7", "getmac==0.8.1"]
|
||||
}
|
||||
|
@ -11,6 +11,10 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
PLATFORM_SCHEMA,
|
||||
SUPPORT_NEXT_TRACK,
|
||||
SUPPORT_PAUSE,
|
||||
SUPPORT_PLAY,
|
||||
SUPPORT_PREVIOUS_TRACK,
|
||||
SUPPORT_SELECT_SOURCE,
|
||||
SUPPORT_TURN_OFF,
|
||||
SUPPORT_TURN_ON,
|
||||
@ -214,6 +218,10 @@ class KefMediaPlayer(MediaPlayerDevice):
|
||||
| SUPPORT_VOLUME_MUTE
|
||||
| SUPPORT_SELECT_SOURCE
|
||||
| SUPPORT_TURN_OFF
|
||||
| SUPPORT_NEXT_TRACK # only in Bluetooth and Wifi
|
||||
| SUPPORT_PAUSE # only in Bluetooth and Wifi
|
||||
| SUPPORT_PLAY # only in Bluetooth and Wifi
|
||||
| SUPPORT_PREVIOUS_TRACK # only in Bluetooth and Wifi
|
||||
)
|
||||
if self._supports_on:
|
||||
support_kef |= SUPPORT_TURN_ON
|
||||
@ -280,3 +288,19 @@ class KefMediaPlayer(MediaPlayerDevice):
|
||||
await self._speaker.set_source(source)
|
||||
else:
|
||||
raise ValueError(f"Unknown input source: {source}.")
|
||||
|
||||
async def async_media_play(self):
|
||||
"""Send play command."""
|
||||
await self._speaker.play_pause()
|
||||
|
||||
async def async_media_pause(self):
|
||||
"""Send pause command."""
|
||||
await self._speaker.play_pause()
|
||||
|
||||
async def async_media_previous_track(self):
|
||||
"""Send previous track command."""
|
||||
await self._speaker.prev_track()
|
||||
|
||||
async def async_media_next_track(self):
|
||||
"""Send next track command."""
|
||||
await self._speaker.next_track()
|
||||
|
@ -172,7 +172,7 @@ aioimaplib==0.7.15
|
||||
aiokafka==0.5.1
|
||||
|
||||
# homeassistant.components.kef
|
||||
aiokef==0.2.6
|
||||
aiokef==0.2.7
|
||||
|
||||
# homeassistant.components.lifx
|
||||
aiolifx==0.6.7
|
||||
|
Loading…
x
Reference in New Issue
Block a user