Skip to content

Commit e82d91d

Browse files
authored
Fix API field rename for Volvo integration (home-assistant#151183)
1 parent 60e9155 commit e82d91d

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

homeassistant/components/volvo/coordinator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,12 @@ async def _async_determine_api_calls(
269269
capabilities = await self.api.async_get_energy_capabilities()
270270

271271
if capabilities.get("isSupported", False):
272+
273+
def _normalize_key(key: str) -> str:
274+
return "chargingStatus" if key == "chargingSystemStatus" else key
275+
272276
self._supported_capabilities = [
273-
key
277+
_normalize_key(key)
274278
for key, value in capabilities.items()
275279
if isinstance(value, dict) and value.get("isSupported", False)
276280
]

tests/components/volvo/fixtures/ex30_2024/energy_capabilities.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"chargerConnectionStatus": {
1010
"isSupported": true
1111
},
12-
"chargingStatus": {
12+
"chargingSystemStatus": {
1313
"isSupported": true
1414
},
1515
"chargingType": {

tests/components/volvo/fixtures/xc40_electric_2024/energy_capabilities.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"chargerConnectionStatus": {
1010
"isSupported": true
1111
},
12-
"chargingStatus": {
12+
"chargingSystemStatus": {
1313
"isSupported": true
1414
},
1515
"chargingType": {

tests/components/volvo/fixtures/xc60_phev_2020/energy_capabilities.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"chargerConnectionStatus": {
1010
"isSupported": true
1111
},
12-
"chargingStatus": {
12+
"chargingSystemStatus": {
1313
"isSupported": true
1414
},
1515
"chargingType": {

0 commit comments

Comments
 (0)