Zum Hauptinhalt springen

Strava Smart-Home-Integration, kostenlos und Open Source

Strava-Integration für Gladys Assistant

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

Info

Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.

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.

Konfigurationseinstellungen​

Diese Einstellungen fragt Strava in seinem Konfigurationsbildschirm in Gladys ab.

EinstellungTypPflichtfeldBeschreibung
Create your Strava API applicationsectionNeinOn 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 IDstringJa
Client SecretsecretJa
Strava accountoauth2NeinSave the Client ID and Client Secret first, then link your Strava account. Keep every permission ticked on the Strava page.
PreferencessectionNeinOptional: 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.
UnitsselectNein
Refresh interval (min)numberNeinHow often Strava is read, in minutes (5 to 240).
Weekly distance goalnumberNeinIn km (or miles in imperial units), all sports together. 0 disables the goal.

So installierst du Strava in Gladys​

  1. Öffne in Gladys Integrationen: Strava erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
  2. Klicke auf Installieren. Gladys lädt das Docker-Image (ghcr.io/quentinlegay/gladys-strava:1.0.1) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration).
  3. Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
  4. Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/quentinlegay/gladys-strava.

Strava benötigt Gladys >=5.1.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.

Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.

Über externe Integrationen​

Strava ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von quentinlegay veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.

Abonniere den Newsletter von Gladys Assistant

Ein paar E-Mails im Monat zu neuen Releases und Neuigkeiten aus dem Projekt. Verschickt von Pierre-Gilles Leymarie, dem Gründer des Projekts. Jederzeit abbestellbar 🙂