diff --git a/volkswagencarnet/vw_vehicle.py b/volkswagencarnet/vw_vehicle.py index 0bcbffc4..8c1d5086 100644 --- a/volkswagencarnet/vw_vehicle.py +++ b/volkswagencarnet/vw_vehicle.py @@ -1192,12 +1192,24 @@ def fuel_level(self) -> int: :return: """ - return int(find_path(self.attrs, "measurements.fuelLevelStatus.value.currentFuelLevel_pct")) + fuel_level_pct = "" + if is_valid_path(self.attrs, "fuelStatus.rangeStatus.value.primaryEngine.currentFuelLevel_pct"): + fuel_level_pct = find_path(self.attrs, "fuelStatus.rangeStatus.value.primaryEngine.currentFuelLevel_pct") + + if is_valid_path(self.attrs, "measurements.fuelLevelStatus.value.currentFuelLevel_pct"): + fuel_level_pct = find_path(self.attrs, "measurements.fuelLevelStatus.value.currentFuelLevel_pct") + return int(fuel_level_pct) @property def fuel_level_last_updated(self) -> datetime: """Return fuel level last updated.""" - return find_path(self.attrs, "measurements.fuelLevelStatus.value.carCapturedTimestamp") + fuel_level_lastupdated = "" + if is_valid_path(self.attrs, "fuelStatus.rangeStatus.value.carCapturedTimestamp"): + fuel_level_lastupdated = find_path(self.attrs, "fuelStatus.rangeStatus.value.carCapturedTimestamp") + + if is_valid_path(self.attrs, "measurements.fuelLevelStatus.value.carCapturedTimestamp"): + fuel_level_lastupdated = find_path(self.attrs, "measurements.fuelLevelStatus.value.carCapturedTimestamp") + return fuel_level_lastupdated @property def is_fuel_level_supported(self) -> bool: @@ -1206,7 +1218,8 @@ def is_fuel_level_supported(self) -> bool: :return: """ - return is_valid_path(self.attrs, "measurements.fuelLevelStatus.value.currentFuelLevel_pct") + return (is_valid_path(self.attrs, "measurements.fuelLevelStatus.value.currentFuelLevel_pct") + or is_valid_path(self.attrs, "fuelStatus.rangeStatus.value.primaryEngine.currentFuelLevel_pct")) # Climatisation settings @property