You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.9 KiB

<<: !include secrets.yml
esphome:
name: ledstring
platform: ESP8266
board: d1_mini
wifi:
ssid: $wifi_ssid
password: $wifi_password
ap:
ssid: "LED String Fallback Hotspot"
password: $wifi_ap_password
captive_portal:
logger:
api:
reboot_timeout: 0s
ota:
password: $ota_password
web_server:
binary_sensor:
- platform: gpio
id: button
pin:
number: D1
mode: INPUT_PULLUP
inverted: True
name: "Button"
on_click:
- min_length: 400ms
max_length: 3000ms
then:
- light.turn_off: ledstring
- then:
- lambda: |
std::vector<LightEffect *> effects = id(ledstring).get_effects();
std::string current = id(ledstring).get_effect_name();
std::string next = effects[0]->get_name();
for(int i=0; i<effects.size(); i++) {
if(effects[i]->get_name().compare(current) == 0) {
next = effects[(i+1) % effects.size()]->get_name();
}
}
auto call = id(ledstring).turn_on();
call.set_brightness(0.8);
call.set_effect(next);
call.perform();
light:
- platform: neopixelbus
id: ledstring
name: "LED String"
type: RGB
variant: WS2812
method: ESP8266_DMA
pin: GPIO3
num_leds: 26
effects:
- addressable_twinkle:
name: twinkle
twinkle_probability: 5%
progress_interval: 4ms
- addressable_random_twinkle:
name: randomtwinkle
twinkle_probability: 5%
progress_interval: 32ms
- addressable_rainbow:
name: rainbow
speed: 10
width: 50
- addressable_rainbow:
name: slowrainbow
speed: 1
width: 70
- addressable_flicker:
name: flicker
update_interval: 50ms
intensity: 5%
- addressable_color_wipe:
name: wipe