Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -16,48 +16,60 @@ from homeassistant.components import (
|
||||
switch,
|
||||
vacuum,
|
||||
)
|
||||
DOMAIN = 'google_assistant'
|
||||
|
||||
GOOGLE_ASSISTANT_API_ENDPOINT = '/api/google_assistant'
|
||||
DOMAIN = "google_assistant"
|
||||
|
||||
CONF_EXPOSE = 'expose'
|
||||
CONF_ENTITY_CONFIG = 'entity_config'
|
||||
CONF_EXPOSE_BY_DEFAULT = 'expose_by_default'
|
||||
CONF_EXPOSED_DOMAINS = 'exposed_domains'
|
||||
CONF_PROJECT_ID = 'project_id'
|
||||
CONF_ALIASES = 'aliases'
|
||||
CONF_API_KEY = 'api_key'
|
||||
CONF_ROOM_HINT = 'room'
|
||||
CONF_ALLOW_UNLOCK = 'allow_unlock'
|
||||
CONF_SECURE_DEVICES_PIN = 'secure_devices_pin'
|
||||
GOOGLE_ASSISTANT_API_ENDPOINT = "/api/google_assistant"
|
||||
|
||||
CONF_EXPOSE = "expose"
|
||||
CONF_ENTITY_CONFIG = "entity_config"
|
||||
CONF_EXPOSE_BY_DEFAULT = "expose_by_default"
|
||||
CONF_EXPOSED_DOMAINS = "exposed_domains"
|
||||
CONF_PROJECT_ID = "project_id"
|
||||
CONF_ALIASES = "aliases"
|
||||
CONF_API_KEY = "api_key"
|
||||
CONF_ROOM_HINT = "room"
|
||||
CONF_ALLOW_UNLOCK = "allow_unlock"
|
||||
CONF_SECURE_DEVICES_PIN = "secure_devices_pin"
|
||||
|
||||
DEFAULT_EXPOSE_BY_DEFAULT = True
|
||||
DEFAULT_EXPOSED_DOMAINS = [
|
||||
'climate', 'cover', 'fan', 'group', 'input_boolean', 'light',
|
||||
'media_player', 'scene', 'script', 'switch', 'vacuum', 'lock',
|
||||
'binary_sensor', 'sensor'
|
||||
"climate",
|
||||
"cover",
|
||||
"fan",
|
||||
"group",
|
||||
"input_boolean",
|
||||
"light",
|
||||
"media_player",
|
||||
"scene",
|
||||
"script",
|
||||
"switch",
|
||||
"vacuum",
|
||||
"lock",
|
||||
"binary_sensor",
|
||||
"sensor",
|
||||
]
|
||||
|
||||
PREFIX_TYPES = 'action.devices.types.'
|
||||
TYPE_CAMERA = PREFIX_TYPES + 'CAMERA'
|
||||
TYPE_LIGHT = PREFIX_TYPES + 'LIGHT'
|
||||
TYPE_SWITCH = PREFIX_TYPES + 'SWITCH'
|
||||
TYPE_VACUUM = PREFIX_TYPES + 'VACUUM'
|
||||
TYPE_SCENE = PREFIX_TYPES + 'SCENE'
|
||||
TYPE_FAN = PREFIX_TYPES + 'FAN'
|
||||
TYPE_THERMOSTAT = PREFIX_TYPES + 'THERMOSTAT'
|
||||
TYPE_LOCK = PREFIX_TYPES + 'LOCK'
|
||||
TYPE_BLINDS = PREFIX_TYPES + 'BLINDS'
|
||||
TYPE_GARAGE = PREFIX_TYPES + 'GARAGE'
|
||||
TYPE_OUTLET = PREFIX_TYPES + 'OUTLET'
|
||||
TYPE_SENSOR = PREFIX_TYPES + 'SENSOR'
|
||||
TYPE_DOOR = PREFIX_TYPES + 'DOOR'
|
||||
TYPE_TV = PREFIX_TYPES + 'TV'
|
||||
TYPE_SPEAKER = PREFIX_TYPES + 'SPEAKER'
|
||||
PREFIX_TYPES = "action.devices.types."
|
||||
TYPE_CAMERA = PREFIX_TYPES + "CAMERA"
|
||||
TYPE_LIGHT = PREFIX_TYPES + "LIGHT"
|
||||
TYPE_SWITCH = PREFIX_TYPES + "SWITCH"
|
||||
TYPE_VACUUM = PREFIX_TYPES + "VACUUM"
|
||||
TYPE_SCENE = PREFIX_TYPES + "SCENE"
|
||||
TYPE_FAN = PREFIX_TYPES + "FAN"
|
||||
TYPE_THERMOSTAT = PREFIX_TYPES + "THERMOSTAT"
|
||||
TYPE_LOCK = PREFIX_TYPES + "LOCK"
|
||||
TYPE_BLINDS = PREFIX_TYPES + "BLINDS"
|
||||
TYPE_GARAGE = PREFIX_TYPES + "GARAGE"
|
||||
TYPE_OUTLET = PREFIX_TYPES + "OUTLET"
|
||||
TYPE_SENSOR = PREFIX_TYPES + "SENSOR"
|
||||
TYPE_DOOR = PREFIX_TYPES + "DOOR"
|
||||
TYPE_TV = PREFIX_TYPES + "TV"
|
||||
TYPE_SPEAKER = PREFIX_TYPES + "SPEAKER"
|
||||
|
||||
SERVICE_REQUEST_SYNC = 'request_sync'
|
||||
HOMEGRAPH_URL = 'https://homegraph.googleapis.com/'
|
||||
REQUEST_SYNC_BASE_URL = HOMEGRAPH_URL + 'v1/devices:requestSync'
|
||||
SERVICE_REQUEST_SYNC = "request_sync"
|
||||
HOMEGRAPH_URL = "https://homegraph.googleapis.com/"
|
||||
REQUEST_SYNC_BASE_URL = HOMEGRAPH_URL + "v1/devices:requestSync"
|
||||
|
||||
# Error codes used for SmartHomeError class
|
||||
# https://developers.google.com/actions/reference/smarthome/errors-exceptions
|
||||
@@ -65,20 +77,20 @@ ERR_DEVICE_OFFLINE = "deviceOffline"
|
||||
ERR_DEVICE_NOT_FOUND = "deviceNotFound"
|
||||
ERR_VALUE_OUT_OF_RANGE = "valueOutOfRange"
|
||||
ERR_NOT_SUPPORTED = "notSupported"
|
||||
ERR_PROTOCOL_ERROR = 'protocolError'
|
||||
ERR_UNKNOWN_ERROR = 'unknownError'
|
||||
ERR_FUNCTION_NOT_SUPPORTED = 'functionNotSupported'
|
||||
ERR_PROTOCOL_ERROR = "protocolError"
|
||||
ERR_UNKNOWN_ERROR = "unknownError"
|
||||
ERR_FUNCTION_NOT_SUPPORTED = "functionNotSupported"
|
||||
|
||||
ERR_CHALLENGE_NEEDED = 'challengeNeeded'
|
||||
ERR_CHALLENGE_NOT_SETUP = 'challengeFailedNotSetup'
|
||||
ERR_TOO_MANY_FAILED_ATTEMPTS = 'tooManyFailedAttempts'
|
||||
ERR_PIN_INCORRECT = 'pinIncorrect'
|
||||
ERR_USER_CANCELLED = 'userCancelled'
|
||||
ERR_CHALLENGE_NEEDED = "challengeNeeded"
|
||||
ERR_CHALLENGE_NOT_SETUP = "challengeFailedNotSetup"
|
||||
ERR_TOO_MANY_FAILED_ATTEMPTS = "tooManyFailedAttempts"
|
||||
ERR_PIN_INCORRECT = "pinIncorrect"
|
||||
ERR_USER_CANCELLED = "userCancelled"
|
||||
|
||||
# Event types
|
||||
EVENT_COMMAND_RECEIVED = 'google_assistant_command'
|
||||
EVENT_QUERY_RECEIVED = 'google_assistant_query'
|
||||
EVENT_SYNC_RECEIVED = 'google_assistant_sync'
|
||||
EVENT_COMMAND_RECEIVED = "google_assistant_command"
|
||||
EVENT_QUERY_RECEIVED = "google_assistant_query"
|
||||
EVENT_SYNC_RECEIVED = "google_assistant_sync"
|
||||
|
||||
DOMAIN_TO_GOOGLE_TYPES = {
|
||||
camera.DOMAIN: TYPE_CAMERA,
|
||||
@@ -102,8 +114,7 @@ DEVICE_CLASS_TO_GOOGLE_TYPES = {
|
||||
(switch.DOMAIN, switch.DEVICE_CLASS_SWITCH): TYPE_SWITCH,
|
||||
(switch.DOMAIN, switch.DEVICE_CLASS_OUTLET): TYPE_OUTLET,
|
||||
(binary_sensor.DOMAIN, binary_sensor.DEVICE_CLASS_DOOR): TYPE_DOOR,
|
||||
(binary_sensor.DOMAIN, binary_sensor.DEVICE_CLASS_GARAGE_DOOR):
|
||||
TYPE_GARAGE,
|
||||
(binary_sensor.DOMAIN, binary_sensor.DEVICE_CLASS_GARAGE_DOOR): TYPE_GARAGE,
|
||||
(binary_sensor.DOMAIN, binary_sensor.DEVICE_CLASS_LOCK): TYPE_SENSOR,
|
||||
(binary_sensor.DOMAIN, binary_sensor.DEVICE_CLASS_OPENING): TYPE_SENSOR,
|
||||
(binary_sensor.DOMAIN, binary_sensor.DEVICE_CLASS_WINDOW): TYPE_SENSOR,
|
||||
@@ -112,6 +123,6 @@ DEVICE_CLASS_TO_GOOGLE_TYPES = {
|
||||
(sensor.DOMAIN, sensor.DEVICE_CLASS_TEMPERATURE): TYPE_SENSOR,
|
||||
}
|
||||
|
||||
CHALLENGE_ACK_NEEDED = 'ackNeeded'
|
||||
CHALLENGE_PIN_NEEDED = 'pinNeeded'
|
||||
CHALLENGE_FAILED_PIN_NEEDED = 'challengeFailedPinNeeded'
|
||||
CHALLENGE_ACK_NEEDED = "ackNeeded"
|
||||
CHALLENGE_PIN_NEEDED = "pinNeeded"
|
||||
CHALLENGE_FAILED_PIN_NEEDED = "challengeFailedPinNeeded"
|
||||
Reference in new issue
Block a user