Move imports in bmw_connected_drive component (#27853)

This commit is contained in:
bouni 2019-10-18 17:14:01 +02:00 committed by cgtobi
parent 03cc7f377b
commit 56dde68c5b
4 changed files with 10 additions and 8 deletions

View File

@ -1,12 +1,14 @@
"""Reads vehicle status from BMW connected drive portal."""
import logging
from bimmer_connected.account import ConnectedDriveAccount
from bimmer_connected.country_selector import get_region_from_name
import voluptuous as vol
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers import discovery
from homeassistant.helpers.event import track_utc_time_change
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import track_utc_time_change
import homeassistant.util.dt as dt_util
_LOGGER = logging.getLogger(__name__)
@ -118,8 +120,6 @@ class BMWConnectedDriveAccount:
self, username: str, password: str, region_str: str, name: str, read_only
) -> None:
"""Constructor."""
from bimmer_connected.account import ConnectedDriveAccount
from bimmer_connected.country_selector import get_region_from_name
region = get_region_from_name(region_str)

View File

@ -1,6 +1,8 @@
"""Reads vehicle status from BMW connected drive portal."""
import logging
from bimmer_connected.state import ChargingState, LockState
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import LENGTH_KILOMETERS
@ -141,8 +143,6 @@ class BMWConnectedDriveSensor(BinarySensorDevice):
def update(self):
"""Read new state data from the library."""
from bimmer_connected.state import LockState
from bimmer_connected.state import ChargingState
vehicle_state = self._vehicle.state

View File

@ -1,6 +1,8 @@
"""Support for BMW car locks with BMW ConnectedDrive."""
import logging
from bimmer_connected.state import LockState
from homeassistant.components.lock import LockDevice
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
@ -87,7 +89,6 @@ class BMWLock(LockDevice):
def update(self):
"""Update state of the lock."""
from bimmer_connected.state import LockState
_LOGGER.debug("%s: updating data for %s", self._vehicle.name, self._attribute)
vehicle_state = self._vehicle.state

View File

@ -1,6 +1,8 @@
"""Support for reading vehicle status from BMW connected drive portal."""
import logging
from bimmer_connected.state import ChargingState
from homeassistant.const import (
CONF_UNIT_SYSTEM_IMPERIAL,
LENGTH_KILOMETERS,
@ -97,7 +99,6 @@ class BMWConnectedDriveSensor(Entity):
@property
def icon(self):
"""Icon to use in the frontend, if any."""
from bimmer_connected.state import ChargingState
vehicle_state = self._vehicle.state
charging_state = vehicle_state.charging_status in [ChargingState.CHARGING]