mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Add basic type hints to nissan_leaf (#62904)
This commit is contained in:
parent
d63b7bc5f1
commit
68acf13f48
@ -1,22 +1,32 @@
|
||||
"""Plugged In Status Support for the Nissan Leaf."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DATA_CHARGING, DATA_LEAF, DATA_PLUGGED_IN, LeafEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up of a Nissan Leaf binary sensor."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
devices = []
|
||||
devices: list[LeafEntity] = []
|
||||
for vin, datastore in hass.data[DATA_LEAF].items():
|
||||
_LOGGER.debug("Adding binary_sensors for vin=%s", vin)
|
||||
devices.append(LeafPluggedInSensor(datastore))
|
||||
|
@ -1,9 +1,14 @@
|
||||
"""Battery Charge and Range Support for the Nissan Leaf."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||
from homeassistant.const import PERCENTAGE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util.distance import LENGTH_KILOMETERS, LENGTH_MILES
|
||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM, METRIC_SYSTEM
|
||||
|
||||
@ -21,12 +26,17 @@ _LOGGER = logging.getLogger(__name__)
|
||||
ICON_RANGE = "mdi:speedometer"
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_devices: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Sensors setup."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
devices = []
|
||||
devices: list[LeafEntity] = []
|
||||
for vin, datastore in hass.data[DATA_LEAF].items():
|
||||
_LOGGER.debug("Adding sensors for vin=%s", vin)
|
||||
devices.append(LeafBatterySensor(datastore))
|
||||
|
@ -1,14 +1,24 @@
|
||||
"""Charge and Climate Control Support for the Nissan Leaf."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DATA_CLIMATE, DATA_LEAF, LeafEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_devices: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Nissan Leaf switch platform setup."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user