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
Kubernetes-native workflow automation platform for complex, mission-critical data and ML processes at scale. It has been battle-tested at Lyft, Spotify, Freenome, and others and is truly open-source.

Flyte Flyte is a workflow automation platform for complex, mission-critical data, and ML processes at scale Home Page · Quick Start · Documentation ·

Flyte 3k Jan 01, 2023
A Desktop application for the signalum python library

Signalum Desktop A Desktop application on the Signalum Python Library/CLI Tool. The Signalum Desktop application is an attempt to develop a single too

BISOHNS 35 Feb 15, 2021
Install packages with pip as if you were in the past!

A PyPI time machine Do you wish you could just install packages with pip as if you were at some fixed date in the past? If so, the PyPI time machine i

Thomas Robitaille 51 Jan 09, 2023
This is a library which aiming to save all my code about cpp. It will help me to code conveniently.

This is a library which aiming to save all my code about cpp. It will help me to code conveniently.

Paul Leo 21 Dec 06, 2021
Машинное обучение на ФКН ВШЭ

Курс "Машинное обучение" на ФКН ВШЭ Конспекты лекций, материалы семинаров и домашние задания (теоретические, практические, соревнования) по курсу "Маш

Evgeny Sokolov 2.2k Jan 04, 2023
Gobigger Explore For Python

Gobigger-Explore 🔮 GoBigger Challenge 2021 Baseline en/中文 🤖 Introduction This is the baseline of GoBigger Multi-Agent Decision Intelligence Challeng

OpenDILab 145 Dec 22, 2022
A discord group chat creator just made it because i saw people selling this stuff for like up to 40 bucks

gccreator some discord group chat tools just made it because i saw people selling this stuff for like up to 40 bucks (im currently working on a faster

baum1810 6 Oct 03, 2022
Um sistema de llogin feito em uma interface grafica.

Interface-para-login Um sistema de login feito com JSON. Utilizando a biblioteca Tkinter, eu criei um sistema de login, onde guarda a informações de l

Mobben 1 Nov 28, 2021
A simple program to recolour simple png icon-like pictures with just one colour + transparent or white background. Resulting images all have transparent background and a new colour.

A simple program to recolour simple png icon-like pictures with just one colour + transparent or white background. Resulting images all have transparent background and a new colour.

Anna Tůmová 0 Jan 30, 2022
A plugin for managing mod installers in Mod Organizer 2

Reinstaller v1.0.* Introduction Reinstaller allows you to conveninetly backup mod installers to re-run later, without risk of them cluttering up your

Alex Ashmore 2 Jun 27, 2022
ERPNext Easy Letterhead

ERPNext Easy Letterhead Intro Quality letterheads are a problem for non-technical users. So we've built (really hacked together) a slightly easier sol

Bantoo 3 Jan 02, 2023
Скрипт позволяет заводить задачи в Панель мониторинга YouTrack на основе парсинга сайта safe-surf.ru

Скрипт позволяет заводить задачи в Панель мониторинга YouTrack на основе парсинга сайта safe-surf.ru

Bad_karma 3 Feb 12, 2022
A collection of python exercises to help your learning path!

How to use Step 1: run this command git clone https://github.com/TechPenguineer/Python-Exercises.git Step 2: Run this command cd Python-Exercises You

Tech Penguin 5 Aug 05, 2021
All kinds of programs are accepted here, raise a genuine PR, and claim a PR, Make 4 successful PR's and get the Stickers and T-Shirt from hacktoberfest 2021

this repository is excluded from hacktoberfest Hacktoberfest-2021 This repository aims to help code beginners with their first successful pull request

34 Sep 11, 2022
APRS Track Direct is a collection of tools that can be used to run an APRS website

APRS Track Direct APRS Track Direct is a collection of tools that can be used to run an APRS website. You can use data from APRS-IS, CWOP-IS, OGN, HUB

Per Qvarforth 42 Dec 29, 2022
Singularity Containers on Apple M1 (ARM64)

Singularity Containers on Apple M1 (ARM64) This is a repository containing a ready-to-use environment for singularity in arm64 (M1). It has been prepa

Manuel Parra 4 Nov 14, 2022
「📖」Tool created to extract metadata from a domain

Metafind is an OSINT tool created with the aim of automating the search for metadata of a particular domain from the search engine known as Google.

9 Dec 28, 2022
A simple and usefull python calculator.

simplepy-calculator Your simple and fresh calculator. Getting Started Install python3 from the oficial python website or via terminal. Clone this repo

Felix Sanchez 1 Jan 18, 2022
Convert-Decimal-to-Binary-Octal-and-Hexadecimal

Convert-Decimal-to-Binary-Octal-and-Hexadecimal We have a number in a decimal number, and we have to convert it into a binary, octal, and hexadecimal

Maanyu M 2 Oct 08, 2021
vFuzzer is a tool developed for fuzzing buffer overflows, For now, It can be used for fuzzing plain vanilla stack based buffer overflows

vFuzzer vFuzzer is a tool developed for fuzzing buffer overflows, For now, It can be used for fuzzing plain vanilla stack based buffer overflows, The

Vedant Bhalgama 5 Nov 12, 2022