esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
292 stars 36 forks source link

My device doesn't work anymore with new ESPHome update and NeopixelBus #1707

Closed RomainD2 closed 3 years ago

RomainD2 commented 3 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

Docker ESP (ESP32/ESP8266, Board/Sonoff):

ESP32 ESPHome version (latest production, beta, dev branch)

1.15.3 Affected component:

https://esphome.io/components/light/neopixelbus.html

Description of problem: Hi,

I have a problem with an ESPHome light which was working well for one year.

I tried to do a minor change and upload the code with OTA update, and my device wasn't working anymore, and couldn't connect to wifi.

I upload again the previous yaml code which was working fine for one year, and I had the same problem. After some investigations, I found that the problem appears when I add the Neopixelbus platform line. When I am trying to use it, all my device doens't work anymore, and I have no wifi.

I don't remember which was the ESPHome version when my device was working fine.

You can find attached the below yaml which works, and when I remove the # from these lines :

#  - platform: neopixelbus
#    type: GRB
#    pin: GPIO18
#    num_leds: 61
#    id: led_ambiance
#    name: "Lampe Salon Ambiance"

It doesn't work anymore

I tried to upload the bin file with ESPHome-Flasher in order to see the log with serial port, and I had that :

Showing logs:
[11:21:52][I][logger:166]: Log initialized
[11:21:52][C][ota:366]: There have been 0 suspected unsuccessful boot attempts.
[11:21:53][I][app:029]: Running through setup()...
[11:21:53][C][fastled:010]: Setting up FastLED light...
[11:21:53][C][fastled:010]: Setting up FastLED light...
[11:21:53][C][light:097]: Setting up light 'Lampe Salon 1'...
[11:21:53][D][light:265]: 'Lampe Salon 1' Setting:
[11:21:54][D][light:278]:   Brightness: 100%
[11:21:54][D][light:282]:   Color Temperature: 1.0 mireds
[11:21:54][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:54][C][light:097]: Setting up light 'Lampe Salon 2'...
[11:21:54][D][light:265]: 'Lampe Salon 2' Setting:
[11:21:54][D][light:278]:   Brightness: 100%
[11:21:55][D][light:282]:   Color Temperature: 1.0 mireds
[11:21:55][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:55][C][light:097]: Setting up light 'Lampe Salon Ambiance'...
[11:21:55][D][light:265]: 'Lampe Salon Ambiance' Setting:
[11:21:55][D][light:278]:   Brightness: 100%
[11:21:56][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:56][C][light:097]: Setting up light 'Lampe Salon Led BTN 2'...
[11:21:56][D][light:265]: 'Lampe Salon Led BTN 2' Setting:
[11:21:56][D][light:278]:   Brightness: 100%
[11:21:56][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:57][C][light:097]: Setting up light 'Lampe Salon Led BTN 1'...
[11:21:57][D][light:265]: 'Lampe Salon Led BTN 1' Setting:
[11:21:57][D][light:278]:   Brightness: 100%
[11:21:57][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:57][C][esp32_touch:012]: Setting up ESP32 Touch Hub...
[11:21:58][C][bme280.sensor:081]: Setting up BME280...
[11:21:58][W][i2c:070]: Received NACK on transmit of address 0x76
[11:21:58][E][component:092]: Component was marked as failed.
[11:21:58][C][ssd1306_i2c:010]: Setting up I2C SSD1306...
[11:21:58][W][i2c:070]: Received NACK on transmit of address 0x3C
[11:21:59][E][component:092]: Component was marked as failed.
[11:21:59][C][wifi:033]: Setting up WiFi...
[11:21:59][D][wifi:324]: Starting scan...

And nothing more happen...

Note : The device is not connected to my light, so it is normal that some stuff as I2C devices are not avalaible. But even when the ESP32 is connected to my light, it doesn't work.

Problem-relevant YAML-configuration entries:

PASTE YAML FILE HERE
esphome:
  name: lampe_salon
  platform: ESP32
  board: esp32doit-devkit-v1

wifi:
  ssid: "HR"
  password: "RD19marsHF"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Lampe Salon Fallback Hotspot"
    password: "yd8tINOQotEX"

captive_portal:

# Pour pouvoir afficher l'heure
time:
  - platform: homeassistant
    id: horloge

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

esp32_touch:
  #setup_mode: True

i2c:
  sda: 21
  scl: 22
  scan: True
  frequency: 800kHz

# A fichiers font à télécharger et importer dans le dossier /config/esphome directement sur HomeAssistant dans Configurator
font:
  - file: 'slkscr.ttf'
    id: font1
    size: 14
  - file: 'BebasNeue-Regular.ttf'
    id: font2
    size: 40
  - file: 'arial.ttf'
    id: font3
    size: 14

# Example configuration entry
sun:
  latitude: 48.625301
  longitude: 2.128854
  on_sunrise:
    - then:
        if:
          condition:
            or:
              - light.is_on: lampe_salon_1
              - light.is_on: lampe_salon_2
          then:
            - script.execute: on_day
  on_sunset:
    - then:
        if:
          condition:
            or:
              - light.is_on: lampe_salon_1
              - light.is_on: lampe_salon_2
          then:
            - script.execute: on_night

script:
  - id: on_night
    then:
      - light.turn_on:
          id: lampe_salon_1
          brightness: 70%
          color_temperature: 3500 K
      - light.turn_on:
          id: lampe_salon_2
          brightness: 70%
          color_temperature: 3500 K
      - light.turn_on:
          id: led_btn_1
          brightness: 100%
          red: 0.5
          green: 0.5
          blue: 0.0
      - light.turn_on:
          id: led_btn_2
          brightness: 100%
          red: 0.5
          green: 0.5
          blue: 0.0
  - id: on_day
    then:
      - light.turn_on:
          id: lampe_salon_1
          brightness: 100%
          color_temperature: 4750 K
      - light.turn_on:
          id: lampe_salon_2
          brightness: 100%
          color_temperature: 4750 K
      - light.turn_on:
          id: led_btn_1
          brightness: 100%
          red: 1.0
          green: 1.0
          blue: 1.0
      - light.turn_on:
          id: led_btn_2
          brightness: 100%
          red: 1.0
          green: 0.5
          blue: 0.0
  - id: off_light
    then:
      - light.turn_off: lampe_salon_1
      - light.turn_off: lampe_salon_2
      - light.turn_on:
          id: led_btn_1
          brightness: 100%
          red: 0.0
          green: 0.0
          blue: 1.0
      - light.turn_off:
          id: led_btn_2

# L'adresse 0x76 est importante, sinon, ne fonctionne pas!
sensor:
  - platform: bme280
    temperature:
      name: "Lampe Salon Température"
      oversampling: 16x
      id: temperature
    pressure:
      name: "Lampe Salon Pression"
      id: pression
    humidity:
      name: "Lampe Salon Humidité"
      id: humidite
    address: 0x76
    update_interval: 60s
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s

binary_sensor:
  - platform: esp32_touch
    name: "Lampe Salon BTN 1"
    id: btn_1
    pin: GPIO15
    threshold: 600
    on_click:
    - min_length: 50ms
      max_length: 350ms
      then:
        if:
          condition:
            or:
              - light.is_off: lampe_salon_1
              - light.is_off: lampe_salon_2
          then:
            if:
              condition: sun.is_below_horizon
              then:
                - script.execute: on_night
                - logger.log: sun.is_below_horizon
              else:
                - script.execute: on_day
                - logger.log: sun.is_below_horizon
          else:
            - script.execute: off_light
  - platform: esp32_touch
    name: "Lampe Salon BTN 2"
    id: btn_2
    pin: GPIO12
    threshold: 600
    on_multi_click:
    - timing:
        - ON for at most 1s
        - OFF for at most 1s
        - ON for at most 1s
        - OFF for at least 0.2s
      then:
        - logger.log: "Double Clicked"
        - light.dim_relative: # Increases the brightness by 15%
            id: lampe_salon_1
            relative_brightness: 15%
        - light.dim_relative: # Increases the brightness by 15%
            id: lampe_salon_2
            relative_brightness: 15%
        - light.turn_on:
            id: led_btn_2
            brightness: 100%
            red: 1.0
            green: 0.0
            blue: 0.0
    - timing:
        - ON for 1s to 2s
        - OFF for at least 0.5s
      then:
        - logger.log: "Single Long Clicked"
    - timing:
        - ON for at most 1s
        - OFF for at least 0.5s
      then:
        - logger.log: "Single Short Clicked"
        - light.dim_relative: # Decreases the brightness by 15%
            id: lampe_salon_1
            relative_brightness: -15%
        - light.dim_relative: # Decreases the brightness by 15%
            id: lampe_salon_2
            relative_brightness: -15%
        - light.turn_on:
            id: led_btn_2
            brightness: 100%
            red: 0.0
            green: 1.0
            blue: 0.0
#  - platform: esp32_touch
#    name: "Lampe Salon BTN 3"
#    id: btn_3
#    pin: GPIO4
#    threshold: 600
#    on_click:
#    - min_length: 50ms
#      max_length: 350ms
#      then:
#        if:
#          condition:
#            - light.is_off: led_ambiance
#          then:
#            - light.turn_on:
#                id: led_ambiance
#                effect: "Fire Ring"
#          else:
#            - light.turn_off: led_ambiance
#    - min_length: 400ms
#      max_length: 5000ms
#      then:
#        - switch.toggle:
#            id: extern_switch

# Example configuration entry
#remote_transmitter:
#  pin: GPIO13
#  carrier_duty_percent: 50%

#remote_receiver:
#  pin: 
#    number: GPIO34
#    inverted: True
#    mode: INPUT_PULLUP
#  dump: all

#switch:
#  - platform: template
#    name: "Switch externe"
#    optimistic: true
#v    id: extern_switch

output:
  - platform: ledc
    pin: GPIO25
    frequency: 18kHz
    inverted: False
    id: led1_warm
  - platform: ledc
    pin: GPIO33
    frequency: 18kHz
    inverted: False
    id: led1_cold
  - platform: ledc
    pin: GPIO26
    inverted: False
    id: led2_warm
    frequency: 18kHz
  - platform: ledc
    pin: GPIO27
    frequency: 18kHz
    inverted: False
    id: led2_cold

light:
  - platform: cwww
    name: "Lampe Salon 1"
    id: lampe_salon_1
    cold_white: led1_cold
    warm_white: led1_warm
    cold_white_color_temperature: 6000 K
    warm_white_color_temperature: 3500 K
    gamma_correct: 3
  - platform: cwww
    name: "Lampe Salon 2"
    id: lampe_salon_2
    cold_white: led2_cold
    warm_white: led2_warm
    cold_white_color_temperature: 6000 K
    warm_white_color_temperature: 3500 K
    gamma_correct: 3
#  - platform: fastled_clockless
#    chipset: WS2811
#    pin: GPIO05
#    num_leds: 1
#    rgb_order: RGB
#    name: "Lampe Salon Led BTN 3"
#    id: led_btn_3
  - platform: fastled_clockless
    chipset: WS2811
    pin: GPIO16
    num_leds: 1
    rgb_order: RGB
    name: "Lampe Salon Led BTN 2"
    id: led_btn_2
  - platform: fastled_clockless
    chipset: WS2811
    pin: GPIO17
    num_leds: 1
    rgb_order: RGB
    name: "Lampe Salon Led BTN 1"
    id: led_btn_1
#  - platform: neopixelbus
#    type: GRB
#    pin: GPIO18
#    num_leds: 61
#    id: led_ambiance
#    name: "Lampe Salon Ambiance"
#    effects:
#      - random:
#      - strobe:
#      - flicker:
#      - addressable_rainbow:
#      - addressable_color_wipe:
#      - addressable_scan:
#      - addressable_twinkle:
#      - addressable_random_twinkle:
#      - addressable_fireworks:
#      - addressable_flicker:
#      - addressable_lambda:
#          name: "Fire Ring"
#          update_interval: 5ms
#          lambda: |-
#            for( int Pixel = 0; Pixel <= it.size(); Pixel++) {
#              it[Pixel] = ESPColor(155, 83, 27);
#              ESPColor color1;
#              uint8_t r1,g1,b1;
#              uint8_t r2,g2,b2;
#              uint8_t r3,g3,b3;
#              int16_t r,g,b;
#
#              color1 = it[Pixel].get();
#              //int color2[] = {80,35,0};
#              int color2[] = {179, 121, 7};
#              //ESP_LOGD("main", "Color1 :(%d,%d,%d)", color1[0],color1[1],color1[2]);
#              
#              r1 = (color1[0] ),
#              g1 = (color1[1] ),
#              b1 = (color1[2] );
#
#              r2 = (color2[0] ),
#              g2 = (color2[1] ),
#              b2 = (color2[2] );
#
#              // Add Color
#              it[Pixel] = ESPColor(constrain(r1+r2, 0, 255), constrain(g1+g2, 0, 255), constrain(b1+b2, 0, 255));
#              int rc = random(120);
#
#              // subtract
#              
#              color2[0] = rc;
#              color2[1] = rc/2;
#              color2[2] = rc/2;
#
#              r1 = (color1[0] ),
#              g1 = (color1[1] ),
#              b1 = (color1[2] );
#
#              r2 = (color2[0] ),
#              g2 = (color2[1] ),
#              b2 = (color2[2] );
#
#              r=(int16_t)r1-(int16_t)r2;
#              g=(int16_t)g1-(int16_t)g2;
#              b=(int16_t)b1-(int16_t)b2;
#              if(r<0) r=0;
#              if(g<0) g=0;
#              if(b<0) b=0;
#
#              //ESP_LOGD("main", "Color1 :(%d,%d,%d)", r,g,b);
#              // Substract Color
#              it[Pixel] = ESPColor(r, g, b);
#            }
#            
#            delay(random(10,120));
#
#          name: "Blue fire"
#          update_interval: 5ms
#          lambda: |-
#            for( int Pixel = 0; Pixel <= it.size(); Pixel++) {
#              it[Pixel] = ESPColor(22, 24, 130);
#              ESPColor color1;
#              uint8_t r1,g1,b1;
#              uint8_t r2,g2,b2;
#              uint8_t r3,g3,b3;
#              int16_t r,g,b;
#
#              color1 = it[Pixel].get();
#              //int color2[] = {80,35,0};
#              int color2[] = {70, 185, 242};
#              //ESP_LOGD("main", "Color1 :(%d,%d,%d)", color1[0],color1[1],color1[2]);
#              
#              r1 = (color1[0] ),
#              g1 = (color1[1] ),
#              b1 = (color1[2] );
#
#              r2 = (color2[0] ),
#              g2 = (color2[1] ),
#              b2 = (color2[2] );
#
#              // Add Color
#              it[Pixel] = ESPColor(constrain(r1+r2, 0, 255), constrain(g1+g2, 0, 255), constrain(b1+b2, 0, 255));
#              int rc = random(160);
#
#              // subtract
#              
#              color2[0] = rc/4;
#              color2[1] = rc/4;
#              color2[2] = rc;
#
#              r1 = (color1[0] ),
#              g1 = (color1[1] ),
#              b1 = (color1[2] );
#
#              r2 = (color2[0] ),
#              g2 = (color2[1] ),
#              b2 = (color2[2] );
#
#              r=(int16_t)r1-(int16_t)r2;
#              g=(int16_t)g1-(int16_t)g2;
#              b=(int16_t)b1-(int16_t)b2;
#              if(r<0) r=0;
#              if(g<0) g=0;
#              if(b<0) b=0;
#
#              //ESP_LOGD("main", "Color1 :(%d,%d,%d)", r,g,b);
#              // Substract Color
#              it[Pixel] = ESPColor(r, g, b);
#            }
#            
#            delay(random(10,120));

# L'adresse 0x3C est importante, sinon, ne fonctionne pas!
display:
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    address: 0x3C
    lambda: |-
      // Afficher texte en haut
      it.printf(64, 0, id(font3), TextAlign::TOP_CENTER, "Lampe Salon");

      // Print time in HH:MM format
      it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(horloge).now());

      // Afficher la température
      if (id(temperature).has_state()) {
        it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°C", id(temperature).state);
      }

      // Afficher l'humidité
      if (id(humidite).has_state()) {
        it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.0f%%", id(humidite).state);
      }

Logs (if applicable):

PASTE DEBUG LOG HERE

[11:21:52][I][logger:166]: Log initialized
[11:21:52][C][ota:366]: There have been 0 suspected unsuccessful boot attempts.
[11:21:53][I][app:029]: Running through setup()...
[11:21:53][C][fastled:010]: Setting up FastLED light...
[11:21:53][C][fastled:010]: Setting up FastLED light...
[11:21:53][C][light:097]: Setting up light 'Lampe Salon 1'...
[11:21:53][D][light:265]: 'Lampe Salon 1' Setting:
[11:21:54][D][light:278]:   Brightness: 100%
[11:21:54][D][light:282]:   Color Temperature: 1.0 mireds
[11:21:54][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:54][C][light:097]: Setting up light 'Lampe Salon 2'...
[11:21:54][D][light:265]: 'Lampe Salon 2' Setting:
[11:21:54][D][light:278]:   Brightness: 100%
[11:21:55][D][light:282]:   Color Temperature: 1.0 mireds
[11:21:55][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:55][C][light:097]: Setting up light 'Lampe Salon Ambiance'...
[11:21:55][D][light:265]: 'Lampe Salon Ambiance' Setting:
[11:21:55][D][light:278]:   Brightness: 100%
[11:21:56][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:56][C][light:097]: Setting up light 'Lampe Salon Led BTN 2'...
[11:21:56][D][light:265]: 'Lampe Salon Led BTN 2' Setting:
[11:21:56][D][light:278]:   Brightness: 100%
[11:21:56][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:57][C][light:097]: Setting up light 'Lampe Salon Led BTN 1'...
[11:21:57][D][light:265]: 'Lampe Salon Led BTN 1' Setting:
[11:21:57][D][light:278]:   Brightness: 100%
[11:21:57][D][light:287]:   Red=100%, Green=100%, Blue=100%
[11:21:57][C][esp32_touch:012]: Setting up ESP32 Touch Hub...
[11:21:58][C][bme280.sensor:081]: Setting up BME280...
[11:21:58][W][i2c:070]: Received NACK on transmit of address 0x76
[11:21:58][E][component:092]: Component was marked as failed.
[11:21:58][C][ssd1306_i2c:010]: Setting up I2C SSD1306...
[11:21:58][W][i2c:070]: Received NACK on transmit of address 0x3C
[11:21:59][E][component:092]: Component was marked as failed.
[11:21:59][C][wifi:033]: Setting up WiFi...
[11:21:59][D][wifi:324]: Starting scan...

Additional information and things you've tried:

randybb commented 3 years ago

Yes, yes. It is still broken https://github.com/esphome/issues/issues/1481 and it is affecting 1.15.x and dev branch.

Just add this and it will work again.

esphome:
  platformio_options:
    lib_deps: NeoPixelBus@2.6.0