¿Te gustaría tener un registro completo de tus actividades físicas directamente en tu sistema de domótica?
En este video, te muestro paso a paso cómo integrar Strava y Google Fit en Home Assistant.
Con esta integración, podrás ver tus estadísticas de entrenamiento (como pasos, calorías y tiempo activo) directamente en tu panel de control inteligente. Ideal para quienes buscan mejorar su salud y automatizar su hogar. ¡Mira cómo convertir tu hogar en un centro de control de fitness inteligente!
Contenido del video:
- Configuración de Strava y Google Fit en Home Assistant
- Visualización de tus datos de fitness en tarjetas personalizadas
- Consejos para aprovechar al máximo esta integración
Requisitos: Cuenta de Strava y Google Fit, Home Assistant con acceso a internet.
Las URL que se han mencionado a lo largo del vídeo son las siguientes:
- Credenciales de Google – Aplicación Web: https://my.home-assistant.io/redirect/oauth
- API de Strava: https://www.strava.com/settings/api
- Dominio de devolución de llamada de autorización: my.home-assistant.io
- Repositorio personalizado de Strava: https://github.com/craibo/ha_strava
- Aguacatec: https://aguacatec.es/
A continuación te muestro el código de la tarjeta para mostrar información sobre las actividades deportivas, pero recuerda que tienes que instalar las integraciones siguientes (también desde HACS):
- Card Mod
- Bubble Card
- Stack in Card
- Mushroom Card
type: vertical-stack
cards:
- type: grid
columns: 2
cards:
- type: entities
card_mod:
style: |
ha-card {
background: linear-gradient(to left, rgba(45,45,26,1), rgba(30,44,45,1)), url('local/ciclista.jpg');
background-position: center;
background-size: cover;
--primary-text-color: white;
font-size: 11px;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
font-weight: bold;
}
.card-header {
font-size: 14px; # Ajusta el tamaño del título
color: white; # Si quieres cambiar el color
text-shadow: 1px 1px #0005;
font-weight: bold;
}
title: Últimas 4 semanas
entities:
- entity: sensor.strava_stats_summary_recent_ride_distance
name: Distancia
icon_color: lime
icon: mdi:map-marker-distance
- entity: sensor.strava_stats_summary_recent_ride_moving_time
name: Tiempo
icon: mdi:timer-outline
- entity: sensor.strava_stats_summary_recent_ride_activity_count
name: Número
icon: mdi:bike
- type: entities
card_mod:
style: |
ha-card {
background: linear-gradient(to left, rgba(45,45,26,1), rgba(30,44,45,1)), url('local/ciclista.jpg');
background-position: center;
background-size: cover;
--primary-text-color: white;
font-size: 11px;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
font-weight: bold;
}
.card-header {
font-size: 14px; # Ajusta el tamaño del título
color: white; # Si quieres cambiar el color
text-shadow: 1px 1px #0005;
font-weight: bold;
}
title: Este año
entities:
- entity: sensor.strava_stats_summary_ytd_ride_distance
name: Distancia
icon: mdi:map-marker-distance
- entity: sensor.strava_stats_summary_ytd_ride_moving_time
name: Tiempo
icon: mdi:timer-outline
- entity: sensor.strava_stats_summary_ytd_ride_activity_count
name: Número
icon: mdi:bike
- type: custom:bubble-card
card_type: separator
icon: mdi:timeline-text
name: Últimas sesiones
card_mod:
style: |
ha-card {
margin-top: -5px;
margin-left: 4px;
}
- type: custom:stack-in-card
card_mod:
style: |
ha-card {
background: linear-gradient(to left, rgba(45,45,26,1), rgba(30,44,45,1)), url('local/ciclista.jpg');
background-position: center;
background-size: cover;
}
cards:
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:map-marker
content: '{{ state_attr(''sensor.strava_0_0'', ''friendly_name'') }}'
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
margin-top: -10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:calendar
content: |
{{ states('sensor.strava_0_0')[:10] }}
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
margin-top: -10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:clock
content: |
{{ states('sensor.strava_0_0')[-8:][:5] }}
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -87px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_0_3
tap_action:
action: none
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
--primary-text-color:
{% if states('sensor.strava_0_3') > states('sensor.strava_1_3') %}
lime
{% else %}
red
{% endif %}
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -62px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_0_4
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
--primary-text-color:
{% if states('sensor.strava_0_4') > states('sensor.strava_1_4') %}
lime
{% else %}
red
{% endif %}
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -37px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_0_1
tap_action:
action: none
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-template-card
picture: |
{{ states('camera.strava_activity_0_photos') }}
card_mod:
style: |
ha-card {
border: 0px;
--icon-size: 150px;
margin-left: 225px;
margin-bottom: -20px;
margin-top: -150px;
}
- type: custom:stack-in-card
card_mod:
style: |
ha-card {
background: linear-gradient(to left, rgba(45,45,26,1), rgba(30,44,45,1)), url('local/ciclista.jpg');
background-position: center;
background-size: cover;
}
cards:
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:map-marker
content: '{{ state_attr(''sensor.strava_1_0'', ''friendly_name'') }}'
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
margin-top: -10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:calendar
content: |
{{ states('sensor.strava_1_0')[:10] }}
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
margin-top: -10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:clock
content: |
{{ states('sensor.strava_1_0')[-8:][:5] }}
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -87px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_1_3
tap_action:
action: none
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
--primary-text-color:
{% if states('sensor.strava_1_3') > states('sensor.strava_2_3') %}
lime
{% else %}
red
{% endif %}
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -62px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_1_4
tap_action:
action: none
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
--primary-text-color:
{% if states('sensor.strava_1_4') > states('sensor.strava_2_4') %}
lime
{% else %}
red
{% endif %}
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -37px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_1_1
tap_action:
action: none
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-template-card
picture: |
{{ states('camera.strava_activity_1_photos') }}
card_mod:
style: |
ha-card {
border: 0px;
--icon-size: 150px;
margin-left: 225px;
margin-bottom: -20px;
margin-top: -150px;
}
- type: custom:bubble-card
hash: '#ciclismo_Manolo'
name: Ciclismo de montaña
icon: mdi:run-fast
- type: custom:stack-in-card
card_mod:
style: |
ha-card {
background: linear-gradient(to left, rgba(45,45,26,1), rgba(30,44,45,1)), url('local/ciclista.jpg');
background-position: center;
background-size: cover;
}
cards:
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:map-marker
content: '{{ state_attr(''sensor.strava_2_0'', ''friendly_name'') }}'
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
margin-top: -10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:calendar
content: |
{{ states('sensor.strava_2_0')[:10] }}
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-left: 10px;
margin-top: -10px;
--primary-text-color: white;
}
chips:
- type: template
tap_action:
action: none
icon: mdi:clock
content: |
{{ states('sensor.strava_2_0')[-8:][:5] }}
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -87px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_2_3
tap_action:
action: none
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
--primary-text-color:
{% if states('sensor.strava_2_3') > states('sensor.strava_3_3') %}
lime
{% else %}
red
{% endif %}
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -62px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_2_4
tap_action:
action: none
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
--primary-text-color:
{% if states('sensor.strava_2_4') > states('sensor.strava_3_4') %}
lime
{% else %}
red
{% endif %}
}
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
margin-top: -37px;
margin-left: 120px;
--primary-text-color: white;
}
chips:
- type: entity
entity: sensor.strava_2_1
tap_action:
action: none
card_mod:
style: |
ha-card {
background: transparent!important;
box-shadow: none!important;
border: 0px;
height: 30px;
text-shadow: 1px 1px #0005;
}
- type: custom:mushroom-template-card
picture: |
{{ states('camera.strava_activity_2_photos') }}
card_mod:
style: |
ha-card {
border: 0px;
--icon-size: 150px;
margin-left: 225px;
margin-bottom: -20px;
margin-top: -150px;
}
- type: custom:apexcharts-card
graph_span: 28d
header:
title: Evolución del Peso
show: true
show_states: true
series:
- entity: sensor.weight
name: Peso
color: '#3498db'
type: line
stroke_width: 3
show:
legend_value: true
fill_raw: last
yaxis:
- min: 74
max: 92
decimals: 1
chart_type: line
apex_config:
chart:
background: rgba(38,45,35,1)
foreColor: '#ffffff'
toolbar:
show: false
grid:
borderColor: '#444444'
xaxis:
type: datetime
labels:
show: true
format: dd MMM
style:
colors: '#ffffff'
axisBorder:
show: false
yaxis:
labels:
style:
colors: '#7f8c8d'
stroke:
curve: smoothCódigo de la automatización:
alias: Strava - reconfigura y recarga cada 12 horas
description: ""
trigger:
- platform: time_pattern
hours: /12
- platform: homeassistant
event: start
condition: []
action:
- event: strava_config_update
event_data: {}
- event: ha_strava_reload
event_data: {}
mode: single

