Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heart Sensor / Sleep Sensor #24

Open
freitas666 opened this issue May 13, 2022 · 18 comments
Open

Heart Sensor / Sleep Sensor #24

freitas666 opened this issue May 13, 2022 · 18 comments

Comments

@freitas666
Copy link

Hello @cyberjunky and friends...

First I would like to say thanks for this amazing work....

Now I will say my problem... actually I am trying do this both sensors work in my home asssistant, but I really not know more what I should to do... I have date from others sensors, less Heart and Sleep...
Could you help me?

Thank you, any suggest will be welcome!

@martinrevert
Copy link

+1

@freitas666
Copy link
Author

Looks like this repo not have any more updates...

@cyberjunky
Copy link
Owner

I cannot help with this easily since I do not have sleep or heart sensors myself connected to Google Fit.
Which kind of sensors/data input do you have? Google Watch? Something else?

@freitas666
Copy link
Author

Hello @cyberjunky actually i got this sensors:

CEA09EB7-E354-4450-B8CA-4AA0015E3F35

@cyberjunky
Copy link
Owner

I mean physical sensors on your phone, watch, whatever to get data in the HA sensors.. Do you see your heartrate in the Google Fit app?

@freitas666
Copy link
Author

Yes in the apps including google fit i see my heartrate and sleep time!

@cyberjunky
Copy link
Owner

With which physical sensors do you measure them?

@ShurikenGitHub
Copy link

ShurikenGitHub commented May 26, 2022

I use the "Sleep as android" app to measure sleep in google fit, very easy, no extra hardware required.
The sleep is also unknown for me with the integration, but in the google fit app it is available.

@freitas666
Copy link
Author

I use the "Sleep as android" app to measure sleep in google fit, very easy, no extra hardware required.

The sleep is also unknown for me with the integration, but in the google fit app it is available.

My smartwatch send the information correct to google fit..
I dont have problems with "google fit" date...
But with integration with Home Assistant using hacs google fit addon..

@martinrevert
Copy link

martinrevert commented Jun 3, 2022

@cyberjunky Hi Ron, i believe it has to do with the scopes.

Heart Rate and Sleep need separate scopes for security reasons. Google considers reading that data is "Restricted".

scopes

Sorry that I don't have a proper HASS dev environment to test it and send you a pull request, but your Google authorization scopes looks like this:

SCOPES = ['https://www.googleapis.com/auth/fitness.body.read', 'https://www.googleapis.com/auth/fitness.body.write', 'https://www.googleapis.com/auth/fitness.activity.read', 'https://www.googleapis.com/auth/fitness.location.read']

I think that adding the proper scopes this will work for me and the rest of the guys:

SCOPES = ['https://www.googleapis.com/auth/fitness.body.read', 'https://www.googleapis.com/auth/fitness.body.write', 'https://www.googleapis.com/auth/fitness.activity.read', 'https://www.googleapis.com/auth/fitness.location.read', 'https://www.googleapis.com/auth/fitness.sleep.read', 'https://www.googleapis.com/auth/fitness.heart_rate.read', ]

Also, I'm not so sure the "fitness.body.write" scope is needed for this plugin that is just a read info addon.

Don't bother if you can't test it yourself, we can do it for you and report.

Thanks!

@freitas666
Copy link
Author

freitas666 commented Jun 5, 2022 via email

@martinrevert
Copy link

martinrevert commented Jun 5, 2022

Hello, This new scopes work? If you want i can test :)

I believe they must work, my guess is based on the fact that I've been hit by the same issue over an Android app I've been developing. So probably, we can give it a try. If @cyberjunky push a new version, we can commit to bring back the results here.

@cyberjunky
Copy link
Owner

Can you try version 1.0.7?
I added the scopes and it kept working, i have no heart/sleep data to test with.

@ScottG489
Copy link

FYI, via the Fit app you can measure your heart rate using your phones camera. I just tried it after updating to the latest version of this integration and it's still showing as "Unknown". Perhaps not enough time has passed yet.

@lichenophile
Copy link

I have tried 1.0.7 both with data synced to gfit and with a manual entry in gfit itself, HA still reporting 'unknown'.

Interestingly, I don't have an option for camera HR in gfit, so manually inputted an entry.

Sleep As Android is syncing sleep data to gfit but also doesn't populate to HA, though instead of the sensor state state being 'unknown' like HR, it always comes back completely blank. Perhaps each of these scopes has a separate issue?

@cyberjunky
Copy link
Owner

I have dug into it, and the call for sleep data is empty in the code, the integration is using the old Google Api calls, will have a look into the new Dataset calls

@freitas666
Copy link
Author

freitas666 commented Oct 11, 2022 via email

@freitas666
Copy link
Author

freitas666 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants