Skip to content

Commit

Permalink
Update from core, bump bimmer_connected to 0.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
rikroe committed Dec 5, 2021
1 parent 5427656 commit 7ef5a81
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
4 changes: 0 additions & 4 deletions custom_components/bmw_connected_drive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
CONF_ACCOUNT,
CONF_ALLOWED_REGIONS,
CONF_READ_ONLY,
CONF_USE_LOCATION,
DATA_ENTRIES,
DATA_HASS_CONFIG,
)
Expand Down Expand Up @@ -109,9 +108,6 @@ def _async_migrate_options_from_data_if_missing(
options = dict(DEFAULT_OPTIONS, **options)
options[CONF_READ_ONLY] = data.pop(CONF_READ_ONLY, False)

# Remove CONF_USE_LOCATION as we have to use it by default
options.pop(CONF_USE_LOCATION, None)

hass.config_entries.async_update_entry(entry, data=data, options=options)


Expand Down
2 changes: 1 addition & 1 deletion custom_components/bmw_connected_drive/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "BMW Connected Drive",
"version": "20211117.3",
"documentation": "https://www.home-assistant.io/integrations/bmw_connected_drive",
"requirements": ["bimmer_connected==0.8.3.0b4"],
"requirements": ["bimmer_connected==0.8.5"],
"codeowners": ["@gerard33", "@rikroe"],
"config_flow": true,
"iot_class": "cloud_polling"
Expand Down
21 changes: 6 additions & 15 deletions custom_components/bmw_connected_drive/sensor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Support for reading vehicle status from BMW connected drive portal."""
from __future__ import annotations

from collections.abc import Callable, Mapping
from collections.abc import Callable
from dataclasses import dataclass
import logging
from typing import Any, cast
from typing import cast

from bimmer_connected.vehicle import ConnectedDriveVehicle

Expand Down Expand Up @@ -43,7 +43,6 @@ class BMWSensorEntityDescription(SensorEntityDescription):
unit_metric: str | None = None
unit_imperial: str | None = None
value: Callable = lambda x, y: x
extra_attributes: dict | None = None


SENSOR_TYPES: dict[str, BMWSensorEntityDescription] = {
Expand All @@ -56,9 +55,11 @@ class BMWSensorEntityDescription(SensorEntityDescription):
),
"charging_end_time": BMWSensorEntityDescription(
key="charging_end_time",
icon="mdi:update",
device_class=DEVICE_CLASS_TIMESTAMP,
extra_attributes={"original_value": "charging_end_time_original"},
),
"charging_end_time_mybmw": BMWSensorEntityDescription(
key="charging_end_time_original",
entity_registry_enabled_default=False,
),
"charging_status": BMWSensorEntityDescription(
key="charging_status",
Expand Down Expand Up @@ -179,13 +180,3 @@ def native_value(self) -> StateType:
"""Return the state."""
state = getattr(self._vehicle.status, self.entity_description.key)
return cast(StateType, self.entity_description.value(state, self.hass))

@property
def extra_state_attributes(self) -> Mapping[str, Any] | None:
"""Return the attributes."""
if self.entity_description.extra_attributes:
return {
k: getattr(self._vehicle.status, v)
for k, v in self.entity_description.extra_attributes.items()
}
return None
3 changes: 1 addition & 2 deletions custom_components/bmw_connected_drive/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"step": {
"account_options": {
"data": {
"read_only": "Read-only (only sensors and notify, no execution of services, no lock)",
"use_location": "Use Home Assistant location for car location polls (required for non i3/i8 vehicles produced before 7/2014)"
"read_only": "Read-only (only sensors and notify, no execution of services, no lock)"
}
}
}
Expand Down

0 comments on commit 7ef5a81

Please sign in to comment.