Yield PowerController only is supported.

This commit is contained in:
ochlocracy 2020-02-03 13:45:35 -05:00
parent 0287ffc202
commit c0dbf7e4f4

View file

@ -503,9 +503,13 @@ class MediaPlayerCapabilities(AlexaEntity):
def interfaces(self):
"""Yield the supported interfaces."""
yield AlexaPowerController(self.entity)
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
if supported & (
media_player.const.SUPPORT_TURN_OFF | media_player.const.SUPPORT_TURN_ON
):
yield AlexaPowerController(self.entity)
if supported & media_player.const.SUPPORT_VOLUME_SET:
yield AlexaSpeaker(self.entity)
elif supported & media_player.const.SUPPORT_VOLUME_STEP: