mirror of
https://github.com/home-assistant/core.git
synced 2025-06-08 15:17:07 +00:00
Onkyo: SUPPORT_VOLUME_STEP (#14299)
This commit is contained in:
parent
b9e893184a
commit
2e8eaf40f7
@ -13,7 +13,8 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET,
|
SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET,
|
||||||
SUPPORT_SELECT_SOURCE, SUPPORT_PLAY, MediaPlayerDevice, PLATFORM_SCHEMA)
|
SUPPORT_VOLUME_STEP, SUPPORT_SELECT_SOURCE, SUPPORT_PLAY,
|
||||||
|
MediaPlayerDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import (STATE_OFF, STATE_ON, CONF_HOST, CONF_NAME)
|
from homeassistant.const import (STATE_OFF, STATE_ON, CONF_HOST, CONF_NAME)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
@ -29,7 +30,8 @@ DEFAULT_NAME = 'Onkyo Receiver'
|
|||||||
SUPPORTED_MAX_VOLUME = 80
|
SUPPORTED_MAX_VOLUME = 80
|
||||||
|
|
||||||
SUPPORT_ONKYO = SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
SUPPORT_ONKYO = SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
||||||
SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_SELECT_SOURCE | SUPPORT_PLAY
|
SUPPORT_VOLUME_STEP | SUPPORT_TURN_ON | SUPPORT_TURN_OFF | \
|
||||||
|
SUPPORT_SELECT_SOURCE | SUPPORT_PLAY
|
||||||
|
|
||||||
KNOWN_HOSTS = [] # type: List[str]
|
KNOWN_HOSTS = [] # type: List[str]
|
||||||
DEFAULT_SOURCES = {'tv': 'TV', 'bd': 'Bluray', 'game': 'Game', 'aux1': 'Aux1',
|
DEFAULT_SOURCES = {'tv': 'TV', 'bd': 'Bluray', 'game': 'Game', 'aux1': 'Aux1',
|
||||||
@ -199,6 +201,14 @@ class OnkyoDevice(MediaPlayerDevice):
|
|||||||
"""
|
"""
|
||||||
self.command('volume {}'.format(int(volume * self._max_volume)))
|
self.command('volume {}'.format(int(volume * self._max_volume)))
|
||||||
|
|
||||||
|
def volume_up(self):
|
||||||
|
"""Increase volume by 1 step."""
|
||||||
|
self.command('volume level-up')
|
||||||
|
|
||||||
|
def volume_down(self):
|
||||||
|
"""Decrease volume by 1 step."""
|
||||||
|
self.command('volume level-down')
|
||||||
|
|
||||||
def mute_volume(self, mute):
|
def mute_volume(self, mute):
|
||||||
"""Mute (true) or unmute (false) media player."""
|
"""Mute (true) or unmute (false) media player."""
|
||||||
if mute:
|
if mute:
|
||||||
@ -264,6 +274,14 @@ class OnkyoDeviceZone2(OnkyoDevice):
|
|||||||
"""Set volume level, input is range 0..1. Onkyo ranges from 1-80."""
|
"""Set volume level, input is range 0..1. Onkyo ranges from 1-80."""
|
||||||
self.command('zone2.volume={}'.format(int(volume*80)))
|
self.command('zone2.volume={}'.format(int(volume*80)))
|
||||||
|
|
||||||
|
def volume_up(self):
|
||||||
|
"""Increase volume by 1 step."""
|
||||||
|
self.command('zone2.volume=level-up')
|
||||||
|
|
||||||
|
def volume_down(self):
|
||||||
|
"""Decrease volume by 1 step."""
|
||||||
|
self.command('zone2.volume=level-down')
|
||||||
|
|
||||||
def mute_volume(self, mute):
|
def mute_volume(self, mute):
|
||||||
"""Mute (true) or unmute (false) media player."""
|
"""Mute (true) or unmute (false) media player."""
|
||||||
if mute:
|
if mute:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user