mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix CCM messages (#26589)
This commit is contained in:
parent
63cf21296c
commit
41f96a315e
@ -9,7 +9,7 @@ from . import DOMAIN as BMW_DOMAIN
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
"lids": ["Doors", "opening", "mdi:car-door"],
|
"lids": ["Doors", "opening", "mdi:car-door-lock"],
|
||||||
"windows": ["Windows", "opening", "mdi:car-door"],
|
"windows": ["Windows", "opening", "mdi:car-door"],
|
||||||
"door_lock_state": ["Door lock state", "safety", "mdi:car-key"],
|
"door_lock_state": ["Door lock state", "safety", "mdi:car-key"],
|
||||||
"lights_parking": ["Parking lights", "light", "mdi:car-parking-lights"],
|
"lights_parking": ["Parking lights", "light", "mdi:car-parking-lights"],
|
||||||
@ -122,8 +122,9 @@ class BMWConnectedDriveSensor(BinarySensorDevice):
|
|||||||
for report in vehicle_state.condition_based_services:
|
for report in vehicle_state.condition_based_services:
|
||||||
result.update(self._format_cbs_report(report))
|
result.update(self._format_cbs_report(report))
|
||||||
elif self._attribute == "check_control_messages":
|
elif self._attribute == "check_control_messages":
|
||||||
check_control_messages = vehicle_state.has_check_control_messages
|
check_control_messages = vehicle_state.check_control_messages
|
||||||
if check_control_messages:
|
has_check_control_messages = vehicle_state.has_check_control_messages
|
||||||
|
if has_check_control_messages:
|
||||||
cbs_list = []
|
cbs_list = []
|
||||||
for message in check_control_messages:
|
for message in check_control_messages:
|
||||||
cbs_list.append(message["ccmDescriptionShort"])
|
cbs_list.append(message["ccmDescriptionShort"])
|
||||||
@ -184,9 +185,9 @@ class BMWConnectedDriveSensor(BinarySensorDevice):
|
|||||||
distance = round(
|
distance = round(
|
||||||
self.hass.config.units.length(report.due_distance, LENGTH_KILOMETERS)
|
self.hass.config.units.length(report.due_distance, LENGTH_KILOMETERS)
|
||||||
)
|
)
|
||||||
result[f"{service_type} distance"] = "{} {}".format(
|
result[
|
||||||
distance, self.hass.config.units.length_unit
|
f"{service_type} distance"
|
||||||
)
|
] = f"{distance} {self.hass.config.units.length_unit}"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def update_callback(self):
|
def update_callback(self):
|
||||||
|
@ -17,10 +17,10 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
ATTR_TO_HA_METRIC = {
|
ATTR_TO_HA_METRIC = {
|
||||||
"mileage": ["mdi:speedometer", LENGTH_KILOMETERS],
|
"mileage": ["mdi:speedometer", LENGTH_KILOMETERS],
|
||||||
"remaining_range_total": ["mdi:ruler", LENGTH_KILOMETERS],
|
"remaining_range_total": ["mdi:map-marker-distance", LENGTH_KILOMETERS],
|
||||||
"remaining_range_electric": ["mdi:ruler", LENGTH_KILOMETERS],
|
"remaining_range_electric": ["mdi:map-marker-distance", LENGTH_KILOMETERS],
|
||||||
"remaining_range_fuel": ["mdi:ruler", LENGTH_KILOMETERS],
|
"remaining_range_fuel": ["mdi:map-marker-distance", LENGTH_KILOMETERS],
|
||||||
"max_range_electric": ["mdi:ruler", LENGTH_KILOMETERS],
|
"max_range_electric": ["mdi:map-marker-distance", LENGTH_KILOMETERS],
|
||||||
"remaining_fuel": ["mdi:gas-station", VOLUME_LITERS],
|
"remaining_fuel": ["mdi:gas-station", VOLUME_LITERS],
|
||||||
"charging_time_remaining": ["mdi:update", "h"],
|
"charging_time_remaining": ["mdi:update", "h"],
|
||||||
"charging_status": ["mdi:battery-charging", None],
|
"charging_status": ["mdi:battery-charging", None],
|
||||||
@ -28,10 +28,10 @@ ATTR_TO_HA_METRIC = {
|
|||||||
|
|
||||||
ATTR_TO_HA_IMPERIAL = {
|
ATTR_TO_HA_IMPERIAL = {
|
||||||
"mileage": ["mdi:speedometer", LENGTH_MILES],
|
"mileage": ["mdi:speedometer", LENGTH_MILES],
|
||||||
"remaining_range_total": ["mdi:ruler", LENGTH_MILES],
|
"remaining_range_total": ["mdi:map-marker-distance", LENGTH_MILES],
|
||||||
"remaining_range_electric": ["mdi:ruler", LENGTH_MILES],
|
"remaining_range_electric": ["mdi:map-marker-distance", LENGTH_MILES],
|
||||||
"remaining_range_fuel": ["mdi:ruler", LENGTH_MILES],
|
"remaining_range_fuel": ["mdi:map-marker-distance", LENGTH_MILES],
|
||||||
"max_range_electric": ["mdi:ruler", LENGTH_MILES],
|
"max_range_electric": ["mdi:map-marker-distance", LENGTH_MILES],
|
||||||
"remaining_fuel": ["mdi:gas-station", VOLUME_GALLONS],
|
"remaining_fuel": ["mdi:gas-station", VOLUME_GALLONS],
|
||||||
"charging_time_remaining": ["mdi:update", "h"],
|
"charging_time_remaining": ["mdi:update", "h"],
|
||||||
"charging_status": ["mdi:battery-charging", None],
|
"charging_status": ["mdi:battery-charging", None],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user