From e82d91d39489353b21da39aaee2d8ddb5928cfe3 Mon Sep 17 00:00:00 2001 From: Thomas D <11554546+thomasddn@users.noreply.github.com> Date: Tue, 26 Aug 2025 12:23:33 +0200 Subject: [PATCH] Fix API field rename for Volvo integration (#151183) --- homeassistant/components/volvo/coordinator.py | 6 +++++- .../volvo/fixtures/ex30_2024/energy_capabilities.json | 2 +- .../fixtures/xc40_electric_2024/energy_capabilities.json | 2 +- .../volvo/fixtures/xc60_phev_2020/energy_capabilities.json | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/volvo/coordinator.py b/homeassistant/components/volvo/coordinator.py index d6c8f349a52..b0bf961815f 100644 --- a/homeassistant/components/volvo/coordinator.py +++ b/homeassistant/components/volvo/coordinator.py @@ -269,8 +269,12 @@ class VolvoMediumIntervalCoordinator(VolvoBaseCoordinator): capabilities = await self.api.async_get_energy_capabilities() if capabilities.get("isSupported", False): + + def _normalize_key(key: str) -> str: + return "chargingStatus" if key == "chargingSystemStatus" else key + self._supported_capabilities = [ - key + _normalize_key(key) for key, value in capabilities.items() if isinstance(value, dict) and value.get("isSupported", False) ] diff --git a/tests/components/volvo/fixtures/ex30_2024/energy_capabilities.json b/tests/components/volvo/fixtures/ex30_2024/energy_capabilities.json index f3aff11585d..8a5545578b9 100644 --- a/tests/components/volvo/fixtures/ex30_2024/energy_capabilities.json +++ b/tests/components/volvo/fixtures/ex30_2024/energy_capabilities.json @@ -9,7 +9,7 @@ "chargerConnectionStatus": { "isSupported": true }, - "chargingStatus": { + "chargingSystemStatus": { "isSupported": true }, "chargingType": { diff --git a/tests/components/volvo/fixtures/xc40_electric_2024/energy_capabilities.json b/tests/components/volvo/fixtures/xc40_electric_2024/energy_capabilities.json index 3523d51e071..968c759ab27 100644 --- a/tests/components/volvo/fixtures/xc40_electric_2024/energy_capabilities.json +++ b/tests/components/volvo/fixtures/xc40_electric_2024/energy_capabilities.json @@ -9,7 +9,7 @@ "chargerConnectionStatus": { "isSupported": true }, - "chargingStatus": { + "chargingSystemStatus": { "isSupported": true }, "chargingType": { diff --git a/tests/components/volvo/fixtures/xc60_phev_2020/energy_capabilities.json b/tests/components/volvo/fixtures/xc60_phev_2020/energy_capabilities.json index 331795f545b..d8aa07ff0bb 100644 --- a/tests/components/volvo/fixtures/xc60_phev_2020/energy_capabilities.json +++ b/tests/components/volvo/fixtures/xc60_phev_2020/energy_capabilities.json @@ -9,7 +9,7 @@ "chargerConnectionStatus": { "isSupported": true }, - "chargingStatus": { + "chargingSystemStatus": { "isSupported": true }, "chargingType": {