Volvo: fix missing charging power options (#150272)

This commit is contained in:
Thomas D
2025-08-08 15:25:19 +02:00
committed by Franck Nijhof
parent 66019953db
commit 762c179b80
4 changed files with 45 additions and 31 deletions

View File

@@ -87,7 +87,12 @@ def _charging_power_status_value(field: VolvoCarsValue) -> str | None:
return None
_CHARGING_POWER_STATUS_OPTIONS = ["providing_power", "no_power_available"]
_CHARGING_POWER_STATUS_OPTIONS = [
"fault",
"power_available_but_not_activated",
"providing_power",
"no_power_available",
]
_DESCRIPTIONS: tuple[VolvoSensorDescription, ...] = (
# command-accessibility endpoint

View File

@@ -94,7 +94,7 @@
"state": {
"connected": "[%key:common::state::connected%]",
"disconnected": "[%key:common::state::disconnected%]",
"fault": "[%key:common::state::error%]"
"fault": "[%key:common::state::fault%]"
}
},
"charging_current_limit": {
@@ -106,6 +106,8 @@
"charging_power_status": {
"name": "Charging power status",
"state": {
"fault": "[%key:common::state::fault%]",
"power_available_but_not_activated": "Power available",
"providing_power": "Providing power",
"no_power_available": "No power"
}

View File

@@ -1,57 +1,56 @@
{
"batteryChargeLevel": {
"status": "OK",
"value": 38,
"value": 90.0,
"unit": "percentage",
"updatedAt": "2025-07-02T08:51:23Z"
"updatedAt": "2025-08-07T14:30:32Z"
},
"electricRange": {
"status": "OK",
"value": 90,
"value": 327,
"unit": "km",
"updatedAt": "2025-07-02T08:51:23Z"
"updatedAt": "2025-08-07T14:30:32Z"
},
"chargerConnectionStatus": {
"status": "OK",
"value": "DISCONNECTED",
"updatedAt": "2025-07-02T08:51:23Z"
"value": "CONNECTED",
"updatedAt": "2025-08-07T14:30:32Z"
},
"chargingStatus": {
"status": "OK",
"value": "IDLE",
"updatedAt": "2025-07-02T08:51:23Z"
"value": "DONE",
"updatedAt": "2025-08-07T14:30:32Z"
},
"chargingType": {
"status": "OK",
"value": "NONE",
"updatedAt": "2025-07-02T08:51:23Z"
"value": "AC",
"updatedAt": "2025-08-07T14:30:32Z"
},
"chargerPowerStatus": {
"status": "OK",
"value": "NO_POWER_AVAILABLE",
"updatedAt": "2025-07-02T08:51:23Z"
"value": "FAULT",
"updatedAt": "2025-08-07T14:30:32Z"
},
"estimatedChargingTimeToTargetBatteryChargeLevel": {
"status": "OK",
"value": 0,
"value": 2,
"unit": "minutes",
"updatedAt": "2025-07-02T08:51:23Z"
"updatedAt": "2025-08-07T14:30:32Z"
},
"chargingCurrentLimit": {
"status": "OK",
"value": 32,
"unit": "ampere",
"updatedAt": "2024-03-05T08:38:44Z"
"status": "ERROR",
"code": "NOT_SUPPORTED",
"message": "Resource is not supported for this vehicle"
},
"targetBatteryChargeLevel": {
"status": "OK",
"value": 90,
"unit": "percentage",
"updatedAt": "2024-09-22T09:40:12Z"
"updatedAt": "2025-08-07T14:49:50Z"
},
"chargingPower": {
"status": "ERROR",
"code": "PROPERTY_NOT_FOUND",
"message": "No valid value could be found for the requested property"
"code": "NOT_SUPPORTED",
"message": "Resource is not supported for this vehicle"
}
}

View File

@@ -52,7 +52,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '38',
'state': '90.0',
})
# ---
# name: test_sensor[ex30_2024][sensor.volvo_ex30_battery_capacity-entry]
@@ -229,7 +229,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'disconnected',
'state': 'connected',
})
# ---
# name: test_sensor[ex30_2024][sensor.volvo_ex30_charging_limit-entry]
@@ -285,7 +285,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '32',
'state': 'unavailable',
})
# ---
# name: test_sensor[ex30_2024][sensor.volvo_ex30_charging_power-entry]
@@ -351,6 +351,8 @@
'area_id': None,
'capabilities': dict({
'options': list([
'fault',
'power_available_but_not_activated',
'providing_power',
'no_power_available',
]),
@@ -390,6 +392,8 @@
'device_class': 'enum',
'friendly_name': 'Volvo EX30 Charging power status',
'options': list([
'fault',
'power_available_but_not_activated',
'providing_power',
'no_power_available',
]),
@@ -399,7 +403,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'no_power_available',
'state': 'fault',
})
# ---
# name: test_sensor[ex30_2024][sensor.volvo_ex30_charging_status-entry]
@@ -465,7 +469,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'idle',
'state': 'done',
})
# ---
# name: test_sensor[ex30_2024][sensor.volvo_ex30_charging_type-entry]
@@ -525,7 +529,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'none',
'state': 'ac',
})
# ---
# name: test_sensor[ex30_2024][sensor.volvo_ex30_distance_to_empty_battery-entry]
@@ -581,7 +585,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '90',
'state': '327',
})
# ---
# name: test_sensor[ex30_2024][sensor.volvo_ex30_distance_to_service-entry]
@@ -693,7 +697,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '0',
'state': '2',
})
# ---
# name: test_sensor[ex30_2024][sensor.volvo_ex30_odometer-entry]
@@ -2276,6 +2280,8 @@
'area_id': None,
'capabilities': dict({
'options': list([
'fault',
'power_available_but_not_activated',
'providing_power',
'no_power_available',
]),
@@ -2315,6 +2321,8 @@
'device_class': 'enum',
'friendly_name': 'Volvo XC40 Charging power status',
'options': list([
'fault',
'power_available_but_not_activated',
'providing_power',
'no_power_available',
]),