Closed fars-fede-fire closed 1 year ago
@rene-neimann I have created a new issue and closed the other as I do not think they are related.
I think there is a problem on the Volvo server right now but I am not at my computer at the moment so I am unable to test. I will return to you when I have found something out.
Both, v1 and v2 connected-vehicle APIs work well from me from Swagger/Postman right now - doesn't seem like problem with Volvo servers (see more below).
Does this part in the error message seem relevant?
pydantic.error_wrappers.ValidationError: 2 validation errors for GetVinModel
status
field required (type=value_error.missing)
operationId
field required (type=value_error.missing)
curl --location 'https://api.volvocars.com/connected-vehicle/v2/vehicles' \
--header 'vcc-api-operationId: <string>' \
--header 'Accept: application/json' \
--header 'vcc-api-key: xxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxx
{
"data": [
{
"vin": "XXXXXXXXXXXXXXX"
}
],
"pagination": {
"limit": 1,
"total": 1,
"offset": 0
}
}
curl -X 'GET' \
'https://api.volvocars.com/connected-vehicle/v1/vehicles' \
-H 'accept: application/vnd.volvocars.api.connected-vehicle.vehiclelist.v1+json' \
-H 'vcc-api-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'Authorization: Bearer xxxxxxxxxxxxxx
{
"status": 200,
"operationId": "2b90210d-b2ee-4543-a12b-ec7fafc592cc",
"data": [
{
"vin": "XXXXXXXXXXXXXXXXXX"
}
],
"pagination": {
"limit": 1,
"total": 1,
"offset": 0
}
}
So it seems that Volvo has changed some of the data the APIs return causing some errors. It should be fixed now in this branch: https://github.com/fars-fede-fire/volvoaaos/tree/fix-api-changes. Would you mind trying(again...)?
Seems fixed, I was able to set up the integration successfully now. Enabled debug logging, reloaded integration, restarted HA - all good without any errors in logs.
What's the best practice for pull latest data from API (e.g., for battery charge)? Does the integration poll the API regularly? Or should I do it myself by reloading the integration (manually or via automation).
Perfect! Data is polled each minute, so you do not have to do anything.
What could be the issue?
Logger: aiohttp.server Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403 First occurred: 21:03:41 (1 occurrences) Last logged: 21:03:41
Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin return await func(self, request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post return await super().post(request, flow_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 293, in async_configure result = await self._async_handle_step( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 389, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/volvoaaos/config_flow.py", line 75, in async_step_user return await self.async_step_select_vin() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/volvoaaos/config_flow.py", line 99, in async_step_select_vin response = await connected_vehicle.list_vehicles() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/volvoaaos/volvo.py", line 170, in list_vehicles return GetVinModel.parse_obj(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init pydantic.error_wrappers.ValidationError: 2 validation errors for GetVinModel status field required (type=value_error.missing) operationId field required (type=value_error.missing)
Originally posted by @rene-neimann in https://github.com/fars-fede-fire/volvoaaos/issues/20#issuecomment-1799591756