Update vehicle to 2.2.0 (#103545)

pull/103550/head^2
Franck Nijhof 2023-11-06 23:31:54 +01:00 committed by GitHub
parent af4ccefb8a
commit 0b4d20b1f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 33 deletions

View File

@ -1,7 +1,6 @@
"""Diagnostics support for RDW.""" """Diagnostics support for RDW."""
from __future__ import annotations from __future__ import annotations
import json
from typing import Any from typing import Any
from vehicle import Vehicle from vehicle import Vehicle
@ -18,6 +17,5 @@ async def async_get_config_entry_diagnostics(
) -> dict[str, Any]: ) -> dict[str, Any]:
"""Return diagnostics for a config entry.""" """Return diagnostics for a config entry."""
coordinator: DataUpdateCoordinator[Vehicle] = hass.data[DOMAIN][entry.entry_id] coordinator: DataUpdateCoordinator[Vehicle] = hass.data[DOMAIN][entry.entry_id]
# Round-trip via JSON to trigger serialization data: dict[str, Any] = coordinator.data.to_dict()
data: dict[str, Any] = json.loads(coordinator.data.json())
return data return data

View File

@ -7,5 +7,5 @@
"integration_type": "service", "integration_type": "service",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"quality_scale": "platinum", "quality_scale": "platinum",
"requirements": ["vehicle==2.0.0"] "requirements": ["vehicle==2.2.0"]
} }

View File

@ -2664,7 +2664,7 @@ uvcclient==0.11.0
vallox-websocket-api==4.0.2 vallox-websocket-api==4.0.2
# homeassistant.components.rdw # homeassistant.components.rdw
vehicle==2.0.0 vehicle==2.2.0
# homeassistant.components.velbus # homeassistant.components.velbus
velbus-aio==2023.10.2 velbus-aio==2023.10.2

View File

@ -1982,7 +1982,7 @@ uvcclient==0.11.0
vallox-websocket-api==4.0.2 vallox-websocket-api==4.0.2
# homeassistant.components.rdw # homeassistant.components.rdw
vehicle==2.0.0 vehicle==2.2.0
# homeassistant.components.velbus # homeassistant.components.velbus
velbus-aio==2023.10.2 velbus-aio==2023.10.2

View File

@ -38,7 +38,7 @@ def mock_rdw_config_flow() -> Generator[None, MagicMock, None]:
"homeassistant.components.rdw.config_flow.RDW", autospec=True "homeassistant.components.rdw.config_flow.RDW", autospec=True
) as rdw_mock: ) as rdw_mock:
rdw = rdw_mock.return_value 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 yield rdw
@ -49,7 +49,7 @@ def mock_rdw(request: pytest.FixtureRequest) -> Generator[None, MagicMock, None]
if hasattr(request, "param") and request.param: if hasattr(request, "param") and request.param:
fixture = 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: with patch("homeassistant.components.rdw.RDW", autospec=True) as rdw_mock:
rdw = rdw_mock.return_value rdw = rdw_mock.return_value
rdw.vehicle.return_value = vehicle rdw.vehicle.return_value = vehicle

View File

@ -1,30 +1,30 @@
# serializer version: 1 # serializer version: 1
# name: test_diagnostics # name: test_diagnostics
dict({ dict({
'apk_expiration': '2022-01-04', 'aantal_cilinders': 3,
'ascription_date': '2021-11-04', 'aantal_deuren': 0,
'ascription_possible': True, 'aantal_rolstoelplaatsen': 0,
'brand': 'Skoda', 'aantal_wielen': 4,
'energy_label': 'A', 'aantal_zitplaatsen': 4,
'engine_capacity': 999, 'catalogusprijs': 10697,
'exported': False, 'cilinderinhoud': 999,
'first_admission': '2013-01-04', 'datum_eerste_toelating': '20130104',
'interior': 'hatchback', 'datum_tenaamstelling': '20211104',
'last_odometer_registration_year': 2021, 'export_indicator': 'Nee',
'liability_insured': False, 'handelsbenaming': 'Citigo',
'license_plate': '11ZKZ3', 'inrichting': 'hatchback',
'list_price': 10697, 'jaar_laatste_registratie_tellerstand': 2021,
'mass_driveable': 940, 'kenteken': '11ZKZ3',
'mass_empty': 840, 'massa_ledig_voertuig': 840,
'model': 'Citigo', 'massa_rijklaar': 940,
'number_of_cylinders': 3, 'merk': 'Skoda',
'number_of_doors': 0, 'openstaande_terugroepactie_indicator': 'Nee',
'number_of_seats': 4, 'taxi_indicator': None,
'number_of_wheelchair_seats': 0, 'tellerstandoordeel': 'Logisch',
'number_of_wheels': 4, 'tenaamstellen_mogelijk': 'Ja',
'odometer_judgement': 'Logisch', 'vervaldatum_apk': '20220104',
'pending_recall': False, 'voertuigsoort': 'Personenauto',
'taxi': None, 'wam_verzekerd': 'Nee',
'vehicle_type': 'Personenauto', 'zuinigheidslabel': 'A',
}) })
# --- # ---