Import constants from component root (#78395)

pull/78423/head
epenet 2022-09-14 00:12:54 +02:00 committed by GitHub
parent f1c7fb7866
commit 416a5cb279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 15 deletions

View File

@ -1,7 +1,7 @@
"""Constants for the Alexa integration."""
from collections import OrderedDict
from homeassistant.components.climate import const as climate
from homeassistant.components import climate
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
DOMAIN = "alexa"

View File

@ -11,6 +11,7 @@ from homeassistant.components import (
binary_sensor,
button,
camera,
climate,
cover,
fan,
group,
@ -28,7 +29,6 @@ from homeassistant.components import (
timer,
vacuum,
)
from homeassistant.components.climate import const as climate
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_SUPPORTED_FEATURES,

View File

@ -10,6 +10,7 @@ from homeassistant import core as ha
from homeassistant.components import (
button,
camera,
climate,
cover,
fan,
group,
@ -20,7 +21,6 @@ from homeassistant.components import (
timer,
vacuum,
)
from homeassistant.components.climate import const as climate
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_ENTITY_PICTURE,

View File

@ -8,8 +8,7 @@ from enum import Enum
from hass_nabucasa import Cloud
import voluptuous as vol
from homeassistant.components.alexa import const as alexa_const
from homeassistant.components.google_assistant import const as ga_c
from homeassistant.components import alexa, google_assistant
from homeassistant.const import (
CONF_DESCRIPTION,
CONF_MODE,
@ -68,7 +67,7 @@ SIGNAL_CLOUD_CONNECTION_STATE = "CLOUD_CONNECTION_STATE"
ALEXA_ENTITY_SCHEMA = vol.Schema(
{
vol.Optional(CONF_DESCRIPTION): cv.string,
vol.Optional(alexa_const.CONF_DISPLAY_CATEGORIES): cv.string,
vol.Optional(alexa.CONF_DISPLAY_CATEGORIES): cv.string,
vol.Optional(CONF_NAME): cv.string,
}
)
@ -77,7 +76,7 @@ GOOGLE_ENTITY_SCHEMA = vol.Schema(
{
vol.Optional(CONF_NAME): cv.string,
vol.Optional(CONF_ALIASES): vol.All(cv.ensure_list, [cv.string]),
vol.Optional(ga_c.CONF_ROOM_HINT): cv.string,
vol.Optional(google_assistant.CONF_ROOM_HINT): cv.string,
}
)

View File

@ -10,12 +10,12 @@ from typing import Any
import aiohttp
from hass_nabucasa.client import CloudClient as Interface
from homeassistant.components import persistent_notification, webhook
from homeassistant.components import google_assistant, persistent_notification, webhook
from homeassistant.components.alexa import (
errors as alexa_errors,
smart_home as alexa_smart_home,
)
from homeassistant.components.google_assistant import const as gc, smart_home as ga
from homeassistant.components.google_assistant import smart_home as ga
from homeassistant.core import Context, HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.event import async_call_later
@ -216,7 +216,7 @@ class CloudClient(Interface):
return ga.api_disabled_response(payload, gconf.agent_user_id)
return await ga.async_handle_message(
self._hass, gconf, gconf.cloud_user, payload, gc.SOURCE_CLOUD
self._hass, gconf, gconf.cloud_user, payload, google_assistant.SOURCE_CLOUD
)
async def async_webhook_message(self, payload: dict[Any, Any]) -> dict[Any, Any]:

View File

@ -21,7 +21,6 @@ from homeassistant.components.alexa import (
from homeassistant.components.google_assistant import helpers as google_helpers
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.components.websocket_api import const as ws_const
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.util.location import async_detect_location_info
@ -616,7 +615,9 @@ async def alexa_sync(hass, connection, msg):
if success:
connection.send_result(msg["id"])
else:
connection.send_error(msg["id"], ws_const.ERR_UNKNOWN_ERROR, "Unknown error")
connection.send_error(
msg["id"], websocket_api.ERR_UNKNOWN_ERROR, "Unknown error"
)
@websocket_api.websocket_command({"type": "cloud/thingtalk/convert", "query": str})
@ -631,7 +632,7 @@ async def thingtalk_convert(hass, connection, msg):
msg["id"], await thingtalk.async_convert(cloud, msg["query"])
)
except thingtalk.ThingTalkConversionError as err:
connection.send_error(msg["id"], ws_const.ERR_UNKNOWN_ERROR, str(err))
connection.send_error(msg["id"], websocket_api.ERR_UNKNOWN_ERROR, str(err))
@websocket_api.websocket_command({"type": "cloud/tts/info"})

View File

@ -9,9 +9,11 @@ from homeassistant.components import (
binary_sensor,
button,
camera,
climate,
cover,
fan,
group,
humidifier,
input_boolean,
input_button,
input_select,
@ -25,8 +27,6 @@ from homeassistant.components import (
switch,
vacuum,
)
from homeassistant.components.climate import const as climate
from homeassistant.components.humidifier import const as humidifier
from homeassistant.components.lock import STATE_JAMMED, STATE_UNLOCKING
from homeassistant.components.media_player import MediaType
from homeassistant.const import (