Google Fit Support

I was wrong typying. I have 0.84.6 release and it’s not a beta.
I will try again to run this component and then let you know…
Will you share your code ?

@maurizio53 code can be found here.

Mi Band 3 Integration

1 Like

Thanks, but i cannot get the same card as yours. I get a huge circle sensor for every sensor and not small like yours. Plus, will you share your background image?

@jimpower That’s a good point. I am syncing Mi Band 2 data using MI Fit to Google Fit. I will check if I can access Sleep data using Google Fit REST API’s.

@Bob_NL Please check my github repo for updated Google_fit component.
Also make sure that you can see steps and calories in https://fit.google.com

1 Like

As mentioned here
Looks like Google removed the visibility of sleep data in their own native app and in their WebView (https://fit.google.com) too!
Although Mi Fit app is showing that Sleep data and steps are being synched with Google Fit i cannot see anything related to sleep in the Journal tab in Google Fit.

@hemantkamalakar I can get a Intent received when I fall asleep and wake in tasker so that might be how I can acheive it for now. Shame as I really want to access when i am in deep sleep to trigger some automations.

Thanks for looking into this for me.

@maurizio53 rather then hijacking this thread head over to the one I linked above and post your code for me so I can help from there.

Thank you but i solved my problem…

1 Like

@hemantkamalakar I updated the component but still do not get the steps and calories.
I do have an error in my logfile now:

2019-01-08 05:02:12 ERROR (MainThread) [homeassistant.components.sensor] google_fit: Error on device update!
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/google_fit.py", line 306, in update
    self._update_steps_data()
  File "/home/homeassistant/.homeassistant/custom_components/sensor/google_fit.py", line 423, in _update_steps_data
    get(userId='me', dataSourceId=STEPS_DATA_SOURCE, datasetId=DATA_SET). \
  File "/srv/homeassistant/lib/python3.5/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/googleapiclient/http.py", line 842, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/fitness/v1/users/me/dataSources/derived%3Acom.google.step_count.delta%3Acom.google.android.gms%3Aestimated_steps/datasets/1546902000000000000-1546920131000000000?alt=json returned "Scope not included to read data for this type of source.">
2019-01-08 05:02:12 WARNING (Thread-4) [googleapiclient.http] Encountered 403 Forbidden with reason "forbidden"
"Scope not included to read data for this type of source."

Not sure what it means. Did I not setup the API correctly?

@Bob_NL Could you please try to delete the .google_fit.credentials.json file and restarting home assistant?

Hi,

How come this is not an official component!!! :slight_smile:

Trying to make it work on 0.88b2 and getting a IDGoogle error

INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
ERROR:homeassistant.util.yaml:could not determine a constructor for the tag ‘!GoogleID’
in “/config/configuration.yaml”, line 298, column 16
Failed config
General Errors:
- Error loading /config/configuration.yaml: could not determine a constructor for the tag ‘!GoogleID’
in “/config/configuration.yaml”, line 298, column 16
Successful config (partial)

Can you help me?

Ok nevermind. Made it work. I forgot the !secret before my google ID.

Any way of changing weight to Lbs and Height to ft?

Thanks

Mine works. Did you rename the py file to sensor.py?

Has anyone got a good way of submitting your weight to Google Fit? Been able to get my BS440 scales to submit weight to Home Assistant via MQTT, and can trigger events when that updates. Would be useful if that could then be submitted to Google Fit rather than manually needing to do that.

(The holy grail would submit to Tom Tom Sports, Strava, and MyFitnessPal too, but let’s start small!)

I can’t see icons that you have in my card. Did you set them manualy?

1 Like

Yes. I have customized the entities like

sensor.steps:
icon: mdi:walk
sensor.distance:
icon: mdi:map-marker-distance
sensor.time:
icon: mdi:clock-outline
sensor.weight:
icon: mdi:weight-kilogram

Thanks for great work on this !

I’ve fixed some requirements issues with the google_fit sensor, moved it to component, cleaned it and specified default icons.

2 Likes

I got this component setup and it pulls some data but not all, it only pulls my height and weight. Calories, Distance, Move Time, and Steps are all reporting 0

Updated Google fit custom component with Sleep data support. Please note that I am using Mi band 2 to track steps and sleep. Mi Fit app is sending the fitness data to Google fit. This component is fetching the data using Google fit REST API’s.
Google Fit custom component
and here is the screenshot

5 Likes