Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions homeassistant/components/vlc_telnet/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
SUPPORT_STOP,
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP,
Comment thread
MartinHjelmare marked this conversation as resolved.
Outdated
)
from homeassistant.const import (
CONF_HOST,
Expand All @@ -46,17 +47,18 @@
MAX_VOLUME = 500

SUPPORT_VLC = (
SUPPORT_PAUSE
| SUPPORT_SEEK
| SUPPORT_VOLUME_SET
| SUPPORT_VOLUME_MUTE
| SUPPORT_PREVIOUS_TRACK
SUPPORT_CLEAR_PLAYLIST
Comment thread
MartinHjelmare marked this conversation as resolved.
| SUPPORT_NEXT_TRACK
| SUPPORT_PLAY_MEDIA
| SUPPORT_STOP
| SUPPORT_CLEAR_PLAYLIST
| SUPPORT_PAUSE
| SUPPORT_PLAY
| SUPPORT_PLAY_MEDIA
| SUPPORT_PREVIOUS_TRACK
| SUPPORT_SEEK
| SUPPORT_SHUFFLE_SET
| SUPPORT_STOP
| SUPPORT_VOLUME_MUTE
| SUPPORT_VOLUME_SET
| SUPPORT_VOLUME_STEP
)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
Expand Down Expand Up @@ -238,6 +240,26 @@ def set_volume_level(self, volume):
self._vlc.set_volume(volume * MAX_VOLUME)
self._volume = volume

def volume_up(self):
Comment thread
dmcc marked this conversation as resolved.
Outdated
"""Service to send VLC the command for volume up."""
if self._volume is None:
return

current_volume = self._volume
if current_volume < 1.0:
new_volume = min(current_volume + 0.05, 1.0)
self.set_volume_level(new_volume)

def volume_down(self):
"""Service to send VLC the command for volume down."""
if self._volume is None:
return

current_volume = self._volume
if current_volume > 0:
new_volume = max(current_volume - 0.05, 0)
self.set_volume_level(new_volume)

def media_play(self):
"""Send play command."""
self._vlc.play()
Expand Down