Google fit Integration Home Assistant

Hi,

I am trying to configure the google fit api. I configured my api account on the google side, installed the custom component via hacks and added the secret/ client to my configuration.yaml. The error I get is:

Error: Invalid response 400. Error: invalid_scope
You will need to restart hass after fixing

Although you don‘t have to set any scopes. I don‘t get it. Does anybody have any idea?

Thanks in advance.

The API seems to be configured correctly, because the calendar integration is working correctly.

I’ve also been getting that error for months. I would also like to know what to do in this case.

I’ve done a new Google Fit integration where the configuration + authentication is done completely through the UI if you want to try it out instead:

Hopefully it should fix your issue

1 Like

Hi,
thank you so much. Now it works.

For everyone wondering, in the documentation of the yaml configured fit integration it says, that the OAuth client should be configured as “TV an limited input”. At first the gui configuration didn’t work. After i checked the gmail configuration, which yorkshires’ repository refers to, it says to be configured as “web application”.

After I changed the OAuth Type it worked.

Hi,

ís it possble to change the update rate of the sensor? They are updating every hour though I would like them to update more frequently.

1 Like

Hi,

Unfortunately not. The integration is polling every minute but the data from Google isn’t available immediately which is why there can be a delay of roughly 30-60 minutes before the sensor data is updated.

@Yorkshire_IoT Thank you for the integration.
Setting it up was easy. I just have one strange thing happening here.
My step count is off. and it not with a few steps, It is off by 15K steps.
I’ve been walking a lot, but not that much.
All the other data is correct, weight, height, etc.
All other services that are linked to google fit do display the correct data.
Hope you can help me with this.

Regards,

No problem, glad you’ve found it useful.

That is a strange one. Could you raise an issue on the GitHub integration page? It’s just easier for me to track problems on there. Thanks

@Yorkshire_IoT Thank you for the integration. This way it makes it much easier to authenticate.
There is one strange thing though. I do have (I think) all of the available sensors in HA, but only a few have a value (blood pressure, heart rate, height, sleep (though with value 0) and weight). All other sensors have the value unknown for two days now.
What could be the reason?

Hi, can I ask what version you’re on? A change was made in the most recent version to allow the user to configure whether they wanted to see 0 or unknown when there is no data available in the time frame on your Google Fit account

I’m on v0.3.0

It sounds like there’s no data in your account for those sensors within the time period the sensor is looking for which is detailed on the sensor table in the repository README.

If you’d rather see 0 instead of unknown you can configure the integration options. The first time around you might have to cycle the button and press configure first before putting it back to the 0 option to force it to update.

If you’re still not seeing any sensor data I’d double check it’s there on your Google Fit app, wait at least an hour for it to update to the Google database (I’ve also found annoyingly that my Fit data never syncs over mobile data, I have to be on WiFi) and hopefully it’ll be there.

If you still see nothing then follow the instructions here to submit a data request in the OAuth playground and see if there is data in your account:

Sorry, it was my fault. Turns out I was using the wrong Google account. :innocent:
It is working now. Sorry and thank you for your time.

@Yorkshire_IoT thanks for this integration, setup was pretty smooth (even with all of Google’s obtuse admin screens)

An issue I’m having is that data from my FitBit doesn’t seem to make it to Google Fit through Health Connect unless I open the Google Fit app. So what happens is unless I remember to open the app at the end of the day, the final step count doesn’t make it into HA. I just get some random intermediate account from earlier in the day.

Is there a way to ensure that the day’s final count always makes it into HA for that day?

Thanks!

Hi @chkaloon,

That sounds a lot like your phone is using power saving measures to stop the app from running. It’s different for every phone so I won’t try explain how to fix this as Google will be a lot better but to get data constantly the Google Fit app needs to be constantly running.

Note, it can also take around an hour for the data in your Google Fit app to be uploaded to the servers where it’s then query-able by the integration.

Hope that helps

Thanks, I set the Fit app to “Never Sleep”. We’ll see if that helps

No luck, it’s not updating except when kicked. And the data in Health Connect is correct.

I can’t really use this if I just get a random reading for steps each day rather than the total at the end of the day