muppet3000 / homeassistant-growatt_server_api

Home Assistant Integration for Growatt - Upstream repo for the growatt_server integration that is part of the Core Home Assistant repository
MIT License
53 stars 6 forks source link

ENCHANCEMENT - Hard set time to get data from cloud #31

Open Saentist opened 1 year ago

Saentist commented 1 year ago

Is your feature request related to a problem? Please describe. Let's reduce cloud ban, by set fixed data get time.

Describe the solution you'd like On integration install time to be created hard set time with will not allow to get data "Before" next scheduled time frame, no mater system restarted, rebooted or integration reloaded etc.

Describe alternatives you've considered Example" Install and configured time: 15:24h next pool time : +60min (or any other acceptable time in configuration 2h 3h etc.) If reboot, hard No to take data until next allowed time frame.

Additional context This solution is 100% needed to avoid "cloud ban" If possible to see somewhere in integration to have: countdown clock to the next data pool

muppet3000 commented 1 year ago

Given that I'm winding down support for this integration I'm not going to spend time trying to work out how to do this. There is the ability to disable the polling altogether and then set up an automation to only poll when you want, so people can use that instead. I'll leave this ticket open for now but when the new Grott integration takes over I'll be closing anything that isn't essential in this repo.

pheijms commented 8 months ago

Given that I'm winding down support for this integration I'm not going to spend time trying to work out how to do this. There is the ability to disable the polling altogether and then set up an automation to only poll when you want, so people can use that instead. I'll leave this ticket open for now but when the new Grott integration takes over I'll be closing anything that isn't essential in this repo.

Hi Muppet,

How can I disable the polling? And can you tell how I can set up an automation to poll the data?

Cheers, Pieter

muppet3000 commented 8 months ago

This is how you can set up an automation to poll the data (copied from my old HA automation for it): image

What I remember how to disable polling I'll post it here.

pheijms commented 8 months ago

This is how you can set up an automation to poll the data (copied from my old HA automation for it):

What I remember how to disable polling I'll post it here.

Thanks Muppet!

Please let me know how I can disable polling.

muppet3000 commented 8 months ago

FYI I did a little more digging, I'm not 100% certain, but I think the above screenshot that I posted also overrides the default polling interval, so you don't need to disable polling directly (I might be wrong though)

pheijms commented 8 months ago

FYI I did a little more digging, I'm not 100% certain, but I think the above screenshot that I posted also overrides the default polling interval, so you don't need to disable polling directly (I might be wrong though)

Thanks!

I think I found it in the code, there is:

SCAN_INTERVAL = datetime.timedelta(minutes=5) THROTTLE = datetime.timedelta(minutes=1)

I can set the scan_interval to more minutes. I hope this fixes my to much API requests. I only don't understand what Throttle means.

muppet3000 commented 8 months ago

You don't need to change anything there at all.

There's some nice documentation on it here for the ping integration: https://www.home-assistant.io/integrations/ping/

You can just do exactly the same for this integration, no need to go tweaking the code

pheijms commented 8 months ago

You don't need to change anything there at all.

There's some nice documentation on it here for the ping integration: https://www.home-assistant.io/integrations/ping/

You can just do exactly the same for this integration, no need to go tweaking the code

Ah it will override the default, didn't know. Thanks again.

muppet3000 commented 8 months ago

No, it won't override the default, that's what disabling polling does. Then the automation polls only at the frequency you require.

pheijms commented 8 months ago

No, it won't override the default, that's what disabling polling does. Then the automation polls only at the frequency you require.

I see it now, it will disable the default polling..