cyberjunky / home-assistant-google_fit

:hearts: This component tracks your Google Fit activities.
MIT License
99 stars 20 forks source link

Update Interval? #5

Open think-nice-things opened 3 years ago

think-nice-things commented 3 years ago

How often are the sensors updated? Adjusting this to something like at least every few minutes would be helpful at least for the heart rate.

cyberjunky commented 3 years ago

Every 30 minutes, Google changed their API rate limits to 10000/month (we think) I don't know it this is true for all endpoints, or we need to change code with different fetch processes with their own poll rates.

think-nice-things commented 3 years ago

Hi I digged a litte into the code. It seems that for every sensor a dataPointChanges().list() is requested anyway. What is returned is a list of data points but google_fit just uses the latest instead of updating HA with all datapoints which are not in HA so far. So even if google is contacted every 30 minutes only, it might be able to get more datapoints for example if fit stores more datapoints than every 30 minutes only.

There are sensors which are probably not really updated frequently (like size or weight). There are sensors which maybe are updated frequently, take for example heart rate. If doing a workout, the heart rate might be updated more frequently.

It would be helpful, if google_fit integration would update HA with all datapoints of the list which are not yet in HA.