Strava Home Assistant Integration

Hi!

I am trying to switch to your integration as the old one is no more working but I am facing an issue when trying to set it up.
After entering my credentials, a page asking for authorization is opened, I am granting access as I should.
Then, a new page is opened, asking to link my account to HA:
image

Then, after clicking on link account, I am back to HA and have the following error message but unfortunately, there is no details about the reason why there is an error:
image

Any idea on what could be the reason?

Authorization Callback Domain is set to my.home-assistant.io as recommended so…

Thanks i advance!

Regards

Hey @nckslater

The integration currently uses the strava stats endpoint to pull the summary data.

I’ve updated the integration (verison 2.0.1) to now also include entities for the recent stats (last 24 weeks) which are available in the API.

Adding the stats for a week will be a little harder but should be do-able hopefully using another API that allows filtering by a date range. I’ll take a look when I have some free time.

Hi @Antoine1

I have not come across that screen before but it doesn’t look like one from the Strava integration.

Can you confirm you followed this process?
The order of the steps is important

  1. Removed the Strava integration from Home Assistant → Integrations section
  2. Removed the old repository from the HACS → Integrations → Custom Repositories configuration
  3. Restarted your home assitant ← this step is important
  4. Added the https://github.com/craibo/ha_strava custom repository
  5. Installed the integration from HACS
  6. Restarted your home assistant
  7. Add the Strava integration from Home Assistant → Integations

Hi,

Thanks for taking this in account.

I have been able to fix the issue by juggling between my mobine phone in 5G and the laptop in Wifi…
I do not know if this is due to link HA / Strava or due to my own network setup…

Are there any cards where I can input my monthly distance goal, say 400 miles, and have a countdown or graph showing how much left to go?

Hi, love the integration. I’m just straying to build up a health and fitness dashboard and when building in info from the Strava integration I’ve realised that the photo it pulls is one you might take with your camera and attach to the strava post.

This is not something I ever really do, but I was wondering if it might be possible to also grab the map picture? This would be much nor valuable to me.

Thanks again, love your work.

1 Like

I made a simple multi-entity card to show my last 5 Rides, I just thought I would share.
It uses this card: GitHub - benct/lovelace-multiple-entity-row: Show multiple entity states and attributes on entity rows in Home Assistant's Lovelace UI

type: entities
title: Last 5 Bike Rides
entities:
  - entity:  sensor.strava_0_0
    type: custom:multiple-entity-row
    name: Ride 1
    show_state: false
    entities:
      - attribute: title
        name: false
      - entity: sensor.strava_0_3
        name: false
  - entity:  sensor.strava_1_0
    type: custom:multiple-entity-row
    name: Ride 1    
    show_state: false
    entities:
      - attribute: title
        name: false
      - entity: sensor.strava_1_3
        name: false
  - entity:  sensor.strava_1_0
    type: custom:multiple-entity-row
    name: Ride 3
    show_state: false
    entities:
      - attribute: title
        name: false
      - entity: sensor.strava_2_3
        name: false
  - entity:  sensor.strava_2_0
    type: custom:multiple-entity-row
    name: Ride 4
    show_state: false
    entities:
      - attribute: title
        name: false
      - entity: sensor.strava_3_3
        name: false
  - entity:  sensor.strava_4_0
    type: custom:multiple-entity-row
    name: Ride 5
    show_state: false
    entities:
      - attribute: title
        name: false
      - entity: sensor.strava_4_3
        name: false

image

1 Like

I have the integration up and running. When setting up Strava, the connection is made and entities get the correct values. However, after each HA restart, all entities show unavilable. When removing the integration and reinstalling/reconfiguring it again it works again until the next HA restart. Anyone else who has experienced this and if so how to resolve? I am running the latest version of HA and the strava integration.

Looking forward to getting this working my seem to be getting stuck

Have added my.home-assistant.io as my Authorisation callback Domain

when I add the integration in HA , putting in Client ID and then Client Secret. I click on ‘Next’ and get to

I authorise and then it goes to:

and that’s it - nothing further

Can someone kindly advise what I am missing - thanks!

I’m having an issue whereby all sensors are unavailable, when I first set the integration up, all was well, and the sensors mirrored strava info, however, having done a few activities since set up I noticed that the sensors were not updating, so I tried to reload the integration, still nothing. I then restarted HAS and all sensors became unavailable. After that I tried to remove the integration, remove access within strava and set it all up again. No matter how many times I try this, the sensors are all unavailable despite successful install. Any ideas?

EDIT:

Further to this, I realise that it’s trying to connect to an old domain I used to use for my external access (redacted in code below).

I don’t know how to resolve that!

Traceback (most recent call last):
  File "/config/custom_components/ha_strava/__init__.py", line 781, in strava_startup_functions
    await renew_webhook_subscription(
  File "/config/custom_components/ha_strava/__init__.py", line 630, in renew_webhook_subscription
    callback_response = await websession.get(url=config_data[CONF_CALLBACK_URL])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 574, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 911, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1187, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host XXXXX.ml:443 ssl:default [Name does not resolve]

FURTHER EDIT: Solved this myself, it seems that at some point I’d commented out the external_url in my config file and although I’d since changed the value of it in the secrets.yaml it obviously never got propagated through, although why the reference to the original domain was still hanging round, I don’t know.

Hi
Everything works fine with this integration (thanks a lot !) but I have this error in logs on ha startup :

Unexpected response (status code: 400) while creating Strava Webhook Subscription: {"message":"Bad Request","errors":[{"resource":"PushSubscription","field":"callback url","code":"GET to callback URL does not return 200"}]}

Does anyone know how to fix this ?
Thanks

Is there a way to get this to refresh the last activity without restarting home assistant?

what about if you run and swim aswell.