Matthyeux / train-traveler

Train Traveler is a custom component for Home Assistant that retrieves the next train schedules for a given route as well as the last train of the day and disruptions if exists.
MIT License
3 stars 0 forks source link

[SUGGESTION] Activity periods and dynamic frequency #11

Open cmesplede opened 4 months ago

cmesplede commented 4 months ago

Hi.

In order to better handle the daily limit of 5000 requests per day, I was wondering if dynamically changing the refresh rate could be a good idea.

Configuration wise, there'd be 2 refresh rates :

Peak and rest periods should be configurable, of course.

This would allow a higher refresh rate during the peak periods (like every 5 minutes), and a slow refresh rate during the rest of the day (30 minutes, or maybe no update at all).

What do you think?

BR, Christophe

PS: great job, though!

Matthyeux commented 4 months ago

Hi @cmesplede,

Thanks for your suggestion.

I think adding a new option on refresh rate will not meet all the needs you bring. For example, some people may need more than two active update periods (e.g. schedule variation) and I'm not a big fan of locking the integration in this way.

But I understand the need to make the integration smoother regarding refresh rate and can offer the following:

With this feature, it will allow you to perform some automations to update data more frequently based on a schedule but it can also allow more use cases such as increasing the refresh rate only when a delay is observed.

Would this suit you ?

Matth.

ElGatitaux commented 1 month ago

Hello, I'm also interested in the possibility of forcing the update. Is it already functional?

thanks!

ElGatitaux