Google Fit Support

I need help setting this component up under 0.97.2.
I dropped the file in custom_components/google_fit but my log says

Integration google_fit not found when trying to verify its sensor platform.
2:53 PM components/hassio/ (ERROR)

Drop an empty file called in that same directory. The custom_component author hasn’t made this very clear.

tried that and authenticated/gave access through the notification but after several restarts it still doesn’t show any entities

Mine shows entities as sensor.GOOGLEFIT_SENSOR_NAME_steps (in my case, sensor.fit_daniel_steps).

If there aren’t any errors in the error log and it still isn’t adding these, try turning on debug logging and then restarting home assistant. That should show something.

I have not read the code changes that were made over my original gist, but in general, there are 3 files required:

  • which is required for Python to define a module.
  • which is required for Home Assistant to be able to implement this as a sensor.
  • manifest.json which I am unsure if it’s required, but basically gives metadata about the component.

If you delete them, I would not expect the component to work.

If you were trying to delete it, then delete all the files and the folder for the custom_componenent/google_fit. You may also need to find, within the config folder, the files for the Google credentials which are stored there. This would not affect the component as it won’t load without the folder, but it will ensure you have a fresh refresh if you ever re-install it.

@hemantkamalakar ? Any ideas why it stopped working on 0.97? We have to make that component an official one

I am running it on 0.97.2. I have recently added support for Heart rate sensor. This is how it looks:

1 Like

Do you plan to add HACS support?


Just corrected my issue, if it can help others. In my config file, I had two hidden files .google.token. Deleted them and reboot solved the issue

Did you manage to convert the units?

Nope, you have to do something like this but haven’t had time to do it

  platform: template
    unit_of_measurement: 'pCi/L'
    value_template: {{ (float(states('sensor.radon_24hrs')) * 1 / 37) }}

scan_interval set to 30 ,but it takes few hours to sync, is this expected?

Where can I get this component, please?

It only shows my height and weight. The other sensors dont get any data or updates.

Update for sensor.googlefit_heartrate fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/", line 441, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/util/", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/google_fit/", line 474, in update
    heartrate_datasources = self._get_datasources('')
  File "/config/custom_components/google_fit/", line 324, in _get_datasources
    data = datasources_request.execute()
  File "/usr/local/lib/python3.7/site-packages/oauth2client/", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/googleapiclient/", line 837, in execute
    method=str(self.method), body=self.body, headers=self.headers)
  File "/usr/local/lib/python3.7/site-packages/googleapiclient/", line 176, in _retry_request
    raise exception
  File "/usr/local/lib/python3.7/site-packages/googleapiclient/", line 163, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/oauth2client/", line 175, in new_request
    redirections, connection_type)
  File "/usr/local/lib/python3.7/site-packages/oauth2client/", line 282, in request
  File "/usr/local/lib/python3.7/site-packages/httplib2/", line 1322, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/local/lib/python3.7/site-packages/httplib2/", line 1072, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/local/lib/python3.7/site-packages/httplib2/", line 996, in _conn_request
    conn.request(method, request_uri, body, headers)
  File "/usr/local/lib/python3.7/http/", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/", line 1026, in _send_output
  File "/usr/local/lib/python3.7/http/", line 987, in send
  File "/usr/local/lib/python3.7/", line 1034, in sendall
    v = self.send(byte_view[count:])
  File "/usr/local/lib/python3.7/", line 1003, in send
    return self._sslobj.write(data)
BrokenPipeError: [Errno 32] Broken pipe

I found it on hemantkamalakar’s git page:
But I found different versions/branches on this thread, I’m not sure wich one to install as I get erros with the one I’m currently using.

Can you share your config please and would it be possible to get the “resting heart rate” value from google fit somehow? thankyou!!

I’m getting this error on a clean install that’s been authorized.

2019-09-30 14:47:17 ERROR (MainThread) [homeassistant.components.sensor] google_fit: Error on device update!
  File "/config/custom_components/google_fit/", line 330, in _get_dataset
    return self._client.users().dataSources(). \
AttributeError: 'NoneType' object has no attribute 'users'

I’m using the config you mentioned in the post I’m replying to. Where does the ‘name’ field come from is it a local name or does it need to match something in google?

EDIT: Simply needed a restart to work

for some reason im not seeing the sleep sensor information coming through. Any suggestions?

Yeah, me too. I had it come up briefly after first connecting, however today (the next day) the state is empty. Tried restarting HA to no real effect

Hi. I installed this component, made token. Sensors appeared in HA, but they are all empty, besides height and weight. So it looks like token is good. But why they didn’t fetch data? Three days pass throw, but sensors still show nulls. Any guess?