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."""
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

View File

@ -7,5 +7,5 @@
"integration_type": "service",
"iot_class": "cloud_polling",
"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
# homeassistant.components.rdw
vehicle==2.0.0
vehicle==2.2.0
# homeassistant.components.velbus
velbus-aio==2023.10.2

View File

@ -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

View File

@ -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

View File

@ -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',
})
# ---