Improve Alexa interface selection for binary sensors (#29120)

* Improve Alexa interface selection for binary sensors

This allows the sensor to work correctly as a contact or motion sensor
in alexa, if the user overrides its display category as such.

* add tests
This commit is contained in:
Abílio Costa 2019-12-03 00:02:17 +00:00 committed by Paulus Schoutsen
parent 9160d43a08
commit 9811d63d78
3 changed files with 67 additions and 1 deletions

View file

@ -543,6 +543,10 @@ class BinarySensorCapabilities(AlexaEntity):
if CONF_DISPLAY_CATEGORIES in entity_conf:
if entity_conf[CONF_DISPLAY_CATEGORIES] == DisplayCategory.DOORBELL:
yield AlexaDoorbellEventSource(self.entity)
elif entity_conf[CONF_DISPLAY_CATEGORIES] == DisplayCategory.CONTACT_SENSOR:
yield AlexaContactSensor(self.hass, self.entity)
elif entity_conf[CONF_DISPLAY_CATEGORIES] == DisplayCategory.MOTION_SENSOR:
yield AlexaMotionSensor(self.hass, self.entity)
yield AlexaEndpointHealth(self.hass, self.entity)
yield Alexa(self.hass)