From 8c67e96e38bff3155736cd3db5fe3be480db23c8 Mon Sep 17 00:00:00 2001 From: Gerard Date: Sun, 7 May 2023 12:46:00 +0200 Subject: [PATCH] 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 --- .../components/bmw_connected_drive/binary_sensor.py | 8 ++++++++ homeassistant/components/bmw_connected_drive/sensor.py | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/bmw_connected_drive/binary_sensor.py b/homeassistant/components/bmw_connected_drive/binary_sensor.py index df25efb6d5e..640f4e3653b 100644 --- a/homeassistant/components/bmw_connected_drive/binary_sensor.py +++ b/homeassistant/components/bmw_connected_drive/binary_sensor.py @@ -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, + ), ) diff --git a/homeassistant/components/bmw_connected_drive/sensor.py b/homeassistant/components/bmw_connected_drive/sensor.py index b15a95fde24..314ff47c14c 100644 --- a/homeassistant/components/bmw_connected_drive/sensor.py +++ b/homeassistant/components/bmw_connected_drive/sensor.py @@ -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",