I am trying to get LEDs to change colour depending on my heart rate with the data being provided from Zwift Sensors.
The Zwift sensors are sending the data to Home Assistant, as I set up a dashboard which updates every 5 seconds and the data of my heart rate is there so this confirms the data is going into home assistant.
I have different levels for heart rate and each level has its own colour (in hex).
When I go to Automatons and click on ‘Execute’ for each of the levels the LED changes colour correctly.
The LED is being controlled via D1 Mini with ESPHome.
I can not figure out what I am missing. Here is what I have so far:
Devices= heartrate_led_1
Entity= Heartrate_LED_1
Entity_ID = light.heartrate_led_1
The Entity is part of the following automations:
- Zwift Zone 1 Light
- Zwift Zone 2 Light
- Zwift Zone 3 Light
- Zwift Zone 4 Light
- Zwift Zone 5 Light
- Zwift Zone 6 Light
- Zwift Zone 7 Light
Part of the Following Scripts:
Heartrate_led_script_1
Here is one of the Automatons (all 7 are the same, the difference is the heart rate level and the colour)
id: '1605483060300'
alias: Zwift Zone 3 Light
trigger:
- entity_id: sensor.zwift_heart_rate_XXXXXXX
platform: state
to: '150'
from: '141'
condition: []
action:
- data:
entity_id: light.heartrate_led_1
rgb_color:
- 89
- 191
- 89
service: light.turn_on
mode: single
Here is the Script:
heartrate_led_script_1:
alias: Heartrate_led_script_1
sequence:
- type: turn_on
device_id: dfd88e358ce7099cb79ec1d8cbc4c932
entity_id: light.heartrate_led_1
domain: light
brightness_pct: 100
- condition: numeric_state
entity_id: sensor.zwift_heart_rate_2672785
below: '120'
above: '1'
mode: single
icon: mdi:heart
What am I missing? Pulling my hair out trying to find out why its not triggering, any help greatly appreciated.