DurgNomis-drol / ha_toyota

Toyota Connected Services integration for Home Assistant.
MIT License
148 stars 29 forks source link

Validation error for `shopGenuinePartsUrl` in `VehiclesResponseModel` #236

Closed bohmszi closed 7 months ago

bohmszi commented 7 months ago

Describe the bug Home Assistant integration fails with the error included in Additional Context All my sensors are in Unknown state

To Reproduce Issue happened after update of ha_toyota integration on 2/11/2014. Last commit ID: 26110c9d472c5117ed04aa1e15fa4c8550964e7c Home Assistant Core 2024.1.3 Frontend 20240104.0

Expected behavior Integration should pull the data from Toyota API.

Additional context

2024-02-12 15:32:10 ERROR Unexpected error fetching toyota data: 1 validation error for VehiclesResponseModel

payload -> 0 -> shopGenuinePartsUrl

  none is not an allowed value (type=type_error.none.not_allowed)

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh

    self.data = await self._async_update_data()

                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data

    return await self.update_method()

           ^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/config/custom_components/toyota/__init__.py", line 71, in async_get_vehicle_data

    vehicles = await asyncio.wait_for(client.get_vehicles(metric=use_metric_values), 15)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 489, in wait_for

    return fut.result()

           ^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/mytoyota/client.py", line 64, in get_vehicles

    vehicles = await self._api.get_vehicles_endpoint()

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/mytoyota/api.py", line 81, in get_vehicles_endpoint

    parsed_response = await self._request_and_parse(

                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/mytoyota/api.py", line 55, in _request_and_parse

    return model(**response)

           ^^^^^^^^^^^^^^^^^

  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__

pydantic.error_wrappers.ValidationError: 1 validation error for VehiclesResponseModel

payload -> 0 -> shopGenuinePartsUrl

  none is not an allowed value (type=type_error.none.not_allowed)
zebde commented 7 months ago

I am now getting this too on HA 2024.2.1 and v2.0.1 of the component.

Mauribel commented 7 months ago

+1

attree commented 7 months ago

+1

vix66 commented 7 months ago

+1

amastrogiacomo1968 commented 7 months ago

Same problem on Home Assistant 2024.02.1

oskarhood commented 7 months ago

+1

raudraido commented 7 months ago

+1

thomasattree commented 7 months ago

This is the upstream PR for this in the mytoyota package. https://github.com/DurgNomis-drol/mytoyota/pull/331

Chobnob commented 7 months ago

I am also getting this exact validation error. Post the error I loaded the Toyota app and it required me to agree to altered T&Cs before I could proceed. I did and logged onto the app successfully. However this did not unlock the HA add on. It may be coincidental but I suspect Toyota changed the logon routines. I am running 2024.02.1 but same error on a 2024.01.5 backup system.

CM000n commented 7 months ago

There is already a fix in place, that just has to be approved: https://github.com/DurgNomis-drol/ha_toyota/pull/237

This has nothing to do with a changed logon process. They have updated the API content (again) and now some information is missing which before was always delivered.

AlfredVossen commented 7 months ago

Same problem with Core v.2024.1.5 : All entities unavailable. Same problem after Update Toyota Connected Services from 2.0.0 → 2.0.1 on 13-02-2024 -> still All entities unavailable.

ajain-93 commented 7 months ago

I was a little bit impatient for the fix to be released in the main branch/hacs and implemented it manually on my install.

In the file hass_config/custom_components/toyota/manifest.json change the last few lines from:

  "requirements": [
    "mytoyota==2.0.0",
    "arrow"
  ],
  "version": "2.0.1"
}

to:

  "requirements": [
    "mytoyota==2.1.0",
    "arrow"
  ],
  "version": "2.0.2"
}

Don't forget to restart HASS to reload the new dependencies.

peluho commented 7 months ago

I was a little bit impatient for the fix to be released in the main branch/hacs and implemented it manually on my install.

In the file hass_config/custom_components/toyota/manifest.json change the last few lines from:

  "requirements": [
    "mytoyota==2.0.0",
    "arrow"
  ],
  "version": "2.0.1"
}

to:

  "requirements": [
    "mytoyota==2.1.0",
    "arrow"
  ],
  "version": "2.0.2"
}

Don't forget to restart HASS to reload the new dependencies.

thanks a lot

It worked, it seems than the plate is now gone from the new API?

cheers,

AlfredVossen commented 7 months ago

Fantastic, thank you very much for the adjustment, everything is fine now 👍👍👍

Op do 15 feb 2024 om 15:49 schreef Arnav Jain @.***>:

I was a little bit impatient for the fix to be released in the main branch/hacs and implemented it manually on my install.

In the file hass_config/custom_components/toyota/manifest.json change the last few lines from:

"requirements": [ "mytoyota==2.0.0", "arrow" ], "version": "2.0.1" }

to:

"requirements": [ "mytoyota==2.1.0", "arrow" ], "version": "2.0.2" }

— Reply to this email directly, view it on GitHub https://github.com/DurgNomis-drol/ha_toyota/issues/236#issuecomment-1946248244, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARLBMGBP6LFQ4VVVWDO2FFLYTYN53AVCNFSM6AAAAABDE3BVEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWGI2DQMRUGQ . You are receiving this because you commented.Message ID: @.***>