diff --git a/bimmer_connected/models.py b/bimmer_connected/models.py index d2f8bf7..3683b66 100644 --- a/bimmer_connected/models.py +++ b/bimmer_connected/models.py @@ -157,11 +157,12 @@ def __post_init__(self, lat, lon, name, street, postal_code, city, country): position = GPSPosition(lat, lon) self.position = { "lat": position.latitude, - "lon": position.longitude, + "lng": position.longitude, } self.address = PointOfInterestAddress(str(street), str(postal_code), str(city), str(country)) self.category = {"losCategory": "Address", "mguVehicleCategoryId": None, "name": "Address"} + self.entrances = [{"name": None, "position": self.position}] self.title = name if not self.formattedAddress: diff --git a/bimmer_connected/tests/common.py b/bimmer_connected/tests/common.py index 5d4a774..1ffc517 100644 --- a/bimmer_connected/tests/common.py +++ b/bimmer_connected/tests/common.py @@ -331,7 +331,7 @@ def poi_sideeffect(request: httpx.Request, gcid: str) -> httpx.Response: [ len(data["vehicleInformation"]["vin"]) == 17, isinstance(data["places"][0]["position"]["lat"], float), - isinstance(data["places"][0]["position"]["lon"], float), + isinstance(data["places"][0]["position"]["lng"], float), len(data["places"][0]["title"]) > 0, ] ) diff --git a/bimmer_connected/tests/test_remote_services.py b/bimmer_connected/tests/test_remote_services.py index 89e6785..8d581f6 100644 --- a/bimmer_connected/tests/test_remote_services.py +++ b/bimmer_connected/tests/test_remote_services.py @@ -400,27 +400,27 @@ def test_poi_parsing(): # Check parsing of attributes required by API poi_data = PointOfInterest(**POI_DATA) assert poi_data.position["lat"] == POI_DATA["lat"] - assert poi_data.position["lon"] == POI_DATA["lon"] + assert poi_data.position["lng"] == POI_DATA["lon"] assert poi_data.title == POI_DATA["name"] assert poi_data.formattedAddress == f"{POI_DATA['street']}, {POI_DATA['postal_code']}, {POI_DATA['city']}" # Check the default attributes poi_data = PointOfInterest(lat=POI_DATA["lat"], lon=POI_DATA["lon"]) assert poi_data.position["lat"] == POI_DATA["lat"] - assert poi_data.position["lon"] == POI_DATA["lon"] + assert poi_data.position["lng"] == POI_DATA["lon"] assert poi_data.title == "Sent with ♥ by bimmer_connected" assert poi_data.formattedAddress == "Coordinates only" # Check the default attributes with formatted address poi_data = PointOfInterest(lat=POI_DATA["lat"], lon=POI_DATA["lon"], formattedAddress="Somewhere over rainbow") assert poi_data.position["lat"] == POI_DATA["lat"] - assert poi_data.position["lon"] == POI_DATA["lon"] + assert poi_data.position["lng"] == POI_DATA["lon"] assert poi_data.title == "Sent with ♥ by bimmer_connected" assert poi_data.formattedAddress == "Somewhere over rainbow" # Check parsing with numeric postal code poi_data = PointOfInterest(lat=POI_DATA["lat"], lon=POI_DATA["lon"], postal_code=1234) assert poi_data.position["lat"] == POI_DATA["lat"] - assert poi_data.position["lon"] == POI_DATA["lon"] + assert poi_data.position["lng"] == POI_DATA["lon"] assert poi_data.title == "Sent with ♥ by bimmer_connected" assert poi_data.address.postalCode == "1234"