pyvesync icon indicating copy to clipboard operation
pyvesync copied to clipboard

Slow API response

Open sdrapha opened this issue 1 year ago • 5 comments

This is not an issue with the pyvesync module, its actually with the cloud api, since I get the same behaviour with the official app. I'm posting it here to see if there is more people with the same issue or is it just me? The API is really slow to respond, it varies from 2~3sec to 5 ~8sec and sometimes it just timeout. It wasn't like that a week ago. Is someone else also experiencing this? Some kind of not well implemented rate-limiting perhaps? Server issues? Curious to see others opinions.

sdrapha avatar Aug 18 '22 16:08 sdrapha

I'm experiencing the same. I'm thinking VeSync is throttling calls after a while. When you use the app, it's usually not kept open for a long period of time so they are throttle log running logins. Not sure how this can be addressed, possibly making a longer delay between calls but I would have to test this.

webdjoe avatar Aug 31 '22 13:08 webdjoe

I got so frustrated by this. I have more bulbs still on the box to be installed, and now I have second thoughts on my support to the brand, I had previously made some free advertising for them, and now I regret it. Even Tuya cloud is more reliable at the current state, and that is not good benchmark. I'll have to find out how to increase the interval for polling in homeassistant to also do some testing. Just hard to find time to fiddle with that. I already tested different accounts and the issue persisted, even changing phone ip by means of vpn doesn't help. Maybe the throtlling is based on the ip of the actual device(switch/bulb/etc)... It doesn't seem to have much of a pattern yet, hard to diagnose.

sdrapha avatar Aug 31 '22 21:08 sdrapha

I've done more testing, I disabled HomeAssistant polling entirely to isolate the testing behavior. I've found that the V2 api endpoint is much more sensitive to being slow. Even on the native app alone. The devices based on the V1 api endpoint run fast, without much issues.

When we have a mixed bag of devices, some on the V2 api endpoint, some on the V1, the slowness of the V2 API affects everything, including, making even the V1 api endpoint timing out or not responding at all.

For now, I'll leave the Home Assistant integration polling disabled. I created a script to manually update the entities. One for the V1 entities. One for the V2 entities. I'll then create a custom timer to call the individual scripts in a custom interval. and keep testing.

sdrapha avatar Sep 01 '22 02:09 sdrapha

Thanks for the update. I've been happy so far with vesync devices, they could just be having temporary server issues. It could also be a header/body key issue if the app is noticeably slower. I will do some testing on my own

webdjoe avatar Sep 01 '22 03:09 webdjoe

This issue was gone for a while but now is back again. Same behavior as the original post. My HomeAssistant is set to only poll the affected devices (V2 api, valceno bulbs) from 5 to 5 minutes, and each device with a delay in between them. Even with all that, the api is taking many seconds to respond and sometimes timeout. Could we leave this issue open so it's more visible? I'm hoping for anyone contributing any idea on understanding this pattern and how to fix (or avoid throtling, IF that is cause)

sdrapha avatar Apr 29 '23 18:04 sdrapha

This is a VeSync server issue as they are most likely throttling requests without a heartbeat. Nothing can been done about this

webdjoe avatar Jun 30 '24 00:06 webdjoe