1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add SecurityPanelController for alarm_control_panel to alexa (#27081)

* Implemented Alexa.SecurityPanelController Interface for alarm_control_panel
https://developer.amazon.com/docs/device-apis/alexa-securitypanelcontroller.html

* Implemented Tests for Alexa.SecurityPanelController Interface for alarm_control_panel

* Added additional AuthorizationRequired error handling

* Removed optional exitDelayInSeconds

* Updating elif to if to please pylint

* Adding self to code owners.

* Adding self to code owners.

* Added AlexaEndpointHealth Interface to alarm_control_panel entities.

* Added additional entity tests.

* Code reformatted with Black.

* Updated alexa alarm_control_panel tests for more coverage.

* Updated alexa alarm_control_panel tests for more coverage. Fixed Test.

* Adding self to code owners.
This commit is contained in:
ochlocracy
2019-10-04 11:41:47 -04:00
committed by Paulus Schoutsen
parent f169e84d21
commit 9a5c1fbaed
8 changed files with 337 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ from homeassistant.const import (
from homeassistant.util.decorator import Registry
from homeassistant.components.climate import const as climate
from homeassistant.components import (
alarm_control_panel,
alert,
automation,
binary_sensor,
@@ -45,6 +46,7 @@ from .capabilities import (
AlexaPowerController,
AlexaPowerLevelController,
AlexaSceneController,
AlexaSecurityPanelController,
AlexaSpeaker,
AlexaStepSpeaker,
AlexaTemperatureSensor,
@@ -487,3 +489,18 @@ class BinarySensorCapabilities(AlexaEntity):
return self.TYPE_CONTACT
if attrs.get(ATTR_DEVICE_CLASS) == "motion":
return self.TYPE_MOTION
@ENTITY_ADAPTERS.register(alarm_control_panel.DOMAIN)
class AlarmControlPanelCapabilities(AlexaEntity):
"""Class to represent Alarm capabilities."""
def default_display_categories(self):
"""Return the display categories for this entity."""
return [DisplayCategory.SECURITY_PANEL]
def interfaces(self):
"""Yield the supported interfaces."""
if not self.entity.attributes.get("code_arm_required"):
yield AlexaSecurityPanelController(self.hass, self.entity)
yield AlexaEndpointHealth(self.hass, self.entity)