[OBSOLETE] Google Fit Tile

I’ve released a SmartApp that will display your current Google Fit step count and most recent weight as a tile in the SmartThings mobile app. This app also makes the steps count available to other apps that support the Steps Sensor capability. Huge thanks to @mnestor’s GCal-Search app for showing me how to handle Google OAuth2!

You’ll have to install both the SmartApp and the Device Handler from my github repo: GitHub - c99koder/SmartThings: Various projects for Samsung SmartThings home automation system and there are instructions for configuring the OAuth2 login in the README.



This looks awesome!

Now I have to check and see whether my Withings sends my weight over to Google Fit.

It should work, I’m using a Withings Smart Body Analyzer through Google Fit here.

This is so cool…nice job!

I missed something though. I get no steps or weight and I see this in the ST log when I hit the refresh button.

java.lang.NullPointerException: Cannot get property ‘value’ on null object @ line 231

I do see the requests hit the Google API dashboard graph.
Any clue where I might have made the mistake?

I’ve just pushed a fix to github that adds a bit more debug output and should hopefully fix the issue fetching the steps data. Please let me know if you’re still having an issue!

1 Like

That’s what I’m using and it appears to be pushing over.

It works I see steps now!

But I get a different entry in the log:
java.lang.NullPointerException: Cannot invoke method reverse() on null object @ line 296

What shows up for Weight in the app?
Wondering if maybe you get an error if you don’t use the weight features in Google Fit?

1 Like

Well a graph from may 16 to oct 12 shows up in the fit app…apparently I haven’t opened the WeightGurus app to sync with the bluetooth scale for 3 weeks.

The app only requests the last week of weight measurements (annoyingly there’s no API to just get the most recent one, you have to specify a date range). I’ve extended the range to 6 weeks, let me know if you can see the weight now!

1 Like

Thanks Sam,
That last change did it for me, it picked up my weight from the last weight sync 3 weeks ago. I should get a wifi scale instead of a bluetooth one. :wink: No errors in the log.
Really cool app…good job!

I followed the instructions as best as I could but I’m getting “disallowed_useragent” on the app when I try to put in my google credentials. When I created the Oauth key I set it up for web application and specified the redirect URI. I’m running android 7.1 on a nexus 6. I copied and pasted the client ID and secret into the smartapp before publishing it. I also enabled the google fit API in a new project.

Any ideas on what I could be doing wrong? Thanks.

Same here, getting same error.

Looks like Google doesn’t allow logins through the SmartThings app anymore. Samsung would have to update the SmartThings app to use a real browser instead of an embedded web view for oauth logins.

I clicked on more details on the error and it said something about starting
November 2016 or so they would disallow Oath authentication from webview,
or something like that. It said something about steering developers to use
some other type of authentication.

Update: Here is the info about it. This change went into effect after the last post on this thread.


I was able to get this working by changing style to external on line 51 like this on the Smartapp:

href url:redirectUrl, style:“external”, required:true, title:"", description:“Click to enter credentials”

This will make it so it loads in the browser instead of trying to embed it in Smartthings app and works perfect now for me. After I authorized it, I had to close the browser page and go back to the Smartthings app but it connected fine with my Google Fit account.

Is there anyway to add more content like Active minutes, Miles and Calories to this app too?

1 Like

Thanks! That worked for me too.

Thanks! I’ve updated the smartapp on github to use external authentication, glad to hear it’s working again. It should be possible to add calories, though you’ll have to re-authorize the app to add additional permissions. I’ll look into adding more data soon

Thanks! Nice work! Adding more info would be even better.

By the way how often should the info be refreshing? Sometimes I have to manually refresh. Not a big deal. Just asking. Thanks.