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 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, ...] = ( _DESCRIPTIONS: tuple[VolvoSensorDescription, ...] = (
# command-accessibility endpoint # command-accessibility endpoint

View File

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

View File

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

View File

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