From 0b4d20b1f9b66eb2cec843528cc60df87f2e1bdd Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 6 Nov 2023 23:31:54 +0100 Subject: [PATCH] Update vehicle to 2.2.0 (#103545) --- homeassistant/components/rdw/diagnostics.py | 4 +- homeassistant/components/rdw/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/rdw/conftest.py | 4 +- .../rdw/snapshots/test_diagnostics.ambr | 50 +++++++++---------- 6 files changed, 31 insertions(+), 33 deletions(-) diff --git a/homeassistant/components/rdw/diagnostics.py b/homeassistant/components/rdw/diagnostics.py index 13c762f695f..dbf3d8e21c0 100644 --- a/homeassistant/components/rdw/diagnostics.py +++ b/homeassistant/components/rdw/diagnostics.py @@ -1,7 +1,6 @@ """Diagnostics support for RDW.""" from __future__ import annotations -import json from typing import Any from vehicle import Vehicle @@ -18,6 +17,5 @@ async def async_get_config_entry_diagnostics( ) -> dict[str, Any]: """Return diagnostics for a config entry.""" coordinator: DataUpdateCoordinator[Vehicle] = hass.data[DOMAIN][entry.entry_id] - # Round-trip via JSON to trigger serialization - data: dict[str, Any] = json.loads(coordinator.data.json()) + data: dict[str, Any] = coordinator.data.to_dict() return data diff --git a/homeassistant/components/rdw/manifest.json b/homeassistant/components/rdw/manifest.json index bc8d3be8451..e63478976e3 100644 --- a/homeassistant/components/rdw/manifest.json +++ b/homeassistant/components/rdw/manifest.json @@ -7,5 +7,5 @@ "integration_type": "service", "iot_class": "cloud_polling", "quality_scale": "platinum", - "requirements": ["vehicle==2.0.0"] + "requirements": ["vehicle==2.2.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index 8e9f5ff1084..994f2fc459b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2664,7 +2664,7 @@ uvcclient==0.11.0 vallox-websocket-api==4.0.2 # homeassistant.components.rdw -vehicle==2.0.0 +vehicle==2.2.0 # homeassistant.components.velbus velbus-aio==2023.10.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ba4283672c3..914398e180b 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1982,7 +1982,7 @@ uvcclient==0.11.0 vallox-websocket-api==4.0.2 # homeassistant.components.rdw -vehicle==2.0.0 +vehicle==2.2.0 # homeassistant.components.velbus velbus-aio==2023.10.2 diff --git a/tests/components/rdw/conftest.py b/tests/components/rdw/conftest.py index 4be17f00264..5fe40b0b497 100644 --- a/tests/components/rdw/conftest.py +++ b/tests/components/rdw/conftest.py @@ -38,7 +38,7 @@ def mock_rdw_config_flow() -> Generator[None, MagicMock, None]: "homeassistant.components.rdw.config_flow.RDW", autospec=True ) as rdw_mock: rdw = rdw_mock.return_value - rdw.vehicle.return_value = Vehicle.parse_raw(load_fixture("rdw/11ZKZ3.json")) + rdw.vehicle.return_value = Vehicle.from_json(load_fixture("rdw/11ZKZ3.json")) yield rdw @@ -49,7 +49,7 @@ def mock_rdw(request: pytest.FixtureRequest) -> Generator[None, MagicMock, None] if hasattr(request, "param") and request.param: fixture = request.param - vehicle = Vehicle.parse_raw(load_fixture(fixture)) + vehicle = Vehicle.from_json(load_fixture(fixture)) with patch("homeassistant.components.rdw.RDW", autospec=True) as rdw_mock: rdw = rdw_mock.return_value rdw.vehicle.return_value = vehicle diff --git a/tests/components/rdw/snapshots/test_diagnostics.ambr b/tests/components/rdw/snapshots/test_diagnostics.ambr index 6da03b67245..cc2a344025a 100644 --- a/tests/components/rdw/snapshots/test_diagnostics.ambr +++ b/tests/components/rdw/snapshots/test_diagnostics.ambr @@ -1,30 +1,30 @@ # serializer version: 1 # name: test_diagnostics dict({ - 'apk_expiration': '2022-01-04', - 'ascription_date': '2021-11-04', - 'ascription_possible': True, - 'brand': 'Skoda', - 'energy_label': 'A', - 'engine_capacity': 999, - 'exported': False, - 'first_admission': '2013-01-04', - 'interior': 'hatchback', - 'last_odometer_registration_year': 2021, - 'liability_insured': False, - 'license_plate': '11ZKZ3', - 'list_price': 10697, - 'mass_driveable': 940, - 'mass_empty': 840, - 'model': 'Citigo', - 'number_of_cylinders': 3, - 'number_of_doors': 0, - 'number_of_seats': 4, - 'number_of_wheelchair_seats': 0, - 'number_of_wheels': 4, - 'odometer_judgement': 'Logisch', - 'pending_recall': False, - 'taxi': None, - 'vehicle_type': 'Personenauto', + 'aantal_cilinders': 3, + 'aantal_deuren': 0, + 'aantal_rolstoelplaatsen': 0, + 'aantal_wielen': 4, + 'aantal_zitplaatsen': 4, + 'catalogusprijs': 10697, + 'cilinderinhoud': 999, + 'datum_eerste_toelating': '20130104', + 'datum_tenaamstelling': '20211104', + 'export_indicator': 'Nee', + 'handelsbenaming': 'Citigo', + 'inrichting': 'hatchback', + 'jaar_laatste_registratie_tellerstand': 2021, + 'kenteken': '11ZKZ3', + 'massa_ledig_voertuig': 840, + 'massa_rijklaar': 940, + 'merk': 'Skoda', + 'openstaande_terugroepactie_indicator': 'Nee', + 'taxi_indicator': None, + 'tellerstandoordeel': 'Logisch', + 'tenaamstellen_mogelijk': 'Ja', + 'vervaldatum_apk': '20220104', + 'voertuigsoort': 'Personenauto', + 'wam_verzekerd': 'Nee', + 'zuinigheidslabel': 'A', }) # ---