I have been trying all day to turn on and change the color of a single WS2812B LED on GPIO14. The code below sort-of works.
When I press the button on GPIO2, I get this in the device logs:
[18:39:47][D][binary_sensor:036]: 'remotsy - button': Sending state ON
[18:39:47][D][light:036]: 'led1' Setting:
[18:39:47][D][light:047]: State: ON
[18:39:47][D][light:051]: Brightness: 30%
[18:39:47][D][light:058]: Red: 100%, Green: 17%, Blue: 17%
[18:39:47][D][light:085]: Transition length: 1.0s
[18:39:48][D][light:036]: 'led1' Setting:
[18:39:48][D][light:051]: Brightness: 30%
[18:39:48][D][light:058]: Red: 20%, Green: 20%, Blue: 100%
[18:39:48][D][light:085]: Transition length: 1.0s
Where did the “Red: 100%” come from?
Where the the “Blue:100%” come from?
Why do I never see any red from the LED?
Any tips would be appreciated
substitutions:
friendly_name: remotsy
device_name: remotsy
project_name: remotsy
project_version: '1.00'
packages:
wifi: !include common/wifi.yaml
esphome:
name: ${device_name}
project:
name: steve.${project_name}
version: ${project_version}
esp8266:
board: d1_mini
framework:
version: recommended
logger:
level: DEBUG
ota:
safe_mode: True
api:
############################################
# Define a light with a single WS2812 LED
light:
- platform: neopixelbus
variant: WS2812
pin: GPIO14
num_leds: 1
type: GRB
id: led1
method:
type: bit_bang
binary_sensor:
- platform: gpio
name: ${device_name} - button
pin:
number: D2
mode: input_pullup
inverted: True
on_press:
then:
- script.execute: color_reddish
- delay: !lambda "return 500;"
- script.execute: color_blueish
script:
- id: color_reddish
then:
- light.turn_on:
id: led1
brightness: 30%
red: 60%
green: 10%
blue: 10%
- id: color_blueish
then:
- light.turn_on:
id: led1
brightness: 30%
red: 10%
green: 10%
blue: 50%