Advertisement
314ma

ESPHome light effects

Dec 13th, 2024 (edited)
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.95 KB | None | 0 0
  1. light:
  2.   - platform: neopixelbus
  3.     name: "Entrance LED"
  4.     id: light_addressable
  5.     icon: "mdi:led-strip-variant"
  6.     pin: GPIO3
  7.     num_leds: 21
  8.     variant: SK6812
  9.     type: GRBW
  10.     method:
  11.       type: esp8266_dma
  12.     effects:
  13.       - random:
  14.           name: "Random"
  15.       - pulse:
  16.           name: "Pulse"
  17.       - strobe:
  18.           name: "Strobe"
  19.       - flicker:
  20.           name: "Flicker"
  21.       - addressable_rainbow:
  22.           name: "Rainbow"
  23.       - addressable_color_wipe:
  24.           name: "Color wipe"
  25.       - addressable_scan:
  26.           name: "Scan"
  27.       - addressable_twinkle:
  28.           name: "Twinkle"
  29.       - addressable_fireworks:
  30.           name: "Fireworks"
  31.       - addressable_flicker:
  32.           name: "Addressable flicker"
  33.       - addressable_random_twinkle:
  34.           name: "Addressable Random Twinkle"
  35.       - addressable_lambda:
  36.           name: "Startup effect"
  37.           update_interval: 32ms
  38.           lambda: |-
  39.             static uint16_t progress = 0;
  40.             if (initial_run) {
  41.               it.all() = Color::BLACK;
  42.               progress = it.size();
  43.               return;
  44.             }
  45.             if(progress > 0) {
  46.               progress--;
  47.               it.range(progress, it.size()) = current_color;
  48.             }
  49.       - addressable_lambda:
  50.           name: "Shutdown effect"
  51.           update_interval: 32ms
  52.           lambda: |-
  53.             static uint16_t progress = 0;
  54.             if (initial_run) {
  55.               progress = 0;
  56.               return;
  57.             }
  58.             if(progress < it.size()) {
  59.               progress++;
  60.               it.range(0, progress) = Color::BLACK;
  61.             }
  62.     on_state:
  63.       then:
  64.         - if:
  65.             condition:
  66.               lambda: |-
  67.                 return id(light_addressable).get_effect_name() == "Shutdown effect";
  68.             then:
  69.               - delay: 800ms
  70.               - light.turn_off:
  71.                   id: light_addressable
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement