DurgNomis-drol / ha_toyota

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

Data availability is unstable #112

Closed Urmus-dev closed 8 months ago

Urmus-dev commented 2 years ago

Describe the bug I'm pretty sure the issue is not from this side, but I don't know where to look for help In nearly half the day, the service is reported unavailable and asking for configuration verification. Before using the integration, I never noticed unavailable data in MyT application, but I guess I paid not the same attention as my HA dashboard. Now, service is often unavailable, even in the app/the website, even if they say my vehicule is connected.

Here is what I find in the logs:

2022-06-21 21:19:53 ERROR (MainThread) [custom_components.toyota] Unexpected error fetching toyota data: can only concatenate str (not "dict") to str Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data return await self.update_method() File "/config/custom_components/toyota/init.py", line 105, in async_update_data data = await asyncio.gather( File "/usr/local/lib/python3.9/site-packages/mytoyota/client.py", line 419, in get_driving_statistics raw_statistics = await self.api.get_driving_statistics_endpoint( File "/usr/local/lib/python3.9/site-packages/mytoyota/api.py", line 96, in get_driving_statistics_endpoint return await self.controller.request( File "/usr/local/lib/python3.9/site-packages/mytoyota/controller.py", line 219, in request "Internal server error occurred! - " + response TypeError: can only concatenate str (not "dict") to str 2022-06-21 21:19:53 DEBUG (MainThread) [custom_components.toyota] Finished fetching toyota data in 6.332 seconds (success: False)

And these:

2022-06-21 21:26:09 ERROR (MainThread) [custom_components.toyota] Error fetching toyota data: Update canceled! Toyota's API was too slow to respond. Will try again later... 2022-06-21 21:26:09 DEBUG (MainThread) [custom_components.toyota] Finished fetching toyota data in 16.145 seconds (success: False)

To Reproduce I followed the instructions on the readme. My setup is a Docker image on a Ubuntu server 22.04 VM on a Qnap server.

Expected behavior Well, more data, I guess?

Screenshots image image

Additional context Europe, France. I check data in the MyT app and https://www.toyota.fr/apps/customerportal#/

DurgNomis-drol commented 2 years ago

Their servers are very unstable, this problem you have, I have seen this a lot when developing this integration. For some reason the API returns errors in situations where it shouldn't. I have no answer on how to fix it for now unfortunately.

primeroz commented 1 year ago

just started using this integration and is great when toyota api works :)

can this issue be related in any way to https://github.com/DurgNomis-drol/ha_toyota/pull/95 ?

DurgNomis-drol commented 1 year ago

No unfortunately not, Toyota's API is not meant for constant polling, and it errors out because of this.

primeroz commented 1 year ago

sorry for polluting the issue. my issue was with timeouts. I increased in my local copy both the interval and the timeout and things look good for now. thanks again for the amazing integration

DurgNomis-drol commented 1 year ago

What did you increase it to?

primeroz commented 1 year ago

update every 600s ( i don't really need it more precise than that for my needs ) and async timeout to 60s

rpetteruti commented 1 year ago

Hello, this integration is great but the API are very unstable, would be great to not ‘push’ the unaivalable status in order to just keep the last value. Do you think is possible and does it make sense? Thank you!

0xF16 commented 1 year ago

I'm also experiencing it, even with the updated interval (I use the version 7afd17d). Wondering if we cannot just cache the last results and show old status/data instead of "Unavailable"?

beralios commented 1 year ago

Strange behaviour here.. I have instability or "no data" only for Weekly statistics (sensor.c_hr_current_week_statistics).. But I have month & year.. and also I have them on MyT app.... and all other sensors data are present.. What could be the problem ?

CM000n commented 8 months ago

We recently released version 2.0.0 of the Custom Component with major changes and support for the new Mytoyota API. As we unfortunately cannot provide support for Custom Component versions < v2.0.0, I hereby close your issue. If the issue still applies to the current version, you are of course free to open a new issue. 😊