From 3cfa5728fbf93d2f7546f363d69de64fc46e8fec Mon Sep 17 00:00:00 2001 From: Mandar Patil Date: Tue, 5 Nov 2024 23:52:58 +0000 Subject: [PATCH] Updated battery and fixed car fuel type --- custom_components/bouncie/sensor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/bouncie/sensor.py b/custom_components/bouncie/sensor.py index 959348f..8a1afaf 100644 --- a/custom_components/bouncie/sensor.py +++ b/custom_components/bouncie/sensor.py @@ -63,7 +63,7 @@ def update_car_info_attributes(vehicle_info): value_fn=lambda vehicle_info: vehicle_info["stats"]["lastUpdated"], extra_attrs_fn=lambda vehicle_info: { const.ATTR_VEHICLE_STATS_LAST_UPDATE_JSON_KEY: json.dumps(vehicle_info) - } + }, ), BouncieSensorEntityDescription( key="car-info", @@ -94,7 +94,7 @@ def update_car_info_attributes(vehicle_info): key="car-fuel", icon="mdi:gas-station", name="Car Fuel", - device_class=SensorDeviceClass.BATTERY, + device_class=SensorDeviceClass.VOLUME_STORAGE, native_unit_of_measurement="%", value_fn=lambda vehicle_info: int(vehicle_info["stats"]["fuelLevel"]), extra_attrs_fn=update_car_stats_attributes, @@ -125,9 +125,9 @@ def update_car_info_attributes(vehicle_info): key="car-battery", icon="mdi:car-battery", name="Car Battery", - value_fn=lambda vehicle_info: vehicle_info["stats"]["battery"]["status"], + value_fn=lambda vehicle_info: vehicle_info["stats"]["mil"]["battery"]["status"], extra_attrs_fn=lambda vehicle_info: { - const.ATTR_VEHICLE_BATTERY_LAST_UPDATED_KEY: vehicle_info["stats"][ + const.ATTR_VEHICLE_BATTERY_LAST_UPDATED_KEY: vehicle_info["stats"]["mil"][ "battery" ]["lastUpdated"] },