Added active_child attribute to universal media players.

The entity of the first active child is now reported in the attributes
for a universal media player.
This commit is contained in:
Ryan Kraus 2016-01-10 00:43:27 -05:00 committed by Paulus Schoutsen
parent ec85884d92
commit 20a1025a8c

View File

@ -31,6 +31,8 @@ from homeassistant.components.media_player import (
ATTR_MEDIA_PLAYLIST, ATTR_APP_ID, ATTR_APP_NAME, ATTR_MEDIA_VOLUME_LEVEL, ATTR_MEDIA_PLAYLIST, ATTR_APP_ID, ATTR_APP_NAME, ATTR_MEDIA_VOLUME_LEVEL,
ATTR_MEDIA_SEEK_POSITION) ATTR_MEDIA_SEEK_POSITION)
ATTR_ACTIVE_CHILD = 'active_child'
CONF_ATTRS = 'attributes' CONF_ATTRS = 'attributes'
CONF_CHILDREN = 'children' CONF_CHILDREN = 'children'
CONF_COMMANDS = 'commands' CONF_COMMANDS = 'commands'
@ -38,6 +40,7 @@ CONF_PLATFORM = 'platform'
CONF_SERVICE = 'service' CONF_SERVICE = 'service'
CONF_SERVICE_DATA = 'service_data' CONF_SERVICE_DATA = 'service_data'
CONF_STATE = 'state' CONF_STATE = 'state'
OFF_STATES = [STATE_IDLE, STATE_OFF] OFF_STATES = [STATE_IDLE, STATE_OFF]
REQUIREMENTS = [] REQUIREMENTS = []
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -338,11 +341,10 @@ class UniversalMediaPlayer(MediaPlayerDevice):
@property @property
def device_state_attributes(self): def device_state_attributes(self):
""" """ Extra attributes a device wants to expose. """
Extra attributes a device wants to expose. active_child = self.active_child_state
Not supported for Universal Media Player. return {ATTR_ACTIVE_CHILD: active_child.entity_id} \
""" if active_child else {}
return None
def turn_on(self): def turn_on(self):
""" turn the media player on. """ """ turn the media player on. """