Add AC current limit and Pre entry climatization (#92688)

* Add AC current limit and Pre entry climatization

Additional information available for EVs

* Add pre entry climatization

* Fix mypy error

* Change for black and mypy
This commit is contained in:
Gerard 2023-05-07 12:46:00 +02:00 committed by GitHub
parent 16c915864b
commit 8c67e96e38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -189,6 +189,14 @@ SENSOR_TYPES: tuple[BMWBinarySensorEntityDescription, ...] = (
icon="mdi:car-electric",
value_fn=lambda v: v.fuel_and_battery.is_charger_connected,
),
BMWBinarySensorEntityDescription(
key="is_pre_entry_climatization_enabled",
name="Pre entry climatization",
icon="mdi:car-seat-heater",
value_fn=lambda v: v.charging_profile.is_pre_entry_climatization_enabled
if v.charging_profile
else False,
),
)

View file

@ -15,7 +15,7 @@ from homeassistant.components.sensor import (
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import LENGTH, PERCENTAGE, VOLUME
from homeassistant.const import LENGTH, PERCENTAGE, VOLUME, UnitOfElectricCurrent
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
@ -53,6 +53,14 @@ def convert_and_round(
SENSOR_TYPES: dict[str, BMWSensorEntityDescription] = {
# --- Generic ---
"ac_current_limit": BMWSensorEntityDescription(
key="ac_current_limit",
name="AC current limit",
key_class="charging_profile",
unit_type=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-ac",
entity_registry_enabled_default=False,
),
"charging_start_time": BMWSensorEntityDescription(
key="charging_start_time",
name="Charging start time",