Esphome Playbulb Candle

So I got these “Playbulb Candles” for free, they have been sitting on my desk and I had no idea wtf I was going to do with them or use them for,

Turns out, they make really handy LED status indicators to indicate the status of entities and internet connection,

Now WiFi instead of bluetooth.

  • Flashes orange when the internet is down, 8.8.8.8 is unreachable.
  • Flashes red when any esphome device disconnects from the wifi.
  • More to be decided.

Simple single WS2812 LED and esp8266.






Great idea. It would be nice if you also included your esphome config.

Nice hack!

I just control and regularly poll the battery status of my Playbulb Candles, as they came, via Bluetooth, and appreciate their portability with rechargeable batteries inside :slight_smile:

1 Like

Sure, current config to date.

wifi:
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
    bssid:redacted
  fast_connect: true
  on_connect:
    - light.turn_on:
        id: led
        brightness: 100%
        red: 0%
        green: 100%
        blue: 0%
        effect: none
  on_disconnect:
      - light.control:
          id: led
          state: on
          effect: ERROR

captive_portal:
    
light:
  - platform: fastled_clockless
    id: led
    name: "LED"
    pin: 23
    chipset: WS2812
    num_leds: 1
    rgb_order: GRB
#    restore_mode: ALWAYS_OFF
    effects:
      # Use default parameters:
      - random:
      # Customize parameters
      - random:
          name: "My Slow Random Effect"
          transition_length: 30s
          update_interval: 30s
      - random:
          name: "My Fast Random Effect"
          transition_length: 4s
          update_interval: 5s
      - random:
          name: Random Effect With Custom Values
          transition_length: 5s
          update_interval: 7s         
      - pulse:
          name: "Fast Pulse"
          transition_length: 0.5s
          update_interval: 0.5s
          min_brightness: 0%
          max_brightness: 100%
      - pulse:
          name: "Slow Pulse"
          # transition_length: 1s      # defaults to 1s
          update_interval: 2s
      - strobe:
          name: Strobe Effect With Custom Values
          colors:
            - state: true
              brightness: 100%
              red: 100%
              green: 90%
              blue: 0%
              duration: 500ms
            - state: false
              duration: 250ms
            - state: true
              brightness: 100%
              red: 0%
              green: 100%
              blue: 0%
              duration: 500ms
      - flicker:
          name: Flicker Effect With Custom Values
          alpha: 95%
          intensity: 1.5%
      - addressable_rainbow:
          name: Rainbow Effect With Custom Values
          speed: 10
          width: 50
      - addressable_color_wipe:
          name: Color Wipe Effect With Custom Values
          colors:
            - red: 100%
              green: 100%
              blue: 100%
              num_leds: 1
            - red: 0%
              green: 0%
              blue: 0%
              num_leds: 1
          add_led_interval: 100ms
          reverse: false
      - addressable_scan:
          name: Scan Effect With Custom Values
          move_interval: 100ms
          scan_width: 1
      - addressable_twinkle:
          name: Twinkle Effect With Custom Values
          twinkle_probability: 5%
          progress_interval: 4ms

      - addressable_random_twinkle:
          name: Random Twinkle Effect With Custom Values
          twinkle_probability: 5%
          progress_interval: 32ms
      - addressable_fireworks:
          name: Fireworks Effect With Custom Values
          update_interval: 32ms
          spark_probability: 10%
          use_random_color: false
          fade_out_rate: 120

      - addressable_lambda:
          name: "Wipe In"
          update_interval: 50ms
          lambda: |-
            static int x = 40;
            static int y = 0;
            if (initial_run) {
              x = 40;
              y = 0;
              it.all() = ESPColor::BLACK;
            }
            if (x < it.size(), (y < it.size())) {
              it[x, y] = current_color;
              y += 1;
              x += 1;
            }

      - addressable_lambda:
          name: "Expo Light"
          update_interval: 16ms
          lambda: |-
            static int x = -400;
            float y = 0.35+0.65*exp(-pow(x, 2)/49000);
            int8_t r = ceil(current_color.r * y);
            int8_t g = ceil(current_color.g * y);
            int8_t b = ceil(current_color.b * y);
            it.all() = ESPColor(r,g,b);
            x += 1;
            if (x == 400)
              x = -400;

      - addressable_lambda:
          name: "Wipe Out"
          update_interval: 12ms
          lambda: |-
            static int x = 0;
            if (initial_run) {
              x = it.size();
            }
            if (x > 0) {
              x -= 1; 
              it[x] = ESPColor::BLACK;
            }

      - lambda:
          name: "ERROR"
          update_interval: 1s
          lambda: |-
            static bool state = false;
            auto call = id(led).turn_on();
            call.set_transition_length(500);
            call.set_rgb(1, 0, 0);
            if (!state) {
              call.set_brightness(1);
            } else {
              // If using 0, it freaks Home Assistant UI.
              call.set_brightness(0.01);
            }
            call.perform();
            state = !state;
      - lambda:
          name: "BOOT"
          update_interval: 1s
          lambda: |-
            static bool state = false;
            auto call = id(led).turn_on();
            call.set_transition_length(500);
            call.set_rgb(0, 1, 0);
            if (!state) {
              call.set_brightness(1);
            } else {
              // If using 0, it freaks Home Assistant UI.
              call.set_brightness(0.01);
            }
            call.perform();
            state = !state;
2 Likes