Skip to content

Commit

Permalink
Add BMW current and target tire pressure
Browse files Browse the repository at this point in the history
  • Loading branch information
rikroe committed Jul 6, 2024
1 parent 48145c1 commit 81a2523
Show file tree
Hide file tree
Showing 3 changed files with 3,740 additions and 462 deletions.
30 changes: 30 additions & 0 deletions homeassistant/components/bmw_connected_drive/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
STATE_UNKNOWN,
UnitOfElectricCurrent,
UnitOfLength,
UnitOfPressure,
UnitOfVolume,
)
from homeassistant.core import HomeAssistant, callback
Expand All @@ -44,6 +45,8 @@ class BMWSensorEntityDescription(SensorEntityDescription):
is_available: Callable[[MyBMWVehicle], bool] = lambda v: v.is_lsc_enabled


TIRES = ["front_left", "front_right", "rear_left", "rear_right"]

SENSOR_TYPES: list[BMWSensorEntityDescription] = [
BMWSensorEntityDescription(
key="charging_profile.ac_current_limit",
Expand Down Expand Up @@ -153,6 +156,33 @@ class BMWSensorEntityDescription(SensorEntityDescription):
],
is_available=lambda v: v.is_remote_climate_stop_enabled,
),
*[
BMWSensorEntityDescription(
key=f"tires.{tire}.current_pressure",
translation_key=f"{tire}_current_pressure",
device_class=SensorDeviceClass.PRESSURE,
native_unit_of_measurement=UnitOfPressure.KPA,
suggested_unit_of_measurement=UnitOfPressure.BAR,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=2,
is_available=lambda v: v.is_lsc_enabled and v.tires is not None,
)
for tire in TIRES
],
*[
BMWSensorEntityDescription(
key=f"tires.{tire}.target_pressure",
translation_key=f"{tire}_target_pressure",
device_class=SensorDeviceClass.PRESSURE,
native_unit_of_measurement=UnitOfPressure.KPA,
suggested_unit_of_measurement=UnitOfPressure.BAR,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=2,
entity_registry_enabled_default=False,
is_available=lambda v: v.is_lsc_enabled and v.tires is not None,
)
for tire in TIRES
],
]


Expand Down
24 changes: 24 additions & 0 deletions homeassistant/components/bmw_connected_drive/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,30 @@
"inactive": "Inactive",
"standby": "Standby"
}
},
"front_left_current_pressure": {
"name": "Front left tire pressure"
},
"front_right_current_pressure": {
"name": "Front right tire pressure"
},
"rear_left_current_pressure": {
"name": "Rear left tire pressure"
},
"rear_right_current_pressure": {
"name": "Rear right tire pressure"
},
"front_left_target_pressure": {
"name": "Front left target pressure"
},
"front_right_target_pressure": {
"name": "Front right target pressure"
},
"rear_left_target_pressure": {
"name": "Rear left target pressure"
},
"rear_right_target_pressure": {
"name": "Rear right target pressure"
}
},
"switch": {
Expand Down
Loading

0 comments on commit 81a2523

Please sign in to comment.