Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bump bimmer_connected to 0.15.3 #118179

Merged
merged 3 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/bmw_connected_drive/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/bmw_connected_drive",
"iot_class": "cloud_polling",
"loggers": ["bimmer_connected"],
"requirements": ["bimmer-connected[china]==0.15.2"]
"requirements": ["bimmer-connected[china]==0.15.3"]
}
7 changes: 7 additions & 0 deletions homeassistant/components/bmw_connected_drive/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from collections.abc import Callable
from dataclasses import dataclass
import datetime
import logging
from typing import cast

Expand All @@ -21,6 +22,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from homeassistant.util import dt as dt_util

from . import BMWBaseEntity
from .const import CLIMATE_ACTIVITY_STATE, DOMAIN, UNIT_MAP
Expand Down Expand Up @@ -219,6 +221,11 @@ def _handle_coordinator_update(self) -> None:
getattr(self.vehicle, self.entity_description.key_class),
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(
StateType, self.entity_description.value(state, self.hass)
)
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ beautifulsoup4==4.12.3
bellows==0.38.4

# homeassistant.components.bmw_connected_drive
bimmer-connected[china]==0.15.2
bimmer-connected[china]==0.15.3

# homeassistant.components.bizkaibus
bizkaibus==0.1.1
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ beautifulsoup4==4.12.3
bellows==0.38.4

# homeassistant.components.bmw_connected_drive
bimmer-connected[china]==0.15.2
bimmer-connected[china]==0.15.3

# homeassistant.components.eq3btsmart
# homeassistant.components.esphome
Expand Down
1 change: 1 addition & 0 deletions tests/components/bmw_connected_drive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
async def setup_mocked_integration(hass: HomeAssistant) -> MockConfigEntry:
"""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.add_to_hass(hass)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,23 @@
'windows',
]),
'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({
'has_check_control_messages': False,
'messages': list([
Expand Down Expand Up @@ -2861,7 +2877,7 @@
]),
'fuel_and_battery': dict({
'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_target': 100,
'is_charger_connected': True,
Expand Down Expand Up @@ -5263,7 +5279,7 @@
]),
'fuel_and_battery': dict({
'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_target': 100,
'is_charger_connected': True,
Expand Down
78 changes: 78 additions & 0 deletions tests/components/bmw_connected_drive/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
# serializer version: 1
# name: test_entity_state_attrs
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({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
Expand Down Expand Up @@ -115,6 +141,32 @@
'last_updated': <ANY>,
'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({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
Expand Down Expand Up @@ -318,6 +370,32 @@
'last_updated': <ANY>,
'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({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
Expand Down
1 change: 1 addition & 0 deletions tests/components/bmw_connected_drive/test_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
async def test_entity_state_attrs(
hass: HomeAssistant,
bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test button options and values."""
Expand Down
3 changes: 3 additions & 0 deletions tests/components/bmw_connected_drive/test_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ async def test_config_entry_diagnostics(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
bmw_fixture,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test config entry diagnostics."""
Expand All @@ -42,6 +43,7 @@ async def test_device_diagnostics(
hass_client: ClientSessionGenerator,
device_registry: dr.DeviceRegistry,
bmw_fixture,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test device diagnostics."""
Expand All @@ -66,6 +68,7 @@ async def test_device_diagnostics_vehicle_not_found(
hass_client: ClientSessionGenerator,
device_registry: dr.DeviceRegistry,
bmw_fixture,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test device diagnostics when the vehicle cannot be found."""
Expand Down
1 change: 1 addition & 0 deletions tests/components/bmw_connected_drive/test_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
async def test_entity_state_attrs(
hass: HomeAssistant,
bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test number options and values.."""
Expand Down
1 change: 1 addition & 0 deletions tests/components/bmw_connected_drive/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
async def test_entity_state_attrs(
hass: HomeAssistant,
bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test select options and values.."""
Expand Down
1 change: 1 addition & 0 deletions tests/components/bmw_connected_drive/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
async def test_entity_state_attrs(
hass: HomeAssistant,
bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test sensor options and values.."""
Expand Down
1 change: 1 addition & 0 deletions tests/components/bmw_connected_drive/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
async def test_entity_state_attrs(
hass: HomeAssistant,
bmw_fixture: respx.Router,
entity_registry_enabled_by_default: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test switch options and values.."""
Expand Down