Google Fit Support

Can this be adapted to the iPhone? Or there is another way to show steps from an iPhone device

Ok so this is what I have so far thanks again @hemantkamalakar

@maurizio53 This component is working for me on 0.84.6 is this what you mean or are you running a beta release? If so you can’t surely expect support running on beta.

2 Likes

Thanks a lot @jimpower. Had a look at your github repo. You have a great home assistant setup.

1 Like

I have my sleep being synced with google fit also do you think you could help me to get this sensor also? I had a look at the google api and there is a call for sleep data but I can’t seem to find it at the moment.

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