Strava Home Assistant Integration

Hi folks! I love bikes and I love Smart Home tinkering……why not combine the best of both worlds? I’ve recently started building a Strava Home Assistant Integration and I’d love to hear your thoughts: https://github.com/codingcyclist/ha_strava

I made an effort to avoid many of the common problems with the Strava API (authentication- and rate-limit issues in particular). All you need to get started with the Integration is a Strava account and the underlying API credentials (Client ID + Client Secret). Under the hood, the Integration uses Webhooks to keep data updates at a minimum.

As of now, the integration can only pull and display data about the ten most recent activities on Strava. Down the line, it’d be great to add picture-, summary stats-, and other cool features, but it’s unclear yet when I’ll find the time to do that.

Please reach out with feedback and/or if you would like to contribute.

10 Likes

That’s very cool, thank you. Saves me from updating my own klutzy python script :slight_smile:

Isit just me or is the STRAVA integration not listed under configuration / Integrations as per installation tutorial ?

Make sure that you add the GitHub repo to your HACS custom repositories, then you’ll be able to download the custom component through HACS and ultimately install it on your Home Assistant instance. I’ve made a Tutorial which explains the whole process - check it out: https://www.youtube.com/watch?v=xpqUe-TkO70&lc=UgwAalS178HlrRH07VR4AaABAg

Thank you kindly! all resolved!

@codingcyclist Great work! Is there any way to add the ability to add multiple accounts?

Thanks for putting this together @codingcyclist.

I’m stuck at adding the Strava Home Assistant Integration to my Home Assistant Installation. I was able to install via HACS, not problem. When I go to install into HA installation, I click on the now available Strava Home Assistant integration then the spinny wheels shows as if it is installing, but seems to time out and goes back to the list of integrations to choose from.

Nothing shows up in my logs files.

I’m wondering if the Website and/or Authorization Callback Domain that I put in Strava API application have anything to do with this yet at this point? It was unclear to me if I put the same external URL links in Strava for both Website and Authorization Callback Domain? I use Nabu Casa. Strava would not let me use forward slashes in the URL. For Spotify integration I had to use my external url + /auth/external/callback. So I’m not sure what exactly I should be putting into Strava. If done correctly, no idea why it wouldn’t install in HASS.

I would appreciate any suggestions please, thank you.

Hi @FRIARTUCK11,

mh, it is indeed surprising that there is nothing in the log files, but let’s start trouble-shooting with the authentication callback domain which you put into Strava. If that doesn’t solve the issue, we can still investigate further.

As the name suggest, the authentication callback DOMAIN is different from the authentication callback URL. In fact, the domain is a particular fraction of the URL. It’s anything between the http:// (or https://) and the first “/” of the path in your URL. E.g. if you entire authentication callback URL is https://xyz.ui.nabu.casa/auth/external/callback, the the callback domain (which you have to put into Strava) is “xyz.ui.nabu.casa”

I hope that helps,

cheers

Unfortunately not :-/ The integration can only authenticate with a single strava account

I’ve checked my External URL and Domain. Everything appears correct. I’ve restarted and rebooted. Still get the issues.
I did find this in my Log files while trying and redoing everything:
2020-12-30 16:34:50 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for ha_strava which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

One other thing I found when messing around. On the Strava My API Application page, at the bottom there is a link OAuth Authorization Page. When I click this link, it auto populates a URL with my authentication callback Domain included and has a button to Authorize. When I click that button, it doesn’t work. It appears to timeout like HA does. So when I looked at the auto generated URL that has my callback Domain I noticed it started with “http://” whereas my external URL starts with “https://”. I just updated the URL by added that “s” and hit enter. Then I was able to click Activate, and it appeared to work and forwarded to my HA. My HA now shows up on the list of approved apps in Strava. I thought that may have fixed the issue, but when I went back into HA to add the integration, I still got the infinite load… sigh. I was bummed lol.

Hi @codingcyclist, thanks for sharing your work !
I have the same problem than some other people here. I just discovered your integration but can’t succeed to install it due to infinite loop when adding in the integration panel. I followed all your steps and details (HA external URL, strava API with both URL and callback domain) but still stuck here.

1 Like

Hi,
Just found this integration and am very interested to try it out! However, I fail to install it, allready at the second point in the instruction… I cannot find the “My API Application” section at my Strava profile setting page! Can anyone point me in the direction as where to find it!
Any help is appreciated!

Answer to myself.
Needed to allow under Data Permissions, then I could go to the small item “Development” in the webpage footer and register a new project… The I got the My API Application…

Hi, thank you for sharing!
I tried all the installation process, the api creation, and all went fine. Right at the time I install the integration in HA, I fill in the Client ID and Client Secret fields, and it results in this page:
{“message”:“Bad Request”,“errors”:[{“resource”:“Application”,“field”:“redirect_uri”,“code”:“invalid”}]}

Can you help? What’s the problem?

Thank you!

After installing in HACS and restarting HA, I cannot find the Strava integration!
Any Idea what I can have made wrong?
I have installed and removed several times and different versions of the Strava Integration in HACS, but no difference!

If I can help… I hit the + Add integration button in the right bottom corner of the integration page, then wrote Strava, and I found it, so I could install it. But still it doesn’t work, sadly…

That is what I am trying! But after installing in HACS, I can still not find the Strava integration when hitting the “+” sign… (I am confused, since I have 15 integrations since earlier, and they all work as expected!)

Ah ok, seems all you’ve done it’s right. Sorry. I noticed that you managed to install and use the integration. I’m stuck with the id and secret client codes… Once I put them, the resulted web page doesn’t work. In the strava Api web page, in the callback domain field, I’ve added my domain in this format name.domain.net:port, it is correct? What am I doing wrong?

No problem! :slight_smile:

:slight_smile: Ok, maybe I was to impatient…
After a while, I can now see and install the Strava integration…

1 Like