Skip to main content

Strava smart home integration, free and open source

Strava integration for Gladys Assistant

Your Strava activities and stats in Gladys: sensors, scene triggers and dashboard widgets.

Bring your Strava activities into Gladys: sensors with your latest activity and your weekly, monthly and yearly distances, scene triggers when you finish an activity or beat a personal record, and two dashboard widgets.

Requires Gladys 5.1 or later and a Strava account (a free account is enough).

1. Create your Strava API application​

Strava gives each user their own API application: the integration uses yours, so your data only travels between Strava and your Gladys.

  1. Sign in on strava.com and open Settings → My API Application.
  2. Fill in the form:
    • Application Name: for example Gladys;
    • Category: Other;
    • Website: the address of your Gladys, or https://gladysassistant.com;
    • Authorization Callback Domain: the host name you type in your browser to open Gladys, without http://, port or path — for example 192.168.1.20 or gladys.local. If you open Gladys through Gladys Plus, use the host name of that address instead. localhost is always accepted by Strava.
  3. Upload any icon if Strava asks for one, then save.
  4. Keep the page open: you need the Client ID and the Client Secret.

2. Configure the integration​

  1. In Gladys, open Integrations → Strava → Configuration.
  2. Paste the Client ID and the Client Secret, then save.
  3. Click Connect next to "Strava account": Strava asks you to authorize the application. Keep every permission ticked (the private activities one too, or your private activities are left out), then confirm.
  4. Back in Gladys, the status turns to "connected" and a Strava device appears in the Discovery tab: add it to get its sensors.

Options:

  • Units: metric (km, m, km/h) or imperial (mi, ft, mph). Changing it updates the device definition: accept the update offered in the Discovery tab.
  • Refresh interval: how often Strava is read, every 15 minutes by default (5 minutes minimum, Strava limits the number of requests).
  • Weekly distance goal: all sports together, in km (or miles). Used by the "Strava weekly goal reached" trigger and the dashboard widget; 0 disables it.

3. Instant notifications with Gladys Plus (optional)​

Without Gladys Plus, a new activity shows up at the next refresh. With Gladys Plus, paste your Gladys Plus Open API key in the "Gladys Plus webhooks" block of the Configuration screen: the integration then registers a Strava webhook, and Strava announces each new activity within seconds.

Strava allows one webhook per API application: use a dedicated application for each Gladys.

The Strava device​

SensorUnit
Last activity (name) / sporttext
Last activity distancekm or mi
Last activity moving timeminutes
Last activity elevation gainm or ft
Last activity average speedkm/h or mph
Distance / moving time this weekkm or mi / minutes
Run, ride, swim distances, last 4 weekskm or mi
Run, ride, swim distances this yearkm or mi

The week starts on Monday, in the time zone of your latest activity. The 4 weeks and year totals are Strava's own: they only count run, ride and swim activities, and only the activities visible to everyone.

Scenes​

The integration adds its own cards to the scene editor, under the Integrations category.

Triggers:

  • New Strava activity — an activity was recorded or uploaded. Optionally filter on the sport (run, ride, swim, walk or hike, other). The following actions can use {{triggerEvent.data.name}}, sport, sport_type, distance, distance_unit, moving_time (minutes), elevation_gain, average_speed, pr_count, activity_id and url.
  • Strava personal record — a new activity beat at least one of your records (name, sport, pr_count, url...).
  • Strava weekly goal reached — the distance of the week reached your goal, once a week (week_distance, goal, week_activities).

Each activity is announced once, even after a restart; the activities that existed before the account was linked are not announced.

Actions:

  • Synchronize Strava — reads Strava now; returns new_activities.
  • Get Strava statistics — distance, moving time, elevation gain and count of a period (this week, last 4 weeks, this year, all time) for one sport or all, to use in a message: "{{...distance}} {{...distance_unit}} this week!".
  • Get the last Strava activity — name, sport, distance, time and link of your latest activity.

Every action also returns linked: false when no account is linked, so a scene can check it instead of failing.

Example: "When a new run is recorded, send me a Telegram message with its distance, and flash the living room light if it was a personal record".

Dashboard​

  • Strava this week: distance, moving time, number of activities and elevation of the week, a 7-day distance chart, your weekly goal, the last activity and your yearly run and ride distances. Sync now refreshes right away, Open Strava opens your profile.
  • Strava activities: your latest activities (3, 5 or 8, optionally one sport only); tap one for the details and a link to Strava.

Actions of the Configuration screen​

  • Test the connection — reads Strava and shows who is connected and the activities of the week.
  • Synchronize now — refreshes everything right away.
  • Unlink the Strava account — revokes the access on Strava and forgets the tokens. Click Connect to link an account again.

Troubleshooting​

  • "redirect_uri invalid" on the Strava page: the Authorization Callback Domain of your Strava application does not match the address you use to open Gladys. Set it to that host name (step 1).
  • The status says Strava refused the access: the access was revoked on strava.com or the application changed. Click Connect again.
  • The badge of the device shows an orange dot: the Strava request limit was reached; the next refresh catches up. Increase the refresh interval if it happens often.
  • Check the integration logs from the Gladys UI (or docker logs on the host); start the container with LOG_LEVEL=debug for the full detail.

You can revoke the access of the integration at any time from strava.com/settings/apps.

Strava is a trademark of Strava, Inc. This integration is not affiliated with Strava.

Configuration settings​

These are the settings Strava asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Create your Strava API applicationsectionNoOn strava.com, open Settings > My API Application and create an application. As "Authorization Callback Domain", enter the host name you use to reach Gladys ({{gladys_host}}). Then copy its Client ID and Client Secret below, save, and click Connect.
Client IDstringYes
Client SecretsecretYes
Strava accountoauth2NoSave the Client ID and Client Secret first, then link your Strava account. Keep every permission ticked on the Strava page.
PreferencessectionNoOptional: with Gladys Plus, paste your Open API key in the "Gladys Plus webhooks" block to get your new activities within seconds instead of at the next refresh.
UnitsselectNo
Refresh interval (min)numberNoHow often Strava is read, in minutes (5 to 240).
Weekly distance goalnumberNoIn km (or miles in imperial units), all sports together. 0 disables the goal.

How to install Strava in Gladys​

  1. In Gladys, open Integrations: Strava appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/quentinlegay/gladys-strava:1.0.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/quentinlegay/gladys-strava.

Strava requires Gladys >=5.1.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

Strava is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by quentinlegay, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂