Merge pull request #736 from Mosibi/mpd-add-state_on

Added support for MPD to start playing the current song/playlist
pull/732/head
Paulus Schoutsen 2015-12-12 12:06:38 -08:00
commit 9fc0d93e44
1 changed files with 7 additions and 3 deletions

View File

@ -21,14 +21,14 @@ from homeassistant.const import (
from homeassistant.components.media_player import (
MediaPlayerDevice,
SUPPORT_PAUSE, SUPPORT_VOLUME_SET, SUPPORT_TURN_OFF,
SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK,
SUPPORT_TURN_ON, SUPPORT_PREVIOUS_TRACK, SUPPORT_NEXT_TRACK,
MEDIA_TYPE_MUSIC)
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['python-mpd2==0.5.4']
SUPPORT_MPD = SUPPORT_PAUSE | SUPPORT_VOLUME_SET | SUPPORT_TURN_OFF | \
SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK
SUPPORT_TURN_ON | SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK
# pylint: disable=unused-argument
@ -163,9 +163,13 @@ class MpdDevice(MediaPlayerDevice):
return SUPPORT_MPD
def turn_off(self):
""" Service to exit the running MPD. """
""" Service to send the MPD the command to stop playing. """
self.client.stop()
def turn_on(self):
""" Service to send the MPD the command to start playing. """
self.client.play()
def set_volume_level(self, volume):
""" Sets volume """
self.client.setvol(int(volume * 100))