1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Use const imports [l-z] (#63469)

This commit is contained in:
Marc Mueller 2022-01-05 18:21:20 +01:00 committed by GitHub
parent 6d57dbde68
commit ae6d9c229e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 28 additions and 34 deletions

View File

@ -17,6 +17,8 @@ from homeassistant.const import (
CONF_SWITCHES, CONF_SWITCHES,
CONF_UNIT_OF_MEASUREMENT, CONF_UNIT_OF_MEASUREMENT,
CONF_USERNAME, CONF_USERNAME,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
) )
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -49,8 +51,6 @@ from .const import (
RELAY_PORTS, RELAY_PORTS,
S0_INPUTS, S0_INPUTS,
SETPOINTS, SETPOINTS,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
THRESHOLDS, THRESHOLDS,
VAR_UNITS, VAR_UNITS,
VARIABLES, VARIABLES,

View File

@ -1,7 +1,7 @@
"""Intents for the light integration.""" """Intents for the light integration."""
import voluptuous as vol import voluptuous as vol
from homeassistant.const import ATTR_ENTITY_ID from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_ON
from homeassistant.core import HomeAssistant, State from homeassistant.core import HomeAssistant, State
from homeassistant.helpers import intent from homeassistant.helpers import intent
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -12,7 +12,6 @@ from . import (
ATTR_RGB_COLOR, ATTR_RGB_COLOR,
ATTR_SUPPORTED_COLOR_MODES, ATTR_SUPPORTED_COLOR_MODES,
DOMAIN, DOMAIN,
SERVICE_TURN_ON,
brightness_supported, brightness_supported,
color_supported, color_supported,
) )

View File

@ -4,13 +4,14 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import logging import logging
from homeassistant.components.camera import ATTR_ENTITY_ID, SUPPORT_ON_OFF, Camera from homeassistant.components.camera import SUPPORT_ON_OFF, Camera
from homeassistant.components.ffmpeg import get_ffmpeg_manager from homeassistant.components.ffmpeg import get_ffmpeg_manager
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
ATTR_ATTRIBUTION, ATTR_ATTRIBUTION,
ATTR_BATTERY_CHARGING, ATTR_BATTERY_CHARGING,
ATTR_BATTERY_LEVEL, ATTR_BATTERY_LEVEL,
ATTR_ENTITY_ID,
STATE_OFF, STATE_OFF,
STATE_ON, STATE_ON,
) )

View File

@ -8,8 +8,6 @@ from homeassistant.components.vacuum import (
STATE_CLEANING, STATE_CLEANING,
STATE_DOCKED, STATE_DOCKED,
STATE_ERROR, STATE_ERROR,
STATE_IDLE,
STATE_PAUSED,
STATE_RETURNING, STATE_RETURNING,
SUPPORT_BATTERY, SUPPORT_BATTERY,
SUPPORT_CLEAN_SPOT, SUPPORT_CLEAN_SPOT,
@ -23,7 +21,12 @@ from homeassistant.components.vacuum import (
SUPPORT_STOP, SUPPORT_STOP,
StateVacuumEntity, StateVacuumEntity,
) )
from homeassistant.const import ATTR_SUPPORTED_FEATURES, CONF_NAME from homeassistant.const import (
ATTR_SUPPORTED_FEATURES,
CONF_NAME,
STATE_IDLE,
STATE_PAUSED,
)
from homeassistant.core import callback from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View File

@ -14,8 +14,6 @@ from homeassistant.components.vacuum import (
STATE_CLEANING, STATE_CLEANING,
STATE_DOCKED, STATE_DOCKED,
STATE_ERROR, STATE_ERROR,
STATE_IDLE,
STATE_PAUSED,
STATE_RETURNING, STATE_RETURNING,
SUPPORT_BATTERY, SUPPORT_BATTERY,
SUPPORT_CLEAN_SPOT, SUPPORT_CLEAN_SPOT,
@ -29,7 +27,7 @@ from homeassistant.components.vacuum import (
StateVacuumEntity, StateVacuumEntity,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_MODE from homeassistant.const import ATTR_MODE, STATE_IDLE, STATE_PAUSED
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo

View File

@ -9,8 +9,6 @@ from homeassistant.components.vacuum import (
STATE_CLEANING, STATE_CLEANING,
STATE_DOCKED, STATE_DOCKED,
STATE_ERROR, STATE_ERROR,
STATE_IDLE,
STATE_PAUSED,
STATE_RETURNING, STATE_RETURNING,
SUPPORT_BATTERY, SUPPORT_BATTERY,
SUPPORT_LOCATE, SUPPORT_LOCATE,
@ -23,6 +21,7 @@ from homeassistant.components.vacuum import (
SUPPORT_STOP, SUPPORT_STOP,
StateVacuumEntity, StateVacuumEntity,
) )
from homeassistant.const import STATE_IDLE, STATE_PAUSED
import homeassistant.helpers.device_registry as dr import homeassistant.helpers.device_registry as dr
from homeassistant.helpers.entity import DeviceInfo, Entity from homeassistant.helpers.entity import DeviceInfo, Entity
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util

View File

@ -4,11 +4,11 @@ from __future__ import annotations
from typing import Final, cast from typing import Final, cast
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
STATE_ON,
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_ON
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback

View File

@ -3,15 +3,8 @@ from __future__ import annotations
import logging import logging
from homeassistant.components.cover import ( from homeassistant.components.cover import ATTR_POSITION, CoverDeviceClass, CoverEntity
ATTR_POSITION, from homeassistant.const import ATTR_ID, STATE_CLOSED, STATE_CLOSING, STATE_OPENING
STATE_CLOSED,
STATE_CLOSING,
STATE_OPENING,
CoverDeviceClass,
CoverEntity,
)
from homeassistant.const import ATTR_ID
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

View File

@ -6,8 +6,9 @@ from typing import Any
from surepy.entities import SurepyEntity from surepy.entities import SurepyEntity
from surepy.enums import EntityType, LockState from surepy.enums import EntityType, LockState
from homeassistant.components.lock import STATE_LOCKED, STATE_UNLOCKED, LockEntity from homeassistant.components.lock import LockEntity
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback

View File

@ -15,6 +15,8 @@ from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
CONF_ENTITY_ID, CONF_ENTITY_ID,
CONF_NAME, CONF_NAME,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_ON, STATE_ON,
STATE_UNAVAILABLE, STATE_UNAVAILABLE,
) )
@ -74,7 +76,7 @@ class LightSwitch(LightEntity):
"""Forward the turn_on command to the switch in this light switch.""" """Forward the turn_on command to the switch in this light switch."""
await self.hass.services.async_call( await self.hass.services.async_call(
switch.DOMAIN, switch.DOMAIN,
switch.SERVICE_TURN_ON, SERVICE_TURN_ON,
{ATTR_ENTITY_ID: self._switch_entity_id}, {ATTR_ENTITY_ID: self._switch_entity_id},
blocking=True, blocking=True,
context=self._context, context=self._context,
@ -84,7 +86,7 @@ class LightSwitch(LightEntity):
"""Forward the turn_off command to the switch in this light switch.""" """Forward the turn_off command to the switch in this light switch."""
await self.hass.services.async_call( await self.hass.services.async_call(
switch.DOMAIN, switch.DOMAIN,
switch.SERVICE_TURN_OFF, SERVICE_TURN_OFF,
{ATTR_ENTITY_ID: self._switch_entity_id}, {ATTR_ENTITY_ID: self._switch_entity_id},
blocking=True, blocking=True,
context=self._context, context=self._context,

View File

@ -11,7 +11,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP from homeassistant.const import CONF_HOST, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import Event, HomeAssistant from homeassistant.core import Event, HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -25,7 +25,6 @@ from .const import (
ATTR_TRADFRI_MANUFACTURER, ATTR_TRADFRI_MANUFACTURER,
CONF_ALLOW_TRADFRI_GROUPS, CONF_ALLOW_TRADFRI_GROUPS,
CONF_GATEWAY_ID, CONF_GATEWAY_ID,
CONF_HOST,
CONF_IDENTITY, CONF_IDENTITY,
CONF_IMPORT_GROUPS, CONF_IMPORT_GROUPS,
CONF_KEY, CONF_KEY,

View File

@ -12,12 +12,12 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.components import zeroconf from homeassistant.components import zeroconf
from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from .const import ( from .const import (
CONF_GATEWAY_ID, CONF_GATEWAY_ID,
CONF_HOST,
CONF_IDENTITY, CONF_IDENTITY,
CONF_IMPORT_GROUPS, CONF_IMPORT_GROUPS,
CONF_KEY, CONF_KEY,

View File

@ -4,11 +4,11 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
from homeassistant.const import CONF_NAME from homeassistant.const import ATTR_ENTITY_ID, CONF_NAME
from homeassistant.core import split_entity_id from homeassistant.core import split_entity_id
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from . import ATTR_ENTITY_ID, ATTR_LANGUAGE, ATTR_MESSAGE, DOMAIN from . import ATTR_LANGUAGE, ATTR_MESSAGE, DOMAIN
CONF_MEDIA_PLAYER = "media_player" CONF_MEDIA_PLAYER = "media_player"
CONF_TTS_SERVICE = "tts_service" CONF_TTS_SERVICE = "tts_service"

View File

@ -8,8 +8,6 @@ from tuya_iot import TuyaDevice, TuyaDeviceManager
from homeassistant.components.vacuum import ( from homeassistant.components.vacuum import (
STATE_CLEANING, STATE_CLEANING,
STATE_DOCKED, STATE_DOCKED,
STATE_IDLE,
STATE_PAUSED,
STATE_RETURNING, STATE_RETURNING,
SUPPORT_BATTERY, SUPPORT_BATTERY,
SUPPORT_FAN_SPEED, SUPPORT_FAN_SPEED,
@ -25,6 +23,7 @@ from homeassistant.components.vacuum import (
StateVacuumEntity, StateVacuumEntity,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_IDLE, STATE_PAUSED
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback

View File

@ -8,6 +8,7 @@ from typing import Any
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
ATTR_TEMPERATURE,
SERVICE_TURN_OFF, SERVICE_TURN_OFF,
SERVICE_TURN_ON, SERVICE_TURN_ON,
STATE_OFF, STATE_OFF,
@ -18,7 +19,6 @@ from homeassistant.core import Context, HomeAssistant, State
from . import ( from . import (
ATTR_AWAY_MODE, ATTR_AWAY_MODE,
ATTR_OPERATION_MODE, ATTR_OPERATION_MODE,
ATTR_TEMPERATURE,
DOMAIN, DOMAIN,
SERVICE_SET_AWAY_MODE, SERVICE_SET_AWAY_MODE,
SERVICE_SET_OPERATION_MODE, SERVICE_SET_OPERATION_MODE,