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 authored and Paulus Schoutsen committed 2019-10-04 08:41:47 -07:00
1 parent f169e84d21
commit 9a5c1fbaed
8 files changed
+337 -2

No files matched your search

@@ -8,6 +8,11 @@ from homeassistant.const import (
STATE_UNLOCKED,
STATE_UNKNOWN,
STATE_UNAVAILABLE,
STATE_ALARM_DISARMED,
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_CUSTOM_BYPASS,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARMED_NIGHT,
)
from homeassistant.components.climate import const as climate
from homeassistant.components.alexa import smart_home
@@ -527,3 +532,33 @@ async def test_temperature_sensor_climate(hass):
properties.assert_equal(
"Alexa.TemperatureSensor", "temperature", {"value": 34.0, "scale": "CELSIUS"}
)
async def test_report_alarm_control_panel_state(hass):
"""Test SecurityPanelController implements armState property."""
hass.states.async_set("alarm_control_panel.armed_away", STATE_ALARM_ARMED_AWAY, {})
hass.states.async_set(
"alarm_control_panel.armed_custom_bypass", STATE_ALARM_ARMED_CUSTOM_BYPASS, {}
)
hass.states.async_set("alarm_control_panel.armed_home", STATE_ALARM_ARMED_HOME, {})
hass.states.async_set(
"alarm_control_panel.armed_night", STATE_ALARM_ARMED_NIGHT, {}
)
hass.states.async_set("alarm_control_panel.disarmed", STATE_ALARM_DISARMED, {})
properties = await reported_properties(hass, "alarm_control_panel.armed_away")
properties.assert_equal("Alexa.SecurityPanelController", "armState", "ARMED_AWAY")
properties = await reported_properties(
hass, "alarm_control_panel.armed_custom_bypass"
)
properties.assert_equal("Alexa.SecurityPanelController", "armState", "ARMED_STAY")
properties = await reported_properties(hass, "alarm_control_panel.armed_home")
properties.assert_equal("Alexa.SecurityPanelController", "armState", "ARMED_STAY")
properties = await reported_properties(hass, "alarm_control_panel.armed_night")
properties.assert_equal("Alexa.SecurityPanelController", "armState", "ARMED_NIGHT")
properties = await reported_properties(hass, "alarm_control_panel.disarmed")
properties.assert_equal("Alexa.SecurityPanelController", "armState", "DISARMED")