From fa4f27f78e004ae92ab452d57242e2630393e684 Mon Sep 17 00:00:00 2001 From: ochlocracy <5885236+ochlocracy@users.noreply.github.com> Date: Mon, 9 Mar 2020 11:25:33 -0400 Subject: [PATCH] =?UTF-8?q?Remove=20AlexaPowerController=20from=20device?= =?UTF-8?q?=5Fclass=20garage=20covers=20in=E2=80=A6=20(#32607)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homeassistant/components/alexa/entities.py | 5 ++++- tests/components/alexa/test_smart_home.py | 22 +++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/alexa/entities.py b/homeassistant/components/alexa/entities.py index b10f11e2bbc..f7b9af4c8fe 100644 --- a/homeassistant/components/alexa/entities.py +++ b/homeassistant/components/alexa/entities.py @@ -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( diff --git a/tests/components/alexa/test_smart_home.py b/tests/components/alexa/test_smart_home.py index a714b69461c..6190403f20e 100644 --- a/tests/components/alexa/test_smart_home.py +++ b/tests/components/alexa/test_smart_home.py @@ -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" )