homeassistant-peloton-sensor
homeassistant-peloton-sensor copied to clipboard
Minor changes to the Example Template Card YAML
@edwork - I've noticed that the Example Template Card has not been displaying properly, and while I recognize that it is for example purposes only, thought I'd offer an update to correct some issues I've come across. Additionally, the Latest Workout Metrics will only display if the last workout session occurred on the bike.
{% if is_state('sensor.peloton_username', 'Active') %}
### Current Metrics:
<font color="firebrick"><ha-icon icon="mdi:heart-pulse"></ha-icon></font> **Heart Rate (bpm):** {{ state_attr('sensor.peloton_username', "Heart Rate Bpm") }}
<font color="darkorange"><ha-icon icon="mdi:omega"></ha-icon></font> **Resistance (%):** {{ state_attr('sensor.peloton_username', "Resistance %") }}
<font color="darkorchid"><ha-icon icon="mdi:speedometer"></ha-icon></font> **Speed (Mph):** {{ state_attr('sensor.peloton_username', "Speed Mph") }}
<font color="darkorchid"><ha-icon icon="mdi:speedometer"></ha-icon></font> **Speed (Kph):** {{ state_attr('sensor.peloton_username', "Speed Kph") }}
<font color="mediumseagreen"><ha-icon icon="mdi:sine-wave"></ha-icon></font> **Cadence Rpm:** {{ state_attr('sensor.peloton_username', "Cadence Rpm") }}
<font color="orangered"><ha-icon icon="mdi:lightning-bolt"></ha-icon></font> **Power (W):** {{ state_attr('sensor.peloton_username', "Power W") }}
---
{%- endif %}
### Latest Workout Summary:
<ha-icon icon="mdi:calendar-range"></ha-icon> - **Date:** {{ as_timestamp(state_attr('sensor.peloton_username', "Start Time"))|float|timestamp_custom('%Y/%m/%d » %H:%M') }} - {{ as_timestamp(state_attr('sensor.peloton_username', "End Time"))|float|timestamp_custom('%H:%M') }} ({{ state_attr('sensor.peloton_username', "Duration Min") }} mins)
{% if state_attr('sensor.peloton_username', 'Workout Image') != 'None' %}
<img src="{{ state_attr('sensor.peloton_username', "Workout Image") }}">
{% endif %}
**{{ state_attr('sensor.peloton_username', "Ride Title") }} ({{ state_attr('sensor.peloton_username', "Workout Type") }})**
- *{{ state_attr('sensor.peloton_username', "Description") }}*
- Instructor: {{ state_attr('sensor.peloton_username', "Instructor") }}
{% if is_state_attr('sensor.peloton_username', 'Workout Type','cycling') %}
---
### Latest Workout Metrics:
<font color="royalblue"><ha-icon icon="mdi:map-marker-distance"></ha-icon></font> - **Distance (Mi):** {{ state_attr('sensor.peloton_username', "Distance Mi") | float | round(2) }}
<font color="firebrick"><ha-icon icon="mdi:heart-pulse"></ha-icon></font> - **Heart Rate (bpm):** {{ state_attr('sensor.peloton_username', "Heart Rate Average Bpm") | float | round(0) }} avg / {{ state_attr('sensor.peloton_username', "Heart Rate Max Bpm") | float | round(0) }} max
<font color="darkorange"><ha-icon icon="mdi:omega"></ha-icon></font> - **Resistance:** {{ state_attr('sensor.peloton_username', "Resistance Average %") | float | round(0) }}% avg / {{ state_attr('sensor.peloton_username', "Resistance Max %") | float | round(0) }}% max
<font color="darkorchid"><ha-icon icon="mdi:speedometer"></ha-icon></font> - **Speed (Mph):** {{ state_attr('sensor.peloton_username', "Speed Average Mph") | float | round(2) }} avg / {{ state_attr('sensor.peloton_username', "Speed Max Mph") | float | round(2) }} max
<font color="darkorchid"><ha-icon icon="mdi:speedometer"></ha-icon></font> - **Speed (Kph):** {{ state_attr('sensor.peloton_username', "Speed Average Kph") | float | round(2) }} avg / {{ state_attr('sensor.peloton_username', "Speed Max Kph") | float | round(2) }} max
<font color="mediumseagreen"><ha-icon icon="mdi:sine-wave"></ha-icon></font> - **Cadence (Rpm):** {{ state_attr('sensor.peloton_username', "Cadence Average Rpm") | float | round(0) }} avg / {{ state_attr('sensor.peloton_username', "Cadence Max Rpm") | float | round(0) }} max
<font color="orangered"><ha-icon icon="mdi:lightning-bolt"></ha-icon></font> - **Power (W):** {{ state_attr('sensor.peloton_username', "Power Average W") | float | round(2) }} avg / {{ state_attr('sensor.peloton_username', "Power Max W") | float | round(2) }} max
<font color="orangered"><ha-icon icon="mdi:lightning-bolt"></ha-icon></font> - **Total Work:** {{ state_attr('sensor.peloton_username', "Total Work") | float | round(0) }} J
<font color="orangered"><ha-icon icon="mdi:lightning-bolt"></ha-icon></font> - **Output (KJ):** {{ state_attr('sensor.peloton_username', "Output Kj") | float | round(2) }}
<font color="crimson"><ha-icon icon="mdi:food"></ha-icon></font> - **Calories (KCal):** {{ state_attr('sensor.peloton_username', "Calories KCal") }}
<font color="yellowgreen"><ha-icon icon="mdi:chevron-triple-up"></ha-icon></font> - **Leaderboard Rank:** {{ state_attr('sensor.peloton_username', "Leaderboard Rank") }} / {{ state_attr('sensor.peloton_username', "Leaderboard Users") }} ({{ 100 - (100 * (state_attr('sensor.peloton_username', "Leaderboard Rank") | int ) / (state_attr('sensor.peloton_username', "Leaderboard Users") | int)) | round(0) }}%)
{% endif %}
Hello,
Thanks for reporting both of these issues. There are some big upgrades to the integration in the works, and we should have a new version pushed out by the end of the weekend hopefully. Part of this is breaking out the previous attributes into their own sensors as that's the method HomeAssistant would like integrations to use.
I'll take a look at this shortly and make sure this is resolved. At first the integration was very purpose built for cycling only but I would like to make sure it works for all types of workouts.
- Ed