Remove AlexaPowerController from device_class garage covers in… (#32607)

pull/32596/head
ochlocracy 2020-03-09 11:25:33 -04:00 committed by GitHub
parent c0c5c33b20
commit fa4f27f78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 16 deletions

View File

@ -400,7 +400,10 @@ class CoverCapabilities(AlexaEntity):
def interfaces(self):
"""Yield the supported interfaces."""
yield AlexaPowerController(self.entity)
device_class = self.entity.attributes.get(ATTR_DEVICE_CLASS)
if device_class != cover.DEVICE_CLASS_GARAGE:
yield AlexaPowerController(self.entity)
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
if supported & cover.SUPPORT_SET_POSITION:
yield AlexaRangeController(

View File

@ -2592,33 +2592,25 @@ async def test_mode_unsupported_domain(hass):
assert msg["payload"]["type"] == "INVALID_DIRECTIVE"
async def test_cover(hass):
"""Test garage cover discovery and powerController."""
async def test_cover_garage_door(hass):
"""Test garage door cover discovery."""
device = (
"cover.test",
"cover.test_garage_door",
"off",
{
"friendly_name": "Test cover",
"friendly_name": "Test cover garage door",
"supported_features": 3,
"device_class": "garage",
},
)
appliance = await discovery_test(device, hass)
assert appliance["endpointId"] == "cover#test"
assert appliance["endpointId"] == "cover#test_garage_door"
assert appliance["displayCategories"][0] == "GARAGE_DOOR"
assert appliance["friendlyName"] == "Test cover"
assert appliance["friendlyName"] == "Test cover garage door"
assert_endpoint_capabilities(
appliance,
"Alexa.ModeController",
"Alexa.PowerController",
"Alexa.EndpointHealth",
"Alexa",
)
await assert_power_controller_works(
"cover#test", "cover.open_cover", "cover.close_cover", hass
appliance, "Alexa.ModeController", "Alexa.EndpointHealth", "Alexa"
)