Caution
Due to Google deprecating the Fit API (see below), Google are blocking
any new developers signing up to this API. As such, any new user wanting to use
this integration who has not already signed up to the Fit API will not be able
to. To anyone affected by this, I'm as annoyed and disappointed as you
Warning
Google is shutting down the REST API on 30th June 2025. As this integration relies on this API, it will no longer work after this time.
Additional information (and maybe solutions if they come along) can be found on Issue #250.
This integration interfaces with the Google Fit REST API to provide Google Fit data within Home Assistant.
This integration will set up the following platforms.
Platform | Name | Description | Infrequent Update |
---|---|---|---|
sensor |
active_minutes_daily |
Active Minutes. Reset daily. | ☐ |
sensor |
calories_burnt_daily |
Calories burnt (kcal). Reset daily. | ☐ |
sensor |
basal_metabolic_rate |
Base Metabolic Rate (kcal). Calories per day based on weight and activity. | ☐ |
sensor |
distance_travelled_daily |
Distance travelled (metres). Reset daily. | ☐ |
sensor |
heart_points_daily |
Heart Points earned. Reset daily. | ☐ |
sensor |
height |
Height (metres). | ☑ |
sensor |
weight |
Weight (kilograms). | ☑ |
sensor |
body_fat |
Body Fat (percentage). | ☑ |
sensor |
body_temperature |
Body Temperature (celsius). | ☑ |
sensor |
steps |
Number of steps taken. Reset daily. | ☐ |
sensor |
deep_sleep |
Deep sleep time over the past 24 hours. May not be available depending on sleep data provider. | ☐ |
sensor |
light_sleep |
Light sleep time over the past 24 hours. May not be available depending on sleep data provider. | ☐ |
sensor |
rem_sleep |
REM sleep time over the past 24 hours. May not be available depending on sleep data provider. | ☐ |
sensor |
awake_time |
Awake time during a sleep session over the past 24 hours. Not overall daily awake time. May not be available depending on sleep data provider. | ☐ |
sensor |
sleep |
Overall sleep time over the past 24 hours. | ☐ |
sensor |
blood_pressure_diastolic |
Most recent Diastolic blood pressure reading. | ☐ |
sensor |
blood_pressure_systolic |
Most recent Systolic blood pressure reading. | ☐ |
sensor |
heart_rate |
Most recent heart rate measurement. | ☐ |
sensor |
resting_heart_rate |
Most recent resting heart rate measurement. | ☐ |
sensor |
blood_glucose |
Latest blood_glucose measurement (mmol/L). | ☐ |
sensor |
hydration |
Total water consumed. Reset daily. | ☐ |
sensor |
oxygen_saturation |
The most recent blood oxygen saturation measurement. | ☐ |
Please note, there is a delay (roughly 30-60 minutes) between sensor measurements being recorded on the Google Fit app and the data then being available to query of the rest API. As such, although this integration polls the API more frequently than this it will take at least this length of time for your data to appear in Home Assistant. It is not instantaneous.
I will not try to duplicate what has already been documented countless times before as it will no doubt become out of date.
Instead, follow the instruction in the Official Home Assistant Docs for Google Mail under the "Generate Client ID and Client Secret" section, replacing instructions for 'Gmail API' with 'Fit API'.
HACS Installed in Home Assistant: Home Assistant Community Store
- Go to HACS
- Go to Integrations
- Click Explore & Download Repositories
- Find the integration as
Google Fit
- Click install.
- Restart Home Assistant.
- Using the tool of choice open the directory (folder) for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
directory (folder) there, you need to create it. - In the
custom_components
directory (folder) create a new folder calledgoogle_fit
. - Download all the files from the
custom_components/google_fit/
directory (folder) in this repository. - Place the files you downloaded in the new directory (folder) you created.
- Restart Home Assistant
Setup is done completely in the UI. Go to your integrations page by clicking the button below.
Click "+ Add Integration", search for "Google Fit" and follow the steps. If you have set the app you created in the Credentials configuration to publish (which you should've done to avoid re-authentication problems) then you will probably see a warning step asking if you want to proceed.
You can hit "Advanced", then "Proceed" as you are the 'developer' of the app, as you created the app and credentials in your own account.
The following options can be tweaked after setting up the integration:
Option | Description | Default |
---|---|---|
Update interval | Minutes between REST API queries. Can be increased if you're exceeding API quota | 5 (minutes) |
Infrequent Sensor Multiplier | Multiply the update interval by this for less frequently updated sensors, e.g. height. This reduces unnecessary API queries. | 12 (so default 5 mins update interval changes to an hour) |
All sensors in this integration can be grouped into two categories; cumulative or individual. This is due to how data is reported in your Google Fit account. Every piece of data is only associated with a time period and has no underlying logic for running totals.
For example, steps are reported like this in your account:
- 1st January 2023 9:32:01 - 495
- 2nd January 2023 11:54:03 - 34
- 2nd January 2023 13:02:40 - 1005
- 2nd January 2023 17:16:27 - 842
There is then some built-in logic in this integration to work out what sensor we're dealing with, and to either sum up these values over a logical time period, or to just take the latest known value, when the sensor is something like height.
If you're interested in all the underlying logic, it's contained in api.py.
The behaviour of this integration when there is no data available in your account differs depending on the sensor category.
Cumulative sensors will use 0 as their base value and this will be their value in Home Assistant if their is no data in your Google Fit account for that sensor.
Individual sensors will only report a value if they can find some data in your Google Fit account.
Otherwise, they will show Unknown
.
Besides Unknown
, there is an additional Home Assistant sensor state; Unavailable
.
This state has nothing to do with if there is or isn't data in your account. It indicates some error in the fetching of the data. Your internet has stopped working, or maybe the Google servers are down. In some cases, it may also indicate there is a bug with this integration. If that is the case, please report it as a bug.
There are no plans to ignore these data fetching issues and retain the last known sensor value. The reasoning for this is:
- This is the correct representation of the sensors state, and
- It indicates to the user that there is some underlying issue with the integration itself and this should not be hidden.s
Use the following steps to setup additional Google Fit accounts in Home Assistant.
- Go through all the steps in Authentication Configuration for the second account, e.g. create a completely separate application cloud application, enable Fit API and create new credentials.
- Go to Integrations and click the 3 dots in the top right to go to Application Credentials.
- Click "Add Application Credentials", select "Google Fit" as the integration and add in the newly created credentials.
- Go through the configuration flow, making sure to pick the correct new Google account when prompted.
- Once completed you should now see multiple Google Fit integration credentials in the table.
- Go back to integration, click "Add Integration", search for Google Fit and then choose the newly created credentials as the implementation when prompted.
If you made a mistake somewhere when configuring your credentials, whether with the Google Cloud Console or within Home Assistant, you need to delete not just the integration to be prompted to reconfigure but also the 'bad' credentials.
To do this, go to the Integrations page and click the 3 dots in the top right and go to "Application Credentials". From there you can select the credentials and remove them.
If you want to contribute to this please read the Contribution guidelines