If volume disabled do not enable support (#28635)

This commit is contained in:
Barry Williams 2019-11-26 06:34:45 +00:00 committed by Paulus Schoutsen
parent 1f72de108c
commit afaa464142
3 changed files with 10 additions and 14 deletions

View file

@ -2,9 +2,7 @@
"domain": "openhome", "domain": "openhome",
"name": "Openhome", "name": "Openhome",
"documentation": "https://www.home-assistant.io/integrations/openhome", "documentation": "https://www.home-assistant.io/integrations/openhome",
"requirements": [ "requirements": ["openhomedevice==0.6.3"],
"openhomedevice==0.4.2"
],
"dependencies": [], "dependencies": [],
"codeowners": [] "codeowners": []
} }

View file

@ -17,14 +17,7 @@ from homeassistant.components.media_player.const import (
) )
from homeassistant.const import STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING from homeassistant.const import STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING
SUPPORT_OPENHOME = ( SUPPORT_OPENHOME = SUPPORT_SELECT_SOURCE | SUPPORT_TURN_OFF | SUPPORT_TURN_ON
SUPPORT_SELECT_SOURCE
| SUPPORT_VOLUME_STEP
| SUPPORT_VOLUME_MUTE
| SUPPORT_VOLUME_SET
| SUPPORT_TURN_OFF
| SUPPORT_TURN_ON
)
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -79,14 +72,19 @@ class OpenhomeDevice(MediaPlayerDevice):
self._in_standby = self._device.IsInStandby() self._in_standby = self._device.IsInStandby()
self._transport_state = self._device.TransportState() self._transport_state = self._device.TransportState()
self._track_information = self._device.TrackInfo() self._track_information = self._device.TrackInfo()
self._volume_level = self._device.VolumeLevel()
self._volume_muted = self._device.IsMuted()
self._source = self._device.Source() self._source = self._device.Source()
self._name = self._device.Room().decode("utf-8") self._name = self._device.Room().decode("utf-8")
self._supported_features = SUPPORT_OPENHOME self._supported_features = SUPPORT_OPENHOME
source_index = {} source_index = {}
source_names = list() source_names = list()
if self._device.VolumeEnabled():
self._supported_features |= (
SUPPORT_VOLUME_STEP | SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET
)
self._volume_level = self._device.VolumeLevel()
self._volume_muted = self._device.IsMuted()
for source in self._device.Sources(): for source in self._device.Sources():
source_names.append(source["name"]) source_names.append(source["name"])
source_index[source["name"]] = source["index"] source_index[source["name"]] = source["index"]

View file

@ -921,7 +921,7 @@ onvif-zeep-async==0.2.0
openevsewifi==0.4 openevsewifi==0.4
# homeassistant.components.openhome # homeassistant.components.openhome
openhomedevice==0.4.2 openhomedevice==0.6.3
# homeassistant.components.opensensemap # homeassistant.components.opensensemap
opensensemap-api==0.1.5 opensensemap-api==0.1.5