DurgNomis-drol / mytoyota

Python client for Toyota Connected Services API
MIT License
74 stars 28 forks source link

Fix: Make `ev_range`, `ev_range_with_ac` and `dcmSupplierName` optional #340

Closed CM000n closed 5 months ago

CM000n commented 5 months ago

Seems there was another change in the toyota api which requires to make some fields in the ElectricResponseModel optional. This should fix https://github.com/DurgNomis-drol/ha_toyota/issues/248

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 82.73%. Comparing base (709a8b7) to head (bfde50d).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #340 +/- ## ======================================= Coverage 82.73% 82.73% ======================================= Files 29 29 Lines 1413 1413 ======================================= Hits 1169 1169 Misses 244 244 ``` | [Flag](https://app.codecov.io/gh/DurgNomis-drol/mytoyota/pull/340/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Hansen) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/DurgNomis-drol/mytoyota/pull/340/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Hansen) | `82.73% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Hansen#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

briandelicata commented 5 months ago

Now it's ending with the following error:

AttributeError: 'NoneType' object has no attribute 'unit'

CM000n commented 5 months ago

It looks like there is a major problem here, and your vehicle will no longer return any EVRange with air conditioning value at all. 😢

Is this information still displayed in the app? If you are a bit more technically adept, you can look directly at the API and see what information comes back. Unfortunately, I can't debug it myself as I have neither a plug-in hybrid nor a fully electric vehicle.

CM000n commented 5 months ago

Can you please approve it again @GitOldGrumpy?

It really is a shame that we have to touch the models so often. I wonder what the best strategy is here to deal with the frequency of change and the changing content of API responses. 🤔

briandelicata commented 5 months ago

#

It looks like there is a major problem here, and your vehicle will no longer return any EVRange with air conditioning value at all. 😢

Is this information still displayed in the app? If you are a bit more technically adept, you can look directly at the API and see what information comes back. Unfortunately, I can't debug it myself as I have neither a plug-in hybrid nor a fully electric vehicle.

Have tested and now all the data is being retrieved for both cars. The EV range with A/C was avaialble in the new app up to a few weeks ago but for some reason Toyota removed it. Also for some reason the App messes up fuel range (miles/km) but not EV range in km.

IMG_3325 IMG_9A9ED2994391-1

CM000n commented 5 months ago

Thanks for testing @briandelicata. It's really annoying what Toyota is doing here. Can one of the other maintainers [@DurgNomis-drol, @GitOldGrumpy, @joro75] please appove the pr again?