Add google_assistant alarm_control_panel (#26249)

* add alarm_control_panel to google_assistant

* add cancel arming option

* raise error if requested state is same as current

* rework executing command logic

* Add tests

* fixed tests

* fixed level synonyms
This commit is contained in:
Rami Mosleh 2019-09-25 20:13:31 +03:00 committed by Paulus Schoutsen
parent 4582b6e668
commit d1adb28c6b
5 changed files with 478 additions and 3 deletions

View file

@ -15,6 +15,7 @@ from homeassistant.components import (
sensor,
switch,
vacuum,
alarm_control_panel,
)
DOMAIN = "google_assistant"
@ -48,6 +49,7 @@ DEFAULT_EXPOSED_DOMAINS = [
"lock",
"binary_sensor",
"sensor",
"alarm_control_panel",
]
PREFIX_TYPES = "action.devices.types."
@ -66,6 +68,7 @@ TYPE_SENSOR = PREFIX_TYPES + "SENSOR"
TYPE_DOOR = PREFIX_TYPES + "DOOR"
TYPE_TV = PREFIX_TYPES + "TV"
TYPE_SPEAKER = PREFIX_TYPES + "SPEAKER"
TYPE_ALARM = PREFIX_TYPES + "SECURITYSYSTEM"
SERVICE_REQUEST_SYNC = "request_sync"
HOMEGRAPH_URL = "https://homegraph.googleapis.com/"
@ -81,6 +84,9 @@ ERR_PROTOCOL_ERROR = "protocolError"
ERR_UNKNOWN_ERROR = "unknownError"
ERR_FUNCTION_NOT_SUPPORTED = "functionNotSupported"
ERR_ALREADY_DISARMED = "alreadyDisarmed"
ERR_ALREADY_ARMED = "alreadyArmed"
ERR_CHALLENGE_NEEDED = "challengeNeeded"
ERR_CHALLENGE_NOT_SETUP = "challengeFailedNotSetup"
ERR_TOO_MANY_FAILED_ATTEMPTS = "tooManyFailedAttempts"
@ -106,6 +112,7 @@ DOMAIN_TO_GOOGLE_TYPES = {
script.DOMAIN: TYPE_SCENE,
switch.DOMAIN: TYPE_SWITCH,
vacuum.DOMAIN: TYPE_VACUUM,
alarm_control_panel.DOMAIN: TYPE_ALARM,
}
DEVICE_CLASS_TO_GOOGLE_TYPES = {