Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Request Limiting #20

Open
SP00BY opened this issue Dec 13, 2024 · 16 comments
Open

App Request Limiting #20

SP00BY opened this issue Dec 13, 2024 · 16 comments

Comments

@SP00BY
Copy link

SP00BY commented Dec 13, 2024

Situation:
Setup Classic 300s
Configured in android app
Downloaded and installed this integration, setting it up w/in HA

Several days later my account was rate limited and effectively disabled for about 24 hours, I had to log out of the app, remove the integration, and wait for everything to return to normal before I had app control again. The integration w/in HA was still enabled and didn't show any errors but the device wasn't populating or available. I haven't reinstalled the integration due to some information I've been given by Vesync, which I'll put below.

It appears that your APP requests have been limited. Because there have been incidents of malicious access to our APP before, we have limited the number of APP requests per day. If the number of daily APP requests to the cloud does not exceed the limit of 3200+1500*current number of devices, there will be no impact on the normal use of the VeSync app on your phone.

It is recommended that you try the following to troubleshoot:

1.When the app is not in use, please shut it down to prevent it running in the background
2.When using the app, avoid staying in the Home interface (this may lead to excessive app requests)
3.Please log out of any possible third party account that logs in to the VeSync account (like HomeKit, Homebridge or Axios)

In looking through reddit threads about the same issue, I came across this comment which explains that changing the polling cadence seems to have resolved it. However, in looking at the noted location (realizing that this is for a different integration from which yours is a branch, I think?) I wasn't able to locate the update_interval to manually update the polling cadence.

I'm hesitant to reinstall the integration since, when this issue arises, it also precludes me from controlling the humidifier w/in the Vesync app as well. Do you have some guidance on how I can proceed? Everything worked very well when it was functioning and I'd like to get the integration setup and stabilized before integrating more Levoit devices into my smarthome.

@formatBCE
Copy link
Owner

Hi!
Check out this line: https://github.com/formatBCE/HA_VeSync_Classic300s/blob/main/vesync_formatbce%2Fcommon.py#L43 it has the scan interval. I use default HA scan interval. But you can change that line to anything, and restart HA.

@SP00BY
Copy link
Author

SP00BY commented Dec 13, 2024

The non-classic300s component used 30 seconds. I'll update the scan interval to hourly and see if it stabilizes. Will I break any of the logic by changing the scan interval to be greater than the debounce cooldown of 15s?

@formatBCE
Copy link
Owner

The non-classic300s component used 30 seconds. I'll update the scan interval to hourly and see if it stabilizes. Will I break any of the logic by changing the scan interval to be greater than the debounce cooldown of 15s?

It shouldn't.

@SP00BY
Copy link
Author

SP00BY commented Dec 13, 2024

Perfect! Thanks so much!

I'll set a reminder to update/close this issue in a week or so with my actions and the result.

@formatBCE
Copy link
Owner

Thank you!

I'm curious why I have no problem like that...

@SP00BY
Copy link
Author

SP00BY commented Dec 13, 2024

Other than my having left the android app installed and running most of the time, I'm not sure. If the integration is truly touching the API once per second then that greatly exceeds the limitations vesync has told me about (86400/day through HA w/ a 1-device limit of 4700/day allowed by vesync). Perhaps since my vesync account was created after this limitation was imposed, presumably, maybe accounts created before that limitation was imposed aren't subject to it? I run a local DNS server and have a firewall that can intercept encrypted traffic, but I dont see how either of those would set off red-flags on their servers. I just assume its a rate-limiting thing.

@formatBCE
Copy link
Owner

I don't think it's once a second. But I will definitely check it.

@SP00BY
Copy link
Author

SP00BY commented Dec 13, 2024

I just assumed that's what the scan interval was referring to. I'm a novice, at best, in programming and have extremely limited understanding when it comes to APIs. I'm stubborn enough to fight the technicalities when it comes to my smarthome. If you have any ideas on limiting the number of API calls/polls I'm open to suggestion and can pull logs/data if needed, just let me know. I'll update the scan interval just to see where it gets me.

@formatBCE
Copy link
Owner

Well if the only way is to rate-limit, then this is the way to do it... Good that we use coordinator for that - it is already drastically reducing calls count (it basically gets updates for all entities at once instead of pulling each state separately.
But all this has disadvantages of late updates (e.g. you won't know if the humidifier is working for up to 1 hour, if you make it hourly). That's a bummer and the main reason why i want to get rid of all cloud things in my home. At this point it's only Levoit that i have. Will sell that ASAP.

@SP00BY
Copy link
Author

SP00BY commented Dec 13, 2024

So, what I may do is change the scan interval to 30 seconds - 2880 API calls/polls per day, which will be well under the vesync limit of 4700 w/ a single device. I'm fine w/ a 30 second delay. I suspect HA will change the state blind, much like it does with other stateless integrations like the bond pro, and unless someone makes an app-change or a manual change on the humidifier, i shouldn't notice the delay at all. If it locks up again, I may just return it for another HA-supported option or smart-plug+dumb-humidifier w/ a temp/humidity sensor for a thermostat card. I'm fine using cloud integrations if they work, but the industry is shifting to force you onto proprietary apps despite having a public API, albeit unsupported.

@seb937
Copy link

seb937 commented Jan 1, 2025

Hey, thanks for the custom integration, it worked well for a few hours then I had the same issue being locked out of the app and HA can't control the device.
To update the scan interval, we just change it like this ?

from
update_interval=SCAN_INTERVAL,
to
update_interval= 30,

Thanks!

@formatBCE
Copy link
Owner

Hey, thanks for the custom integration, it worked well for a few hours then I had the same issue being locked out of the app and HA can't control the device.
To update the scan interval, we just change it like this ?

from
update_interval=SCAN_INTERVAL,
to
update_interval= 30,

Thanks!

Yes, you can do that.

@formatBCE
Copy link
Owner

I'm curious if official integration has same trouble. Mine is basically fork of official...

@SP00BY
Copy link
Author

SP00BY commented Jan 1, 2025

I'm curious if official integration has same trouble. Mine is basically fork of official...

Yeah, I was reading through the core integration issues and they've had some problems lately of devices not showing up, only a portion of devices, etc. I didn't see anything about the API lockout issue I mentioned here. I'm on the Vesync app for the time being until the core integration gets sorted. Editing the scan interval induced a lag on the HA side, not just in manually controlling the humidifier on the unit itself - and I got another lockout after about a week of use. I'm assuming that it's something in the core integration causing it, that and for whatever reason I couldn't set the humidifier back to Auto mode when it was 'On'.

I'm still stubborn enough to try and make these work, worst case I'll go dumb humidifier + smart plug + temp/humi sensor.

@formatBCE
Copy link
Owner

I have humidifier and purifier from Levoit. Sad that they did this. But it's usual situation with vendor-locked devices.

Both of devices use ESP chip. I tried to find any existing work on probable firmware replacing, but found nothing. So for now I'm just staying quiet and see what will happen...

@SP00BY
Copy link
Author

SP00BY commented Jan 1, 2025

I have humidifier and purifier from Levoit. Sad that they did this. But it's usual situation with vendor-locked devices.

Both of devices use ESP chip. I tried to find any existing work on probable firmware replacing, but found nothing. So for now I'm just staying quiet and see what will happen...

100%, I'm in no way trying to imply that the issue lies with you or the contributors to the core integration. Y'all can only work within the confines that are defined by Levoit/Vesync.

I got 2x more humidifiers for a holiday gift so I'm especially motivated to wait for a solution. I'm also curious to see if someone writes firmware for the onboard ESP or a replacement ESP, that's something I could reasonably handle. I've been out of the coding game for way too long to try and get back up to speed and contribute lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants