Fix root-import pylint warning in components (#119294)
* Fix root-import pylint warning in components * Adjust * Adjust
This commit is contained in:
parent
94b9ae14c9
commit
fbaba3753b
47 changed files with 107 additions and 106 deletions
|
@ -14,7 +14,7 @@ from homeassistant.components.camera.const import (
|
|||
PREF_ORIENTATION,
|
||||
PREF_PRELOAD_STREAM,
|
||||
)
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.config import async_process_ha_core_config
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
|
|
@ -8,7 +8,7 @@ import pytest
|
|||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components import config
|
||||
from homeassistant.components.config import core
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.const import (
|
||||
CONF_UNIT_SYSTEM,
|
||||
CONF_UNIT_SYSTEM_IMPERIAL,
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.components.device_automation import (
|
|||
InvalidDeviceAutomationConfig,
|
||||
toggle_entity,
|
||||
)
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
|
|
|
@ -5,7 +5,7 @@ from unittest.mock import AsyncMock, Mock, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import async_get
|
||||
from homeassistant.helpers.system_info import async_get_system_info
|
||||
|
|
|
@ -7,7 +7,7 @@ from deebot_client.events import LifeSpan
|
|||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.button.const import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
|
||||
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
|
||||
from homeassistant.components.ecovacs.const import DOMAIN
|
||||
from homeassistant.components.ecovacs.controller import EcovacsController
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN, Platform
|
||||
|
|
|
@ -10,7 +10,7 @@ from syrupy import SnapshotAssertion
|
|||
|
||||
from homeassistant.components.ecovacs.const import DOMAIN
|
||||
from homeassistant.components.ecovacs.controller import EcovacsController
|
||||
from homeassistant.components.event.const import ATTR_EVENT_TYPE
|
||||
from homeassistant.components.event import ATTR_EVENT_TYPE
|
||||
from homeassistant.const import STATE_UNKNOWN, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -14,12 +14,10 @@ from homeassistant.components.ecovacs.const import DOMAIN
|
|||
from homeassistant.components.ecovacs.controller import EcovacsController
|
||||
from homeassistant.components.lawn_mower import (
|
||||
DOMAIN as PLATFORM_DOMAIN,
|
||||
LawnMowerActivity,
|
||||
)
|
||||
from homeassistant.components.lawn_mower.const import (
|
||||
SERVICE_DOCK,
|
||||
SERVICE_PAUSE,
|
||||
SERVICE_START_MOWING,
|
||||
LawnMowerActivity,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -11,7 +11,7 @@ from syrupy import SnapshotAssertion
|
|||
|
||||
from homeassistant.components.ecovacs.const import DOMAIN
|
||||
from homeassistant.components.ecovacs.controller import EcovacsController
|
||||
from homeassistant.components.number.const import (
|
||||
from homeassistant.components.number import (
|
||||
ATTR_VALUE,
|
||||
DOMAIN as PLATFORM_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
|
|
|
@ -32,7 +32,7 @@ from syrupy import SnapshotAssertion
|
|||
|
||||
from homeassistant.components.ecovacs.const import DOMAIN
|
||||
from homeassistant.components.ecovacs.controller import EcovacsController
|
||||
from homeassistant.components.switch.const import DOMAIN as PLATFORM_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as PLATFORM_DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
SERVICE_TURN_OFF,
|
||||
|
|
|
@ -6,8 +6,11 @@ from flexit_bacnet import DecodingError
|
|||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.number import DOMAIN as NUMBER_DOMAIN
|
||||
from homeassistant.components.number.const import ATTR_VALUE, SERVICE_SET_VALUE
|
||||
from homeassistant.components.number import (
|
||||
ATTR_VALUE,
|
||||
DOMAIN as NUMBER_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
|
|
@ -21,7 +21,7 @@ from homeassistant.components.frontend import (
|
|||
async_register_built_in_panel,
|
||||
async_remove_panel,
|
||||
)
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.loader import async_get_integration
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -25,8 +25,8 @@ from homeassistant.components.generic.const import (
|
|||
CONF_STREAM_SOURCE,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.stream.const import CONF_RTSP_TRANSPORT
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.stream import CONF_RTSP_TRANSPORT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.const import (
|
||||
CONF_AUTHENTICATION,
|
||||
CONF_NAME,
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
from pytest_unordered import unordered
|
||||
|
||||
from homeassistant.components.event import DOMAIN as EVENT_DOMAIN
|
||||
from homeassistant.components.event.const import ATTR_EVENT_TYPE, ATTR_EVENT_TYPES
|
||||
from homeassistant.components.event import (
|
||||
ATTR_EVENT_TYPE,
|
||||
ATTR_EVENT_TYPES,
|
||||
DOMAIN as EVENT_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.group import DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
|
|
|
@ -11,7 +11,7 @@ from typing_extensions import Generator
|
|||
from homeassistant.components.hassio import AddonError, AddonInfo, AddonState, HassIO
|
||||
from homeassistant.components.hassio.handler import HassioAPIError
|
||||
from homeassistant.components.homeassistant_hardware import silabs_multiprotocol_addon
|
||||
from homeassistant.components.zha.core.const import DOMAIN as ZHA_DOMAIN
|
||||
from homeassistant.components.zha import DOMAIN as ZHA_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigFlow
|
||||
from homeassistant.const import EVENT_COMPONENT_LOADED
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
|
|
|
@ -7,7 +7,7 @@ from typing_extensions import Generator
|
|||
|
||||
from homeassistant.components.hassio import DOMAIN as HASSIO_DOMAIN
|
||||
from homeassistant.components.homeassistant_yellow.const import DOMAIN
|
||||
from homeassistant.components.zha.core.const import DOMAIN as ZHA_DOMAIN
|
||||
from homeassistant.components.zha import DOMAIN as ZHA_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
|
||||
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN
|
||||
from homeassistant.components.button.const import SERVICE_PRESS
|
||||
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
|
|
@ -5,8 +5,10 @@ from unittest.mock import MagicMock, patch
|
|||
from huawei_lte_api.enums.net import LTEBandEnum, NetworkBandEnum, NetworkModeEnum
|
||||
|
||||
from homeassistant.components.huawei_lte.const import DOMAIN
|
||||
from homeassistant.components.select import SERVICE_SELECT_OPTION
|
||||
from homeassistant.components.select.const import DOMAIN as SELECT_DOMAIN
|
||||
from homeassistant.components.select import (
|
||||
DOMAIN as SELECT_DOMAIN,
|
||||
SERVICE_SELECT_OPTION,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_OPTION, CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from unittest.mock import patch
|
|||
from aiohttp import ClientSession, ClientWebSocketResponse
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
|
||||
from homeassistant.components.websocket_api import const as ws_const
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
@ -77,7 +77,7 @@ async def test_upload_image(
|
|||
msg = await ws_client.receive_json()
|
||||
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == ws_const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
assert msg["result"] == [item]
|
||||
|
||||
|
@ -88,7 +88,7 @@ async def test_upload_image(
|
|||
msg = await ws_client.receive_json()
|
||||
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == ws_const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
# Ensure removed from disk
|
||||
|
|
|
@ -7,7 +7,7 @@ from unittest.mock import MagicMock
|
|||
import pytest
|
||||
|
||||
from homeassistant.components import imap
|
||||
from homeassistant.components.sensor.const import SensorStateClass
|
||||
from homeassistant.components.sensor import SensorStateClass
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import pytest
|
|||
from homeassistant.components.imap import DOMAIN
|
||||
from homeassistant.components.imap.const import CONF_CHARSET
|
||||
from homeassistant.components.imap.errors import InvalidAuth, InvalidFolder
|
||||
from homeassistant.components.sensor.const import SensorStateClass
|
||||
from homeassistant.components.sensor import SensorStateClass
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
|
|
|
@ -8,10 +8,10 @@ from typing_extensions import AsyncGenerator
|
|||
|
||||
from homeassistant.components.kitchen_sink import DOMAIN
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_MESSAGE,
|
||||
DOMAIN as NOTIFY_DOMAIN,
|
||||
SERVICE_SEND_MESSAGE,
|
||||
)
|
||||
from homeassistant.components.notify.const import ATTR_MESSAGE
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.components.logbook import websocket_api
|
|||
from homeassistant.components.recorder import Recorder
|
||||
from homeassistant.components.recorder.util import get_instance
|
||||
from homeassistant.components.script import EVENT_SCRIPT_STARTED
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.const import (
|
||||
ATTR_DOMAIN,
|
||||
ATTR_ENTITY_ID,
|
||||
|
|
|
@ -5,7 +5,7 @@ from unittest.mock import patch
|
|||
|
||||
from homeassistant import loader
|
||||
from homeassistant.components.logger.helpers import async_get_domain_config
|
||||
from homeassistant.components.websocket_api import const
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
@ -28,7 +28,7 @@ async def test_integration_log_info(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
assert {"domain": "http", "level": logging.DEBUG} in msg["result"]
|
||||
assert {"domain": "websocket_api", "level": logging.DEBUG} in msg["result"]
|
||||
|
@ -51,7 +51,7 @@ async def test_integration_log_level_logger_not_loaded(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert not msg["success"]
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ async def test_integration_log_level(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
assert async_get_domain_config(hass).overrides == {
|
||||
|
@ -124,7 +124,7 @@ async def test_custom_integration_log_level(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
assert async_get_domain_config(hass).overrides == {
|
||||
|
@ -153,7 +153,7 @@ async def test_integration_log_level_unknown_integration(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert not msg["success"]
|
||||
|
||||
|
||||
|
@ -180,7 +180,7 @@ async def test_module_log_level(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
assert async_get_domain_config(hass).overrides == {
|
||||
|
@ -216,7 +216,7 @@ async def test_module_log_level_override(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
assert async_get_domain_config(hass).overrides == {
|
||||
|
@ -235,7 +235,7 @@ async def test_module_log_level_override(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
assert async_get_domain_config(hass).overrides == {
|
||||
|
@ -254,7 +254,7 @@ async def test_module_log_level_override(
|
|||
|
||||
msg = await websocket_client.receive_json()
|
||||
assert msg["id"] == 8
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
assert async_get_domain_config(hass).overrides == {
|
||||
|
|
|
@ -7,8 +7,7 @@ from matter_server.client.models.node import MatterNode
|
|||
from matter_server.common.helpers.util import create_attribute_path_from_attribute
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.climate import HVACAction, HVACMode
|
||||
from homeassistant.components.climate.const import ClimateEntityFeature
|
||||
from homeassistant.components.climate import ClimateEntityFeature, HVACAction, HVACMode
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .common import (
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.components.media_player import (
|
|||
MediaPlayerEntity,
|
||||
MediaPlayerEntityFeature,
|
||||
)
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN
|
||||
from homeassistant.components.climate.const import (
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_FAN_MODE,
|
||||
ATTR_FAN_MODES,
|
||||
ATTR_HVAC_MODE,
|
||||
ATTR_HVAC_MODES,
|
||||
ATTR_SWING_MODE,
|
||||
ATTR_SWING_MODES,
|
||||
DOMAIN as CLIMATE_DOMAIN,
|
||||
FAN_AUTO,
|
||||
FAN_DIFFUSE,
|
||||
FAN_FOCUS,
|
||||
|
|
|
@ -16,7 +16,7 @@ import pytest
|
|||
from homeassistant.components import camera
|
||||
from homeassistant.components.camera import STATE_IDLE, STATE_STREAMING, StreamType
|
||||
from homeassistant.components.nest.const import DOMAIN
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.const import ATTR_FRIENDLY_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""The tests for the persistent notification component."""
|
||||
|
||||
import homeassistant.components.persistent_notification as pn
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@ from unittest.mock import patch
|
|||
from icmplib import Host
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.device_tracker.const import CONF_CONSIDER_HOME
|
||||
from homeassistant.components.ping import DOMAIN
|
||||
from homeassistant.components.ping.const import CONF_PING_COUNT
|
||||
from homeassistant.components.device_tracker import CONF_CONSIDER_HOME
|
||||
from homeassistant.components.ping import CONF_PING_COUNT, DOMAIN
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ from homeassistant.components.media_player import (
|
|||
ATTR_MEDIA_CONTENT_TYPE,
|
||||
)
|
||||
from homeassistant.components.plex.const import CONF_SERVER_IDENTIFIER, PLEX_URI_SCHEME
|
||||
from homeassistant.components.websocket_api.const import ERR_UNKNOWN_ERROR, TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import ERR_UNKNOWN_ERROR, TYPE_RESULT
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import DEFAULT_DATA
|
||||
|
|
|
@ -6,7 +6,7 @@ from unittest.mock import MagicMock, patch
|
|||
from plugwise.exceptions import PlugwiseError
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.climate.const import HVACMode
|
||||
from homeassistant.components.climate import HVACMode
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
|
|
@ -36,7 +36,7 @@ from homeassistant.components.roku.const import (
|
|||
SERVICE_SEARCH,
|
||||
)
|
||||
from homeassistant.components.stream import FORMAT_CONTENT_TYPE, HLS_PROVIDER
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.config import async_process_ha_core_config
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
|
|
@ -11,7 +11,7 @@ import pytest
|
|||
import rtsp_to_webrtc
|
||||
|
||||
from homeassistant.components.rtsp_to_webrtc import CONF_STUN_SERVER, DOMAIN
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.components.shopping_list.const import (
|
|||
SERVICE_REMOVE_ITEM,
|
||||
SERVICE_SORT,
|
||||
)
|
||||
from homeassistant.components.websocket_api.const import (
|
||||
from homeassistant.components.websocket_api import (
|
||||
ERR_INVALID_FORMAT,
|
||||
ERR_NOT_FOUND,
|
||||
TYPE_RESULT,
|
||||
|
|
|
@ -17,6 +17,7 @@ from homeassistant.components.climate import (
|
|||
ATTR_HVAC_MODE,
|
||||
ATTR_HVAC_MODES,
|
||||
ATTR_PRESET_MODE,
|
||||
ATTR_SWING_MODE,
|
||||
ATTR_TARGET_TEMP_HIGH,
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
DOMAIN as CLIMATE_DOMAIN,
|
||||
|
@ -29,7 +30,6 @@ from homeassistant.components.climate import (
|
|||
HVACAction,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.components.climate.const import ATTR_SWING_MODE
|
||||
from homeassistant.components.smartthings import climate
|
||||
from homeassistant.components.smartthings.const import DOMAIN
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -13,21 +13,19 @@ from homeassistant.components.smhi.weather import CONDITION_CLASSES, RETRY_TIMEO
|
|||
from homeassistant.components.weather import (
|
||||
ATTR_CONDITION_CLEAR_NIGHT,
|
||||
ATTR_FORECAST_CONDITION,
|
||||
ATTR_WEATHER_CLOUD_COVERAGE,
|
||||
ATTR_WEATHER_HUMIDITY,
|
||||
ATTR_WEATHER_PRESSURE,
|
||||
ATTR_WEATHER_TEMPERATURE,
|
||||
ATTR_WEATHER_VISIBILITY,
|
||||
ATTR_WEATHER_WIND_BEARING,
|
||||
ATTR_WEATHER_WIND_GUST_SPEED,
|
||||
ATTR_WEATHER_WIND_SPEED,
|
||||
ATTR_WEATHER_WIND_SPEED_UNIT,
|
||||
DOMAIN as WEATHER_DOMAIN,
|
||||
LEGACY_SERVICE_GET_FORECAST,
|
||||
SERVICE_GET_FORECASTS,
|
||||
)
|
||||
from homeassistant.components.weather.const import (
|
||||
ATTR_WEATHER_CLOUD_COVERAGE,
|
||||
ATTR_WEATHER_WIND_GUST_SPEED,
|
||||
)
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, STATE_UNKNOWN, UnitOfSpeed
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
|
|
@ -4,8 +4,7 @@ from functools import partial
|
|||
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.media_player.browse_media import BrowseMedia
|
||||
from homeassistant.components.media_player.const import MediaClass, MediaType
|
||||
from homeassistant.components.media_player import BrowseMedia, MediaClass, MediaType
|
||||
from homeassistant.components.sonos.media_browser import (
|
||||
build_item_response,
|
||||
get_thumbnail_url_full,
|
||||
|
|
|
@ -6,13 +6,11 @@ from typing import Any
|
|||
import pytest
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
ATTR_MEDIA_ENQUEUE,
|
||||
DOMAIN as MP_DOMAIN,
|
||||
SERVICE_PLAY_MEDIA,
|
||||
MediaPlayerEnqueue,
|
||||
)
|
||||
from homeassistant.components.media_player.const import (
|
||||
ATTR_MEDIA_ENQUEUE,
|
||||
SERVICE_SELECT_SOURCE,
|
||||
MediaPlayerEnqueue,
|
||||
)
|
||||
from homeassistant.components.sonos.const import SOURCE_LINEIN, SOURCE_TV
|
||||
from homeassistant.components.sonos.media_player import LONG_SERVICE_TIMEOUT
|
||||
|
|
|
@ -8,7 +8,7 @@ from sqlalchemy.exc import SQLAlchemyError
|
|||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.recorder import Recorder
|
||||
from homeassistant.components.sensor.const import SensorDeviceClass, SensorStateClass
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass
|
||||
from homeassistant.components.sql.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.trafikverket_ferry.const import (
|
||||
from homeassistant.components.trafikverket_train.const import (
|
||||
CONF_FILTER_PRODUCT,
|
||||
CONF_FROM,
|
||||
CONF_TIME,
|
||||
CONF_TO,
|
||||
)
|
||||
from homeassistant.components.trafikverket_train.const import CONF_FILTER_PRODUCT
|
||||
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_WEEKDAY, WEEKDAYS
|
||||
|
||||
ENTRY_CONFIG = {
|
||||
|
|
|
@ -4,7 +4,7 @@ from datetime import date
|
|||
|
||||
from vallox_websocket_api import MetricData
|
||||
|
||||
from homeassistant.components.date.const import DOMAIN as DATE_DOMAIN, SERVICE_SET_VALUE
|
||||
from homeassistant.components.date import DOMAIN as DATE_DOMAIN, SERVICE_SET_VALUE
|
||||
from homeassistant.const import ATTR_DATE, ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.number.const import (
|
||||
from homeassistant.components.number import (
|
||||
ATTR_VALUE,
|
||||
DOMAIN as NUMBER_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.switch.const import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ from homeassistant.components.weather import (
|
|||
DOMAIN as WEATHER_DOMAIN,
|
||||
LEGACY_SERVICE_GET_FORECAST,
|
||||
SERVICE_GET_FORECASTS,
|
||||
WeatherEntityFeature,
|
||||
)
|
||||
from homeassistant.components.weather.const import WeatherEntityFeature
|
||||
from homeassistant.components.weatherkit.const import ATTRIBUTION
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_SUPPORTED_FEATURES
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.bluetooth.const import DOMAIN as BLUETOOTH_DOMAIN
|
||||
from homeassistant.components.bluetooth import DOMAIN as BLUETOOTH_DOMAIN
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.xiaomi_ble.const import CONF_SUBTYPE, DOMAIN
|
||||
from homeassistant.const import CONF_DEVICE_ID, CONF_DOMAIN, CONF_PLATFORM, CONF_TYPE
|
||||
|
|
|
@ -9,8 +9,7 @@ import pytest
|
|||
from syrupy.assertion import SnapshotAssertion
|
||||
from yalesmartalarmclient.exceptions import UnknownError
|
||||
|
||||
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN
|
||||
from homeassistant.components.button.const import SERVICE_PRESS
|
||||
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
|
||||
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
|
|
@ -19,7 +19,11 @@ from zigpy.zcl.clusters import general, security
|
|||
from zigpy.zcl.clusters.general import Groups
|
||||
import zigpy.zdo.types as zdo_types
|
||||
|
||||
from homeassistant.components.websocket_api import const
|
||||
from homeassistant.components.websocket_api import (
|
||||
ERR_INVALID_FORMAT,
|
||||
ERR_NOT_FOUND,
|
||||
TYPE_RESULT,
|
||||
)
|
||||
from homeassistant.components.zha import DOMAIN
|
||||
from homeassistant.components.zha.core.const import (
|
||||
ATTR_CLUSTER_ID,
|
||||
|
@ -336,9 +340,9 @@ async def test_device_not_found(zha_client) -> None:
|
|||
)
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == const.ERR_NOT_FOUND
|
||||
assert msg["error"]["code"] == ERR_NOT_FOUND
|
||||
|
||||
|
||||
async def test_list_groups(zha_client) -> None:
|
||||
|
@ -347,7 +351,7 @@ async def test_list_groups(zha_client) -> None:
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 7
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
groups = msg["result"]
|
||||
assert len(groups) == 1
|
||||
|
@ -364,7 +368,7 @@ async def test_get_group(zha_client) -> None:
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 8
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
group = msg["result"]
|
||||
assert group is not None
|
||||
|
@ -380,9 +384,9 @@ async def test_get_group_not_found(zha_client) -> None:
|
|||
msg = await zha_client.receive_json()
|
||||
|
||||
assert msg["id"] == 9
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == const.ERR_NOT_FOUND
|
||||
assert msg["error"]["code"] == ERR_NOT_FOUND
|
||||
|
||||
|
||||
async def test_list_groupable_devices(
|
||||
|
@ -397,7 +401,7 @@ async def test_list_groupable_devices(
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 10
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
device_endpoints = msg["result"]
|
||||
assert len(device_endpoints) == 1
|
||||
|
@ -427,7 +431,7 @@ async def test_list_groupable_devices(
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 11
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
device_endpoints = msg["result"]
|
||||
assert len(device_endpoints) == 0
|
||||
|
@ -439,7 +443,7 @@ async def test_add_group(zha_client) -> None:
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 12
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
added_group = msg["result"]
|
||||
|
||||
|
@ -450,7 +454,7 @@ async def test_add_group(zha_client) -> None:
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 13
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
groups = msg["result"]
|
||||
assert len(groups) == 2
|
||||
|
@ -466,7 +470,7 @@ async def test_remove_group(zha_client) -> None:
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 14
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
groups = msg["result"]
|
||||
assert len(groups) == 1
|
||||
|
@ -477,7 +481,7 @@ async def test_remove_group(zha_client) -> None:
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 15
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
groups_remaining = msg["result"]
|
||||
assert len(groups_remaining) == 0
|
||||
|
@ -486,7 +490,7 @@ async def test_remove_group(zha_client) -> None:
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 16
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
|
||||
groups = msg["result"]
|
||||
assert len(groups) == 0
|
||||
|
@ -710,14 +714,14 @@ async def test_ws_permit_with_qr_code(
|
|||
)
|
||||
|
||||
msg_type = None
|
||||
while msg_type != const.TYPE_RESULT:
|
||||
while msg_type != TYPE_RESULT:
|
||||
# There will be logging events coming over the websocket
|
||||
# as well so we want to ignore those
|
||||
msg = await zha_client.receive_json()
|
||||
msg_type = msg["type"]
|
||||
|
||||
assert msg["id"] == 14
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
assert app_controller.permit.await_count == 0
|
||||
|
@ -739,7 +743,7 @@ async def test_ws_permit_with_install_code_fail(
|
|||
|
||||
msg = await zha_client.receive_json()
|
||||
assert msg["id"] == 14
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"] is False
|
||||
|
||||
assert app_controller.permit.await_count == 0
|
||||
|
@ -773,14 +777,14 @@ async def test_ws_permit_ha12(
|
|||
)
|
||||
|
||||
msg_type = None
|
||||
while msg_type != const.TYPE_RESULT:
|
||||
while msg_type != TYPE_RESULT:
|
||||
# There will be logging events coming over the websocket
|
||||
# as well so we want to ignore those
|
||||
msg = await zha_client.receive_json()
|
||||
msg_type = msg["type"]
|
||||
|
||||
assert msg["id"] == 14
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
assert app_controller.permit.await_count == 1
|
||||
|
@ -800,7 +804,7 @@ async def test_get_network_settings(
|
|||
msg = await zha_client.receive_json()
|
||||
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
assert "radio_type" in msg["result"]
|
||||
assert "network_info" in msg["result"]["settings"]
|
||||
|
@ -818,7 +822,7 @@ async def test_list_network_backups(
|
|||
msg = await zha_client.receive_json()
|
||||
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
assert "network_info" in msg["result"][0]
|
||||
|
||||
|
@ -834,7 +838,7 @@ async def test_create_network_backup(
|
|||
assert len(app_controller.backups.backups) == 1
|
||||
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
assert "backup" in msg["result"] and "is_complete" in msg["result"]
|
||||
|
||||
|
@ -860,7 +864,7 @@ async def test_restore_network_backup_success(
|
|||
assert "ezsp" not in backup.network_info.stack_specific
|
||||
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
|
||||
|
@ -892,7 +896,7 @@ async def test_restore_network_backup_force_write_eui64(
|
|||
)
|
||||
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
|
||||
|
@ -915,9 +919,9 @@ async def test_restore_network_backup_failure(
|
|||
p.assert_called_once_with("a backup")
|
||||
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == const.ERR_INVALID_FORMAT
|
||||
assert msg["error"]["code"] == ERR_INVALID_FORMAT
|
||||
|
||||
|
||||
@pytest.mark.parametrize("new_channel", ["auto", 15])
|
||||
|
@ -940,7 +944,7 @@ async def test_websocket_change_channel(
|
|||
msg = await zha_client.receive_json()
|
||||
|
||||
assert msg["id"] == 6
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
|
||||
change_channel_mock.assert_has_calls([call(ANY, new_channel)])
|
||||
|
@ -973,7 +977,7 @@ async def test_websocket_bind_unbind_devices(
|
|||
msg = await zha_client.receive_json()
|
||||
|
||||
assert msg["id"] == 27
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
assert binding_operation_mock.mock_calls == [
|
||||
call(
|
||||
|
@ -1027,7 +1031,7 @@ async def test_websocket_bind_unbind_group(
|
|||
msg = await zha_client.receive_json()
|
||||
|
||||
assert msg["id"] == 27
|
||||
assert msg["type"] == const.TYPE_RESULT
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
if command_type == "bind":
|
||||
assert bind_mock.mock_calls == [call(test_group_id, ANY)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue