Ed,
Great work. I recently installed the release and got everything up and running. I made the following automation based on the heartbeat. The automation changes my gym’s RGB Wi-Fi lights to reflect which heart rate zone I’m in as I work out.
Created a sensor for my current heartbeat.
sensor.yaml:
- platform: template
sensors:
peloton_bpm:
icon_template: mdi:heart-pulse
friendly_name: "Peloton BPM"
unit_of_measurement: BPM
value_template: >
{{ state_attr('sensor.peloton_username', "Heart Rate Bpm") }}
Created an automation that calls the color changing script when a workout is Active.
automations.yaml:
- id: '1603764652569'
alias: Peloton - BPM Loop
description: ''
trigger:
- platform: time_pattern
minutes: /1
condition:
- condition: state
entity_id: sensor.peloton_arghthor
state: Active
action:
- service: script.turn_on
data: {}
entity_id: script.peloton_colors
mode: restart
Script reads the heartbeat sensor and changes the basement lights to the appropriate color.
peloton_colors:
alias: Peloton BPM Colors
sequence:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.peloton_bpm
above: '160'
sequence:
- service: light.turn_on
data:
rgb_color:
- 255
- 71
- 89
entity_id: light.basement_lights
- conditions:
- condition: numeric_state
entity_id: sensor.peloton_bpm
above: '143'
below: '159'
sequence:
- service: light.turn_on
data:
rgb_color:
- 252
- 128
- 15
entity_id: light.basement_lights
- conditions:
- condition: numeric_state
entity_id: sensor.peloton_bpm
above: '126'
below: '142'
sequence:
- service: light.turn_on
data:
rgb_color:
- 250
- 203
- 62
entity_id: light.basement_lights
- conditions:
- condition: numeric_state
entity_id: sensor.peloton_bpm
above: '109'
below: '125'
sequence:
- service: light.turn_on
data:
rgb_color:
- 182
- 201
- 92
entity_id: light.basement_lights
default:
- service: light.turn_on
data:
rgb_color:
- 80
- 196
- 170
entity_id: light.basement_lights
mode: single
Would love to update more often than once a minute, but I understand the hesitancy to poll Peloton more often.