Google Fit Support

Did you manage to convert the units?

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

sensor:
  platform: template
  sensors:
    sensor.radon_24hrsUS:
    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/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/google_fit/sensor.py", line 474, in update
    heartrate_datasources = self._get_datasources('com.google.heart_rate.bpm')
  File "/config/custom_components/google_fit/sensor.py", line 324, in _get_datasources
    data = datasources_request.execute()
  File "/usr/local/lib/python3.7/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/googleapiclient/http.py", line 837, in execute
    method=str(self.method), body=self.body, headers=self.headers)
  File "/usr/local/lib/python3.7/site-packages/googleapiclient/http.py", line 176, in _retry_request
    raise exception
  File "/usr/local/lib/python3.7/site-packages/googleapiclient/http.py", line 163, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/oauth2client/transport.py", line 175, in new_request
    redirections, connection_type)
  File "/usr/local/lib/python3.7/site-packages/oauth2client/transport.py", line 282, in request
    connection_type=connection_type)
  File "/usr/local/lib/python3.7/site-packages/httplib2/__init__.py", 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/__init__.py", line 1072, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/local/lib/python3.7/site-packages/httplib2/__init__.py", line 996, in _conn_request
    conn.request(method, request_uri, body, headers)
  File "/usr/local/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 987, in send
    self.sock.sendall(data)
  File "/usr/local/lib/python3.7/ssl.py", line 1034, in sendall
    v = self.send(byte_view[count:])
  File "/usr/local/lib/python3.7/ssl.py", line 1003, in send
    return self._sslobj.write(data)
BrokenPipeError: [Errno 32] Broken pipe

I found it on hemantkamalakar’s git page: https://github.com/hemantkamalakar/haconfigs/tree/d1bfe116faa4bf465cd9c58bab91fc1333167c25/custom_components
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/sensor.py", 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?

@Crickus
Did you manage to get it working? i’m still having exactly the same issue.
Are you using Google Suite like me by coincidence?

Yep. It sounds stupid, but all synchronization between third-party apps and Google fit works locally. Because of closing web interface for Google fit in March synchronization starts with Google fit locally and when Google fit synchronize data with online servers. So you need Google fit been active on your phone, but I just deleted it after making profile. What was my problem. I’m not sure about your situation.

Like other people am also having some issues with this component .

Doesn’t seem like it’s really updating any data besides pre defined weight and height …

Based on

and a few changes in GoogleFitHeartRateSensor, I created

2 Likes

would there be any way to get the “resting heart rate” that is displayed in google fit at all? Thanks!

anyone else had this error?

2019-12-12 20:34:36 ERROR (MainThread) [homeassistant.components.sensor] google_fit: Error on device update!
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 292, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 450, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/util/init.py”, line 240, in wrapper
result = method(*args, **kwargs)
File “/usr/src/homeassistant/homeassistant/util/init.py”, line 240, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/google_fit/sensor.py”, line 443, in update
last_time_update = time_updates[0]
IndexError: list index out of range

I think it is fixed (not cheed jet. I think that error occus the first call after 00:00).

1 Like

@vmanuel I believe your lastest release version mispelled the custom_components/google_fit/ with custom_components/google-fit/ which create an error.

@mathewtaylor2007 I hope you will be able to fixed it…

1 Like

Done (v1.1.4)

It is possible you have to uninstall the integration, remove the repo and reinstall it again.