mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Move imports in bmw_connected_drive component (#27853)
This commit is contained in:
parent
03cc7f377b
commit
56dde68c5b
@ -1,12 +1,14 @@
|
|||||||
"""Reads vehicle status from BMW connected drive portal."""
|
"""Reads vehicle status from BMW connected drive portal."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from bimmer_connected.account import ConnectedDriveAccount
|
||||||
|
from bimmer_connected.country_selector import get_region_from_name
|
||||||
import voluptuous as vol
|
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 import discovery
|
||||||
from homeassistant.helpers.event import track_utc_time_change
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.event import track_utc_time_change
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -118,8 +120,6 @@ class BMWConnectedDriveAccount:
|
|||||||
self, username: str, password: str, region_str: str, name: str, read_only
|
self, username: str, password: str, region_str: str, name: str, read_only
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Constructor."""
|
"""Constructor."""
|
||||||
from bimmer_connected.account import ConnectedDriveAccount
|
|
||||||
from bimmer_connected.country_selector import get_region_from_name
|
|
||||||
|
|
||||||
region = get_region_from_name(region_str)
|
region = get_region_from_name(region_str)
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"""Reads vehicle status from BMW connected drive portal."""
|
"""Reads vehicle status from BMW connected drive portal."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from bimmer_connected.state import ChargingState, LockState
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
from homeassistant.const import LENGTH_KILOMETERS
|
from homeassistant.const import LENGTH_KILOMETERS
|
||||||
|
|
||||||
@ -141,8 +143,6 @@ class BMWConnectedDriveSensor(BinarySensorDevice):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Read new state data from the library."""
|
"""Read new state data from the library."""
|
||||||
from bimmer_connected.state import LockState
|
|
||||||
from bimmer_connected.state import ChargingState
|
|
||||||
|
|
||||||
vehicle_state = self._vehicle.state
|
vehicle_state = self._vehicle.state
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"""Support for BMW car locks with BMW ConnectedDrive."""
|
"""Support for BMW car locks with BMW ConnectedDrive."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from bimmer_connected.state import LockState
|
||||||
|
|
||||||
from homeassistant.components.lock import LockDevice
|
from homeassistant.components.lock import LockDevice
|
||||||
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
|
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
|
||||||
|
|
||||||
@ -87,7 +89,6 @@ class BMWLock(LockDevice):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update state of the lock."""
|
"""Update state of the lock."""
|
||||||
from bimmer_connected.state import LockState
|
|
||||||
|
|
||||||
_LOGGER.debug("%s: updating data for %s", self._vehicle.name, self._attribute)
|
_LOGGER.debug("%s: updating data for %s", self._vehicle.name, self._attribute)
|
||||||
vehicle_state = self._vehicle.state
|
vehicle_state = self._vehicle.state
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"""Support for reading vehicle status from BMW connected drive portal."""
|
"""Support for reading vehicle status from BMW connected drive portal."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from bimmer_connected.state import ChargingState
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_UNIT_SYSTEM_IMPERIAL,
|
CONF_UNIT_SYSTEM_IMPERIAL,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
@ -97,7 +99,6 @@ class BMWConnectedDriveSensor(Entity):
|
|||||||
@property
|
@property
|
||||||
def icon(self):
|
def icon(self):
|
||||||
"""Icon to use in the frontend, if any."""
|
"""Icon to use in the frontend, if any."""
|
||||||
from bimmer_connected.state import ChargingState
|
|
||||||
|
|
||||||
vehicle_state = self._vehicle.state
|
vehicle_state = self._vehicle.state
|
||||||
charging_state = vehicle_state.charging_status in [ChargingState.CHARGING]
|
charging_state = vehicle_state.charging_status in [ChargingState.CHARGING]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user