ha_toyota icon indicating copy to clipboard operation
ha_toyota copied to clipboard

Data availability is unstable

Open Urmus-dev opened this issue 2 years ago • 1 comments

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#/

Urmus-dev avatar Jun 21 '22 21:06 Urmus-dev

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.

DurgNomis-drol avatar Jun 22 '22 15:06 DurgNomis-drol

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 ?

primeroz avatar Nov 07 '22 18:11 primeroz

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

DurgNomis-drol avatar Nov 07 '22 18:11 DurgNomis-drol

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

primeroz avatar Nov 07 '22 18:11 primeroz

What did you increase it to?

DurgNomis-drol avatar Nov 07 '22 19:11 DurgNomis-drol

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

primeroz avatar Nov 07 '22 19:11 primeroz

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!

rpetteruti avatar Nov 14 '22 20:11 rpetteruti

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"?

0xF16 avatar Feb 14 '23 08:02 0xF16

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 ?

beralios avatar Apr 20 '23 22:04 beralios

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. 😊

CM000n avatar Jan 14 '24 20:01 CM000n