Support setting explicit mute value for Panasonic Viera TV (#13954)

* Use module's methods instead of API calls

* Use module's methods instead of API calls for media commands
This commit is contained in:
blackwind 2018-05-01 12:41:36 -06:00 committed by Paulus Schoutsen
parent b00f771541
commit bf53cbe08d

View File

@ -138,20 +138,20 @@ class PanasonicVieraTVDevice(MediaPlayerDevice):
def turn_off(self):
"""Turn off media player."""
if self._state != STATE_OFF:
self.send_key('NRC_POWER-ONOFF')
self._remote.turn_off()
self._state = STATE_OFF
def volume_up(self):
"""Volume up the media player."""
self.send_key('NRC_VOLUP-ONOFF')
self._remote.volume_up()
def volume_down(self):
"""Volume down media player."""
self.send_key('NRC_VOLDOWN-ONOFF')
self._remote.volume_down()
def mute_volume(self, mute):
"""Send mute command."""
self.send_key('NRC_MUTE-ONOFF')
self._remote.set_mute(mute)
def set_volume_level(self, volume):
"""Set volume level, range 0..1."""
@ -172,20 +172,20 @@ class PanasonicVieraTVDevice(MediaPlayerDevice):
def media_play(self):
"""Send play command."""
self._playing = True
self.send_key('NRC_PLAY-ONOFF')
self._remote.media_play()
def media_pause(self):
"""Send media pause command to media player."""
self._playing = False
self.send_key('NRC_PAUSE-ONOFF')
self._remote.media_pause()
def media_next_track(self):
"""Send next track command."""
self.send_key('NRC_FF-ONOFF')
self._remote.media_next_track()
def media_previous_track(self):
"""Send the previous track command."""
self.send_key('NRC_REW-ONOFF')
self._remote.media_previous_track()
def play_media(self, media_type, media_id, **kwargs):
"""Play media."""