Display Fan entity as Fan category in Alexa ()

* Added Fan to display categories.

* Added Doorbell to display categories.

* Added Microwave to display categories.

* Added Security Panel to display categories.

* Updated FanCapabilities to use FAN display category.

* Updated Tests for FanCapabilities to use FAN display category.
pull/27140/head
ochlocracy 2019-10-02 18:55:01 -04:00 committed by Jason Hu
parent 75bce84ad5
commit 363873dfcb
2 changed files with 15 additions and 3 deletions
homeassistant/components/alexa
tests/components/alexa

View File

@ -76,9 +76,18 @@ class DisplayCategory:
# Indicates a door.
DOOR = "DOOR"
# Indicates a doorbell.
DOOR_BELL = "DOORBELL"
# Indicates a fan.
FAN = "FAN"
# Indicates light sources or fixtures.
LIGHT = "LIGHT"
# Indicates a microwave oven.
MICROWAVE = "MICROWAVE"
# Indicates an endpoint that detects and reports motion.
MOTION_SENSOR = "MOTION_SENSOR"
@ -91,6 +100,9 @@ class DisplayCategory:
# order is unimportant. Applies to Scenes
SCENE_TRIGGER = "SCENE_TRIGGER"
# Indicates a security panel.
SECURITY_PANEL = "SECURITY_PANEL"
# Indicates an endpoint that locks.
SMARTLOCK = "SMARTLOCK"
@ -324,7 +336,7 @@ class FanCapabilities(AlexaEntity):
def default_display_categories(self):
"""Return the display categories for this entity."""
return [DisplayCategory.OTHER]
return [DisplayCategory.FAN]
def interfaces(self):
"""Yield the supported interfaces."""

View File

@ -308,7 +308,7 @@ async def test_fan(hass):
appliance = await discovery_test(device, hass)
assert appliance["endpointId"] == "fan#test_1"
assert appliance["displayCategories"][0] == "OTHER"
assert appliance["displayCategories"][0] == "FAN"
assert appliance["friendlyName"] == "Test fan 1"
assert_endpoint_capabilities(
appliance, "Alexa.PowerController", "Alexa.EndpointHealth"
@ -333,7 +333,7 @@ async def test_variable_fan(hass):
appliance = await discovery_test(device, hass)
assert appliance["endpointId"] == "fan#test_2"
assert appliance["displayCategories"][0] == "OTHER"
assert appliance["displayCategories"][0] == "FAN"
assert appliance["friendlyName"] == "Test fan 2"
assert_endpoint_capabilities(