Move esphome imports at top-level (#29064)
This commit is contained in:
1 parent
87de5db535
commit
8a413b152d
6 files changed
+16
-30
No files matched your search
@@ -1,5 +1,4 @@
|
||||
"""Support for ESPHome binary sensors."""
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from aioesphomeapi import BinarySensorInfo, BinarySensorState
|
||||
@@ -8,8 +7,6 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
|
||||
from . import EsphomeEntity, platform_async_setup_entry
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry, async_add_entities):
|
||||
"""Set up ESPHome binary sensors based on a config entry."""
|
||||
|
||||
@@ -20,8 +20,8 @@ from homeassistant.components.climate.const import (
|
||||
CURRENT_HVAC_DRY,
|
||||
CURRENT_HVAC_FAN,
|
||||
CURRENT_HVAC_HEAT,
|
||||
CURRENT_HVAC_OFF,
|
||||
CURRENT_HVAC_IDLE,
|
||||
CURRENT_HVAC_OFF,
|
||||
FAN_AUTO,
|
||||
FAN_DIFFUSE,
|
||||
FAN_FOCUS,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Optional
|
||||
|
||||
from aioesphomeapi import APIClient, APIConnectionError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
@@ -147,8 +148,6 @@ class EsphomeFlowHandler(config_entries.ConfigFlow):
|
||||
|
||||
async def fetch_device_info(self):
|
||||
"""Fetch device info from API and return any errors."""
|
||||
from aioesphomeapi import APIClient, APIConnectionError
|
||||
|
||||
cli = APIClient(self.hass.loop, self._host, self._port, "")
|
||||
|
||||
try:
|
||||
@@ -165,8 +164,6 @@ class EsphomeFlowHandler(config_entries.ConfigFlow):
|
||||
|
||||
async def try_login(self):
|
||||
"""Try logging in to device and return any errors."""
|
||||
from aioesphomeapi import APIClient, APIConnectionError
|
||||
|
||||
cli = APIClient(self.hass.loop, self._host, self._port, self._password)
|
||||
|
||||
try:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from aioesphomeapi import CoverInfo, CoverState
|
||||
from aioesphomeapi import CoverInfo, CoverOperation, CoverState
|
||||
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
@@ -82,15 +82,11 @@ class EsphomeCover(EsphomeEntity, CoverDevice):
|
||||
@esphome_state_property
|
||||
def is_opening(self) -> bool:
|
||||
"""Return if the cover is opening or not."""
|
||||
from aioesphomeapi import CoverOperation
|
||||
|
||||
return self._state.current_operation == CoverOperation.IS_OPENING
|
||||
|
||||
@esphome_state_property
|
||||
def is_closing(self) -> bool:
|
||||
"""Return if the cover is closing or not."""
|
||||
from aioesphomeapi import CoverOperation
|
||||
|
||||
return self._state.current_operation == CoverOperation.IS_CLOSING
|
||||
|
||||
@esphome_state_property
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
"""Runtime entry data for ESPHome stored in hass.data."""
|
||||
import asyncio
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Set
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
|
||||
|
||||
from aioesphomeapi import (
|
||||
COMPONENT_TYPE_TO_INFO,
|
||||
DeviceInfo,
|
||||
EntityInfo,
|
||||
EntityState,
|
||||
UserService,
|
||||
BinarySensorInfo,
|
||||
CameraInfo,
|
||||
ClimateInfo,
|
||||
CoverInfo,
|
||||
DeviceInfo,
|
||||
EntityInfo,
|
||||
EntityState,
|
||||
FanInfo,
|
||||
LightInfo,
|
||||
SensorInfo,
|
||||
SwitchInfo,
|
||||
TextSensorInfo,
|
||||
UserService,
|
||||
)
|
||||
import attr
|
||||
|
||||
|
||||
Reference in new issue
Block a user