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

API usage #97

Open
Roby2002 opened this issue Mar 8, 2024 · 8 comments
Open

API usage #97

Roby2002 opened this issue Mar 8, 2024 · 8 comments
Labels
documentation Improvements or additions to documentation

Comments

@Roby2002
Copy link

Roby2002 commented Mar 8, 2024

Hi,
how do I get a counter of calls made to API?
In one day I went from about 29500 available calls to 0, but I practically didn't use the integration, in the sense that I have 4 cameras configured but I only used the .ptz_location service to move them a couple of times, I don't understand how it's possible.
Before purchasing other calls I would like to solve the problem that caused them to be reset.

Thank you

@user2684 user2684 added the documentation Improvements or additions to documentation label Mar 9, 2024
@user2684
Copy link
Owner

user2684 commented Mar 9, 2024

Hi, https://community.home-assistant.io/t/imou-life-cloud-integration/462439/202, for your reference.
I'm evaluating to provide a way to count api calls, now you can enable debug mode but you would need to count them by yourself which is not handy.
But you should not have reached the limit so quickly with just few cameras. Do you have a polling interval different from the default? (15 minutes)

@Roby2002
Copy link
Author

Roby2002 commented Mar 9, 2024

Hi,
first of all thanks for the quick response.
No, I didn't change the polling time, but now I'll raise it.
Just to understand how calls are counted, is a camera call made every 15 minutes (default)? And is every action, like moving (imou_life.ptz_location) or activating a button another call? Or is a call made to each camera entity every 15 minutes? Can it be useful to reduce the number of monitored entities? Thanks again

@user2684
Copy link
Owner

user2684 commented Mar 9, 2024

Every 15 minutes each camera makes a call for updating the status of each configured switch, this is it. Changing the status of a switch would result in an API call, regardless of the polling interval. ptz would result in a single call as well. If you don't call the service, no calls are made. Reducing monitored entities would reduce the calls, definitely. But still 30000 calls are a lot to consume in a single day....

@Roby2002
Copy link
Author

Roby2002 commented Mar 9, 2024

Yes, you're right, maybe it's also due to the fact that I was doing some tests and I restarted it several times HA.
However, I did the calculations and with my 4 cam configuration with 25 entities I would have used up the calls in just over 3 days (25*4 entities for 24 hours, 4 times an hour makes 9600 calls per day).
Possibly there is the possibility of disabling polling for example by setting 0 sec

@user2684
Copy link
Owner

0 does not disable polling, maybe this could be added as an option in the future, good idea. But if you put there very high values, should do the same job. And then you can verify if the api call counter continues to increase. For any doubt, if you enable debug logging in the integration (https://github.com/user2684/imou_life?tab=readme-ov-file#debugging) you should see if something unexpected takes place.

@tapsystem
Copy link

Hello,
another questions on this point : do you think i can reduce api call disabeling unused sensors ? or it's a bad id ?

@tapsystem
Copy link

Hello, another questions on this point : do you think i can reduce api call disabeling unused sensors ? or it's a bad id ?

Still testing but it's llok to be a good solution : more than dive by 2 at the moment

@user2684
Copy link
Owner

user2684 commented Jun 2, 2024

Hi, the more entities you disable, fewer calls are made against the API so definitely yes. Have a look here for more details: https://github.com/user2684/imou_life/wiki/Imou-API-usage-restrictions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: High Priority
Development

No branches or pull requests

3 participants