Remove Alexa.InputController from devices without supported inputs in Alexa (#31450)

* Yield Alexa.InputController only for supported inputs.

* Add Comment.

* Comment fix.
This commit is contained in:
ochlocracy 2020-02-03 19:19:40 -05:00 committed by GitHub
parent 119566f280
commit 4602d7370c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 2 deletions

View file

@ -526,7 +526,13 @@ class MediaPlayerCapabilities(AlexaEntity):
yield AlexaSeekController(self.entity)
if supported & media_player.SUPPORT_SELECT_SOURCE:
yield AlexaInputController(self.entity)
inputs = AlexaInputController.get_valid_inputs(
self.entity.attributes.get(
media_player.const.ATTR_INPUT_SOURCE_LIST, []
)
)
if len(inputs) > 0:
yield AlexaInputController(self.entity)
if supported & media_player.const.SUPPORT_PLAY_MEDIA:
yield AlexaChannelController(self.entity)