Google Fit Sensor Component

Overview

hacs_badge made-with-python Donate

Google Fit Sensor Component

Based on

Creates Google Fit sensors. At the moment, the component provides following measurements:

  • steps
  • distance
  • time
  • calories
  • weight
  • height
  • sleep
  • heartrate
  • oxygen
  • blood pressure
  • nutrition
  • hydratation
  • BMR

Installation

HACS - Recommended

  • Have HACS installed, this will allow you to easily update.
  • Add https://github.com/IvanVojtko/googlefit-homeassistant as a custom repository with Type: Integration
  • Click Install under "Google Fit" integration.
  • Restart Home-Assistant.

Manual

  • Copy directory custom_components/google_fit to your /custom_components directory.
  • Configure.
  • Restart Home-Assistant.

Example configuration.yaml

In order to add this component as is, add a new sensor:

sensor:
  - platform: google_fit
    name: Google Fit

Google Fit credentials

In order to generate credentials.json, see the prerequisites for the Google Calendar component: https://www.home-assistant.io/components/calendar.google/#prerequisites To make sensor work you have to enable the Fitness API in your project. Add all Fitness API read scopes. After generating credentials, download credentials.json file and place it into this directory, next to get_credentials.py In oder to enable Fitness API open Google Cloud console: https://console.cloud.google.com/apis/library/fitness.googleapis.com and enable API.

To allow HA access your Fit data, you need to complete a challenge. It can't be completed by HA so that's why you need to use get_credentials.py script. First install all the requirements using python -m pip install -r requirements.txt. Then run script python get_credentials.py, open the generated URL, allow access and don't forget to tick mark all permissions. This script will generate .google_fit.token file. Copy this file to your HA configuration directory.

Sensors

Sensor name Entity
Steps sensor.google_steps
Calories sensor.google_calories
Distance sensor.google_distance
Heart rate sensor.google_heart_rate
Resting heart rate sensor.google_resting_heart_rate
Move time sensor.google_move_time
Blood oxygen sensor.google_oxygen
Sleep sensor.google_sleep
Blood pressure SYS sensor.google_blood_pressure_sys
Blood pressure DIA sensor.google_blood_pressure_dia
Hydratation sensor.google_hydratation
BMR sensor.google_bmr

Attributes

Attribute name Entity Attribute
Potassium sensor.google_nutrition potassium
Calcium sensor.google_nutrition calcium
Vitamin A sensor.google_nutrition vitamin_a
Vitamin C sensor.google_nutrition vitamin_c
Total carbs sensor.google_nutrition carbs.total
Polyunsaturated fat sensor.google_nutrition fat.polyunsaturated
Monounsaturated fat sensor.google_nutrition fat.monounsaturated
Calories sensor.google_nutrition calories
Trans fat sensor.google_nutrition fat.trans
Total fat sensor.google_nutrition fat.total
Sodium sensor.google_nutrition sodium
Saturated fat sensor.google_nutrition fat.saturated
Protein sensor.google_nutrition protein
Cholesterol sensor.google_nutrition cholesterol
Iron sensor.google_nutrition iron
Sugar sensor.google_nutrition sugar
Dietary fiber sensor.google_nutrition dietary_fiber

Comments
  • .google_fit.token format

    .google_fit.token format

    When I run python3 get_credentials.py the resulting token is in some strange format that Home Assistant doesn't like.

    <80>^D<95><80>^D^@^@^@^@^@^@<8c>^Ygoogle.oauth2.credentials<94><8c>^KCredentials<94><93><94>)<81><94>}<94>(<8c>^Etoken<94><8c>TOKEN REMOVED<94><8c>^Fexpiry<94><8c>^Hdatetime<94><8c>^Hdatetime<94><93><94>C
    ^Gæ^B^D^V^P^\^N9<87><94><85><94>R<94><8c>^Q_quota_project_id<94>N<8c>^G_scopes<94>]<94>
    ...
    

    I'm assuming this should be a JSON string. @IvanVojtko Can you point me in the right direction to generating a proper token?

    opened by Terit 3
  • Redirect to localhost:8080 after OAuth Consent Screen

    Redirect to localhost:8080 after OAuth Consent Screen

    When i access the URL generated by get_credentials.py and check all permissions and click Continue i get redirected to a URL like http://localhost:8080/?state=rYmM5PTvl7MbN... and the script will not generate a .google_fit.token. When i check the generated URL, there is a "redirect_uri" parameter which specifies the localhost:8080.

    Did i miss something in the configuration?

    // Edit: I found, that in the credentials.json the "redirect_url" to localhost is specified. I changed it to my external HA domain, but then Google gives the error "Redirect URI mismatch".

    opened by remklov 1
  • installation

    installation

    Hallo, thank's for Your job, I've follow all the procedure, but finally I have no idea that how i can finalize the HA data access, please, can You explain step by step how i can run script and optain authorisations?! Thank's in advance, Gdi

    opened by Gdii 1
  • Question about multiple Google Fit users

    Question about multiple Google Fit users

    I was able to get your integration working today and it is very cool! Thank you for creating this. I am wondering if it is possible to pull Fit data from to different Google accounts? I'd really love to be able to pull stats from my Fit as well as my girlfriends. Perhaps multiple .google_fit.token? Thanks in advance!

    opened by Andrewdlec 3
  • Error 400: invalid_request

    Error 400: invalid_request

    After couple of days working the integration stopped providing data, log says:

    google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})

    while trying to re-authenticate with google, google says

    You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy for keeping apps secure.

    I am only one experiencing this?

    opened by baldachyn 11
  • Question about Fit heartrate reporting and update interval

    Question about Fit heartrate reporting and update interval

    Hi! First, thank you for creating this integration. I've only been using it for a bit over a day now, but I've been really enjoying it so far.

    The only maybe-issue I'm running into so far is with the Google Fit heart rate sensor. Specifically, for me, it seems to update very irregularly - often only once every several hours - and the resulting data and history in Home Assistant have little in common with the data that's visible in Google Fit directly.

    Here's an example, with my February 8th heart rate data as shown in the Fit app overlaid on a graph of the same time period in Home Assistant.

    GFit Heartrate

    I'm new to all of this, but especially the Google API stuff (I just fumbled through the API instructions, I think correctly), so I don't know if this 'problem' is something I did wrong, or something up with the integration, or if this data is just as good as Google is willing to offer.

    Any help or insight on how to get better heartrate data (or just confirmation that this is as good as it gets, disappointing as that would be) is greatly appreciated.

    opened by NCC1941 5
Releases(v0.0.4)
Owner
Ivan Vojtko
Ivan Vojtko
A log likelihood fit for extracting neutrino oscillation parameters

A-log-likelihood-fit-for-extracting-neutrino-oscillation-parameters Minimised the negative log-likelihood fit to extract neutrino oscillation paramete

Vid Homsak 1 Jan 23, 2022
Urban Big Data Centre Housing Sensor Project

Housing Sensor Project The Urban Big Data Centre is conducting a study of indoor environmental data in Scottish houses. We are using Raspberry Pi devi

Jeremy Singer 2 Dec 13, 2021
This Open-Source project is great for sensor capture and storage solutions.

Phase 1 This project helps developers in the creation of extended realities that communicate with Arduino and require the security of blockchain stora

Wolfberry, LLC 10 Dec 28, 2022
Ahmed Hossam 12 Oct 17, 2022
Custom component to calculate estimated power consumption of lights and other appliances

Custom component to calculate estimated power consumption of lights and other appliances. Provides easy configuration to get virtual power consumption sensors in Home Assistant for all your devices which don't have a build in power meter.

Bram Gerritsen 552 Dec 28, 2022
Irrigation Component V4 providing support for a custom card

Irrigation Component V4 This release sees the delivery of a custom card https://github.com/petergridge/irrigation_card to render the program options s

null 12 Oct 28, 2022
JLC2KICAD_lib is a python script that generate a component library for KiCad from the JLCPCB/easyEDA library.

JLC2KiCad_lib is a python script that generate a component library (schematic, footprint and 3D model) for KiCad from the JLCPCB/easyEDA library. This script requires Python 3.6 or higher.

Nicolas Toussaint 73 Dec 26, 2022
MuMMI Core is the underlying infrastructure and generalizable component of the MuMMI framework

MuMMI Core is the underlying infrastructure and generalizable component of the MuMMI framework, which facilitates the coordination of massively parallel multiscale simulations.

null 4 Aug 17, 2022
An optional component handler for hikari, inspired by discord.py's views.

hikari-miru An optional component handler for hikari, inspired by discord.py's views.

null 43 Dec 26, 2022
Streamlit component to display topics from Streamlit's community forum related to any exception.

streamlit-forum Streamlit component to display topics from Streamlit's community forum related to any exception. Installation pip install streamlit-fo

Snehan Kekre 7 Jul 15, 2022
Your Google Recon is Now Automated

GRecon : GRecon (Greei-Conn) is a simple python tool that automates the process of Google Based Recon AKA Google Dorking The current Version 1.0 Run 7

adnane-tebbaa 189 Dec 21, 2022
2 Way Sync Between Notion Database and Google Calendar

Notion-and-Google-Calendar-2-Way-Sync 2 Way Sync Between a Notion Database and Google Calendar WARNING: This repo will be undergoing a good bit of cha

null 248 Dec 26, 2022
The Google Assistant on a rotary phone

Google Assistant Rotary Phone Shoutout to my dad who had this idea a year ago and I'm only now getting around to doing it. Notes This is the code used

rydercalmdown 10 Nov 4, 2022
Google Foobar challenge solutions from my experience and other's on the web.

Google Foobar challenge Google Foobar challenge solutions from my experience and other's on the web. Note: Problems indicated with "Mine" are tested a

Islam Ayman 6 Jan 20, 2022
It is a personal assistant chatbot, capable to perform many tasks same as Google Assistant plus more extra features...

PersonalAssistant It is an Personal Assistant, capable to perform many tasks with some unique features, that you haven'e seen yet.... Features / Tasks

Roshan Kumar 95 Dec 21, 2022
This repo is related to Google Coding Challenge, given to Bright Network Internship Experience 2021.

BrightNetworkUK-GCC-2021 This repo is related to Google Coding Challenge, given to Bright Network Internship Experience 2021. Language used here is py

Dareer Ahmad Mufti 28 May 23, 2022
An awesome script to convert the University Of Oviedo web calendar to Google or Outlook calendars.

autoUniCalendar Un script en Python para convertir el calendario de la intranet de la Universidad de Oviedo en un calendario de Outlook o Google Calen

Bimo99B9 14 Sep 28, 2022
Check COVID locations of interest against Google location history

Location of Interest Checker Script to compare COVID locations of interest to Google location history. The script produces a map plot (as shown below)

null 9 Mar 30, 2022
Traductor de webs desde consola usando el servicio de Google Traductor.

proxiGG Traductor de webs desde consola usando el servicio de Google Traductor. Se adjunta el código fuente para Python3 y un binario compilado en C p

@as_informatico 2 Oct 20, 2021