Bump bimmer_connected to 0.15.3 (#118179)

Co-authored-by: Richard <rikroe@users.noreply.github.com>
This commit is contained in:
Richard Kroegel 2024-05-27 11:01:22 +02:00 committed by GitHub
parent 481c50f7a5
commit 10291b1ce8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 116 additions and 6 deletions

View File

@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/bmw_connected_drive", "documentation": "https://www.home-assistant.io/integrations/bmw_connected_drive",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["bimmer_connected"], "loggers": ["bimmer_connected"],
"requirements": ["bimmer-connected[china]==0.15.2"] "requirements": ["bimmer-connected[china]==0.15.3"]
} }

View File

@ -4,6 +4,7 @@ from __future__ import annotations
from collections.abc import Callable from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
import datetime
import logging import logging
from typing import cast from typing import cast
@ -21,6 +22,7 @@ from homeassistant.const import LENGTH, PERCENTAGE, VOLUME, UnitOfElectricCurren
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType from homeassistant.helpers.typing import StateType
from homeassistant.util import dt as dt_util
from . import BMWBaseEntity from . import BMWBaseEntity
from .const import CLIMATE_ACTIVITY_STATE, DOMAIN, UNIT_MAP from .const import CLIMATE_ACTIVITY_STATE, DOMAIN, UNIT_MAP
@ -219,6 +221,11 @@ class BMWSensor(BMWBaseEntity, SensorEntity):
getattr(self.vehicle, self.entity_description.key_class), getattr(self.vehicle, self.entity_description.key_class),
self.entity_description.key, self.entity_description.key,
) )
# For datetime without tzinfo, we assume it to be the same timezone as the HA instance
if isinstance(state, datetime.datetime) and state.tzinfo is None:
state = state.replace(tzinfo=dt_util.get_default_time_zone())
self._attr_native_value = cast( self._attr_native_value = cast(
StateType, self.entity_description.value(state, self.hass) StateType, self.entity_description.value(state, self.hass)
) )

View File

@ -553,7 +553,7 @@ beautifulsoup4==4.12.3
bellows==0.38.4 bellows==0.38.4
# homeassistant.components.bmw_connected_drive # homeassistant.components.bmw_connected_drive
bimmer-connected[china]==0.15.2 bimmer-connected[china]==0.15.3
# homeassistant.components.bizkaibus # homeassistant.components.bizkaibus
bizkaibus==0.1.1 bizkaibus==0.1.1

View File

@ -478,7 +478,7 @@ beautifulsoup4==4.12.3
bellows==0.38.4 bellows==0.38.4
# homeassistant.components.bmw_connected_drive # homeassistant.components.bmw_connected_drive
bimmer-connected[china]==0.15.2 bimmer-connected[china]==0.15.3
# homeassistant.components.eq3btsmart # homeassistant.components.eq3btsmart
# homeassistant.components.esphome # homeassistant.components.esphome

View File

@ -43,6 +43,7 @@ FIXTURE_CONFIG_ENTRY = {
async def setup_mocked_integration(hass: HomeAssistant) -> MockConfigEntry: async def setup_mocked_integration(hass: HomeAssistant) -> MockConfigEntry:
"""Mock a fully setup config entry and all components based on fixtures.""" """Mock a fully setup config entry and all components based on fixtures."""
# Mock config entry and add to HA
mock_config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY) mock_config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY)
mock_config_entry.add_to_hass(hass) mock_config_entry.add_to_hass(hass)

View File

@ -1706,7 +1706,23 @@
'windows', 'windows',
]), ]),
'brand': 'bmw', 'brand': 'bmw',
'charging_profile': None, 'charging_profile': dict({
'ac_available_limits': None,
'ac_current_limit': None,
'charging_mode': 'IMMEDIATE_CHARGING',
'charging_preferences': 'NO_PRESELECTION',
'charging_preferences_service_pack': None,
'departure_times': list([
]),
'is_pre_entry_climatization_enabled': False,
'preferred_charging_window': dict({
'_window_dict': dict({
}),
'end_time': '00:00:00',
'start_time': '00:00:00',
}),
'timer_type': 'UNKNOWN',
}),
'check_control_messages': dict({ 'check_control_messages': dict({
'has_check_control_messages': False, 'has_check_control_messages': False,
'messages': list([ 'messages': list([
@ -2861,7 +2877,7 @@
]), ]),
'fuel_and_battery': dict({ 'fuel_and_battery': dict({
'charging_end_time': None, 'charging_end_time': None,
'charging_start_time': '2022-07-10T18:01:00+00:00', 'charging_start_time': '2022-07-10T18:01:00',
'charging_status': 'WAITING_FOR_CHARGING', 'charging_status': 'WAITING_FOR_CHARGING',
'charging_target': 100, 'charging_target': 100,
'is_charger_connected': True, 'is_charger_connected': True,
@ -5263,7 +5279,7 @@
]), ]),
'fuel_and_battery': dict({ 'fuel_and_battery': dict({
'charging_end_time': None, 'charging_end_time': None,
'charging_start_time': '2022-07-10T18:01:00+00:00', 'charging_start_time': '2022-07-10T18:01:00',
'charging_status': 'WAITING_FOR_CHARGING', 'charging_status': 'WAITING_FOR_CHARGING',
'charging_target': 100, 'charging_target': 100,
'is_charger_connected': True, 'is_charger_connected': True,

View File

@ -1,6 +1,32 @@
# serializer version: 1 # serializer version: 1
# name: test_entity_state_attrs # name: test_entity_state_attrs
list([ list([
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'iX xDrive50 AC current limit',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
}),
'context': <ANY>,
'entity_id': 'sensor.ix_xdrive50_ac_current_limit',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '16',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'device_class': 'timestamp',
'friendly_name': 'iX xDrive50 Charging start time',
}),
'context': <ANY>,
'entity_id': 'sensor.ix_xdrive50_charging_start_time',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
}),
StateSnapshot({ StateSnapshot({
'attributes': ReadOnlyDict({ 'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW', 'attribution': 'Data provided by MyBMW',
@ -115,6 +141,32 @@
'last_updated': <ANY>, 'last_updated': <ANY>,
'state': 'inactive', 'state': 'inactive',
}), }),
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'i4 eDrive40 AC current limit',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
}),
'context': <ANY>,
'entity_id': 'sensor.i4_edrive40_ac_current_limit',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '16',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'device_class': 'timestamp',
'friendly_name': 'i4 eDrive40 Charging start time',
}),
'context': <ANY>,
'entity_id': 'sensor.i4_edrive40_charging_start_time',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
}),
StateSnapshot({ StateSnapshot({
'attributes': ReadOnlyDict({ 'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW', 'attribution': 'Data provided by MyBMW',
@ -318,6 +370,32 @@
'last_updated': <ANY>, 'last_updated': <ANY>,
'state': 'inactive', 'state': 'inactive',
}), }),
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'i3 (+ REX) AC current limit',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
}),
'context': <ANY>,
'entity_id': 'sensor.i3_rex_ac_current_limit',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'device_class': 'timestamp',
'friendly_name': 'i3 (+ REX) Charging start time',
}),
'context': <ANY>,
'entity_id': 'sensor.i3_rex_charging_start_time',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '2023-06-23T01:01:00+00:00',
}),
StateSnapshot({ StateSnapshot({
'attributes': ReadOnlyDict({ 'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW', 'attribution': 'Data provided by MyBMW',

View File

@ -17,6 +17,7 @@ from . import check_remote_service_call, setup_mocked_integration
async def test_entity_state_attrs( async def test_entity_state_attrs(
hass: HomeAssistant, hass: HomeAssistant,
bmw_fixture: respx.Router, bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test button options and values.""" """Test button options and values."""

View File

@ -23,6 +23,7 @@ async def test_config_entry_diagnostics(
hass: HomeAssistant, hass: HomeAssistant,
hass_client: ClientSessionGenerator, hass_client: ClientSessionGenerator,
bmw_fixture, bmw_fixture,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test config entry diagnostics.""" """Test config entry diagnostics."""
@ -42,6 +43,7 @@ async def test_device_diagnostics(
hass_client: ClientSessionGenerator, hass_client: ClientSessionGenerator,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
bmw_fixture, bmw_fixture,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test device diagnostics.""" """Test device diagnostics."""
@ -66,6 +68,7 @@ async def test_device_diagnostics_vehicle_not_found(
hass_client: ClientSessionGenerator, hass_client: ClientSessionGenerator,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
bmw_fixture, bmw_fixture,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test device diagnostics when the vehicle cannot be found.""" """Test device diagnostics when the vehicle cannot be found."""

View File

@ -17,6 +17,7 @@ from . import check_remote_service_call, setup_mocked_integration
async def test_entity_state_attrs( async def test_entity_state_attrs(
hass: HomeAssistant, hass: HomeAssistant,
bmw_fixture: respx.Router, bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test number options and values..""" """Test number options and values.."""

View File

@ -17,6 +17,7 @@ from . import check_remote_service_call, setup_mocked_integration
async def test_entity_state_attrs( async def test_entity_state_attrs(
hass: HomeAssistant, hass: HomeAssistant,
bmw_fixture: respx.Router, bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test select options and values..""" """Test select options and values.."""

View File

@ -19,6 +19,7 @@ from . import setup_mocked_integration
async def test_entity_state_attrs( async def test_entity_state_attrs(
hass: HomeAssistant, hass: HomeAssistant,
bmw_fixture: respx.Router, bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test sensor options and values..""" """Test sensor options and values.."""

View File

@ -17,6 +17,7 @@ from . import check_remote_service_call, setup_mocked_integration
async def test_entity_state_attrs( async def test_entity_state_attrs(
hass: HomeAssistant, hass: HomeAssistant,
bmw_fixture: respx.Router, bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test switch options and values..""" """Test switch options and values.."""