esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
291 stars 34 forks source link

Too many ble events to process with bus SPI #4196

Open tergontor opened 1 year ago

tergontor commented 1 year ago

The problem

I open this new issue because the previous #4172 was closed without explanation Five esp32devkitv1 boards with Project esphome.bluetooth-proxy version 1.0 and espidf framework. Of those 5, three show continuous records in the log (20 to 25 per minute) with this information: “W][esp32_ble_tracker:121]: Too many BLE events to process. Some devices may not show up.” After doing some research, I have found out that these registers are only output when I have the SPI bus in the code of the board (necessary to install the st7735s tft screen through which I see the data that I consider necessary such as temperature, humidity, co2, ...).

Which version of ESPHome has the issue?

ESPHome version 2023.2.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

Home Assistant 2023.2.5

What platform are you using?

ESP32-IDF

Board

esp32 devkitv1

Component causing the issue

bus spi

Example YAML snippet

substitutions:
  name: "esp32-btp-scd41-salon"
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.60.26
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.60.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0 

#código necesario para resetearlo a valores de fábrica
#  on_boot:  
#    then:
#      - scd4x.factory_reset: scd41

#código necesario para calibrar manualmente el scd41 si es necesario
#  on_boot:
#   then:
#      - scd4x.perform_forced_calibration:
#          value: 419  # outside average April 2022
#          id: scd41

external_components:
#  ==== para ver la temperetura interna del ESP32
  - source: github://pr#4330
    components: [internal_temperature]
    refresh: always

#i2c para scd41
i2c:
  sda: 21
  scl: 22
  scan: true

#spi para st7735
spi:
  clk_pin: 18
  mosi_pin: 23

sensor:

#para ver la temperatura interna de la placa esp32
  - platform: internal_temperature
    name: "Temp del ESP32 scd41-salón"

  - platform: scd4x
#código necesario para calibralo manualmente
    id: scd41
    co2:
      name: "CO2 Salón"
      id: co2_scd41_salon

    temperature:
      name: "Temperatura Salón SCD41"
    temperature_offset: 5.2   #lo calibro el 20 de diciembre a 5.2, tomando como referencia el sensor bme280

    humidity:
      name: "Humedad Salón SCD41"
    altitude_compensation: 650m

#sensores para que se muestren en la pantalla tft

  - platform: homeassistant
    id: temperatura_salon
    entity_id: sensor.rm4_pro_salon_temperature
    internal: true

  - platform: homeassistant
    id: humedad_salon
    entity_id: sensor.rm4_pro_salon_humidity
    internal: true

  - platform: homeassistant
    id: terraza_temperatura
    entity_id: sensor.terraza_temperatura
    internal: true

  - platform: homeassistant
    id: sensacion_termica
    entity_id: sensor.aemet_temperature_feeling
    internal: true

# sensor wifi signal creado por video https://www.youtube.com/watch?v=M5nIWzYfv68
  - platform: wifi_signal
    name: cO2_salon_wifi_signal
    update_interval: 300s

# Define a PWM output on the ESP32  para el brillo de la pantalla
output:
  - platform: ledc
    pin: 32
    id: gpio_32_backlight_pwm

# Define una entidad light para poder automatizar el brillo por ej con nodered
light:
  - platform: monochromatic
    output: gpio_32_backlight_pwm
    name: "CO2 Salon brillo"
    id: back_light
    restore_mode: ALWAYS_ON

#time:
#  - platform: homeassistant
#    id: esptime    

display:
- platform: st7735
  model: "INITR_18BLACKTAB"
  reset_pin: 27
  cs_pin: 26
  dc_pin: 5
  rotation: 90
  device_width: 128
  device_height: 160
  col_start: 0
  row_start: 0
  eight_bit_color: true
  update_interval: 5s
  id: my_display

  pages:
      - id: page1
        lambda: |-
          if (!id(temperatura_salon).has_state()) {
            it.print(
              it.get_width()/2,
              it.get_height()/2,
              id(font40),
              color_white,
              TextAlign::CENTER,
              "Starting..."
            );
            return;
          }

          auto bg_color = id(color_black);
          auto text_color = id(color_red);
          auto tempsalon = id(temperatura_salon).state;

          if(tempsalon > 0) text_color = id(color_white); 
          if(tempsalon > 13) text_color = id(color_azulceleste); 
          if(tempsalon > 17) text_color = id(color_green);
          if(tempsalon > 26) text_color = id(color_yellow);
          if(tempsalon > 30) text_color = id(color_red);

          it.print(0, 5, id(font20), " TEMP. SALON");
          it.filled_rectangle(0, 30, it.get_width(), it.get_height(), bg_color);
          it.printf(
            it.get_width()/2, 
            it.get_height()/1.5, 
            id(font40), 
            text_color, 
            TextAlign::CENTER, 
            "%.1f °C",
            tempsalon
          );

      - id: page2
        lambda: |-
          if (!id(humedad_salon).has_state()) {
            it.print(
              it.get_width()/2,
              it.get_height()/2,
              id(font40),
              color_white,
              TextAlign::CENTER,
              "Starting..."
            );
            return;
          }

          auto bg_color = id(color_black);
          auto text_color = id(color_red);
          auto humsalon = id(humedad_salon).state;

          if(humsalon > 0) text_color = id(color_yellow); 
          if(humsalon > 40) text_color = id(color_green);
          if(humsalon > 70) text_color = id(color_red);

          it.print(0, 5, id(font17), "HUMEDAD SALON");
          it.filled_rectangle(0, 30, it.get_width(), it.get_height(), bg_color);
          it.printf(
            it.get_width()/2, 
            it.get_height()/1.5, 
            id(font40), 
            text_color, 
            TextAlign::CENTER, 
            "%.0f %%",
            humsalon
          );

      - id: page3
        lambda: |-
          if (!id(terraza_temperatura).has_state()) {
            it.print(
              it.get_width()/2,
              it.get_height()/2,
              id(font40),
              color_white,
              TextAlign::CENTER,
              "Starting..."
            );
            return;
          }

          auto bg_color = id(color_black);
          auto text_color = id(color_red);
          auto terrazatemp = id(terraza_temperatura).state;
          auto sensaciontermica = id(sensacion_termica).state;

          if(terrazatemp <= 0) text_color = id(color_white); 
          if(terrazatemp > 0) text_color = id(color_purple);  
          if(terrazatemp > 5) text_color = id(color_azulceleste); 
          if(terrazatemp > 15) text_color = id(color_green);
          if(terrazatemp > 28) text_color = id(color_yellow);
          if(terrazatemp > 35) text_color = id(color_orange);
          if(terrazatemp > 40){
            text_color = id(color_white);
            bg_color = id(color_red);
          }

          it.print(0, 5, id(font20), "    TERRAZA");
          it.filled_rectangle(0, 30, it.get_width(), it.get_height(), bg_color);
          it.printf(
            it.get_width()/2, 
            it.get_height()/2, 
            id(font27), 
            text_color, 
            TextAlign::CENTER, 
            "Temp.: %.1f °",
            terrazatemp
          );

          if(sensaciontermica <= 5) text_color = id(color_white); 
          if(sensaciontermica > 5) text_color = id(color_azulceleste); 
          if(sensaciontermica > 15) text_color = id(color_green);
          if(sensaciontermica > 28) text_color = id(color_yellow);
          if(sensaciontermica > 35) text_color = id(color_orange);
          if(sensaciontermica > 40){
            text_color = id(color_white);
            bg_color = id(color_red);
          }

          it.printf(
            it.get_width()/2, 
            it.get_height()/1.2, 
            id(font27), 
            text_color, 
            TextAlign::CENTER, 
            "Feel:  %.0f °",
            sensaciontermica
          );

      - id: page4
        lambda: |-
          if(!id(co2_scd41_salon).has_state()) {
            it.print(
              it.get_width()/2,
              it.get_height()/2,
              id(font40),
              color_white,
              TextAlign::CENTER,
              "Starting..."
            );
            return;
          }

          auto bg_color = id(color_black);
          auto text_color = id(color_black);
          auto co2 = id(co2_scd41_salon).state;

          if(co2 > 400) bg_color = id(color_azulceleste);
          if(co2 > 800) bg_color = id(color_green);
          if(co2 > 1000) bg_color = id(color_yellow);
          if(co2 > 1600) bg_color = id(color_orange);
          if(co2 > 2000) bg_color = id(color_red);

          it.print(0, 5, id(font20), "    CO2 SALON");
          it.filled_rectangle(0, 30, it.get_width(), it.get_height(), bg_color);
          it.printf(
            it.get_width()/2, 
            it.get_height()/1.5, 
            id(font40), 
            text_color, 
            TextAlign::CENTER, 
            "%.0f",
            co2
          );

interval:
  - interval: 5s
    then:
      - display.page.show_next: my_display
      - component.update: my_display    

font:
  - file: 'arial.ttf'
    id: font12
    size: 12

  - file: 'arial.ttf'
    id: font13
    size: 13

  - file: 'arial.ttf'
    id: font15
    size: 15

  - file: 'arial.ttf'
    id: font17
    size: 17

  - file: 'arial.ttf'
    id: font20
    size: 20   

  - file: 'arial.ttf'
    id: font24
    size: 24   

  - file: 'arial.ttf'
    id: font27
    size: 27   

  - file: 'arial.ttf'
    id: font30
    size: 30

  - file: 'arial.ttf'
    id: font35
    size: 35

  - file: 'arial.ttf'
    id: font40
    size: 40    

  - file: 'arial.ttf'
    id: font50
    size: 50 

  - file: 'materialdesignicons-webfont.ttf'
    id: icon_font_35
    size: 35
    glyphs: [
      # Weather
      "󰖙", # mdi-weather-sunny
      "󰄬", # OK
      "󰅖" # KO
      ]

color:
  - id: color_black
    red: 0%
    green: 0%
    blue: 0%
    white: 0%
  - id: color_green
    red: 0%
    green: 100%
    blue: 0%
  - id: color_yellow
    red: 100%
    green: 100%
    blue: 0%
  - id: color_orange
    red: 100%
    green: 55%
    blue: 0%
  - id: color_red
    red: 100%
    green: 0%
  - id: color_white
    red: 100%
    green: 100%
    blue: 100%
  - id: color_blue
    red: 0%
    green: 0%
    blue: 100%
    white: 0%
  - id: color_purple
    red: 50%
    green: 0%
    blue: 100%
    white: 0%
  - id: color_azulceleste
    red: 25%
    green: 81%
    blue: 100%
    white: 0%

Anything in the logs that might be useful for us?

[20:29:40][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:29:43][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:29:45][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:29:48][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:29:50][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:29:53][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:29:55][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:29:58][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:00][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:02][D][sensor:127]: 'CO2 Salón': Sending state 1639.00000 ppm with 0 decimals of accuracy
[20:30:02][D][sensor:127]: 'Temperatura Salón SCD41': Sending state 21.95213 °C with 2 decimals of accuracy
[20:30:02][D][sensor:127]: 'Humedad Salón SCD41': Sending state 43.64014 % with 2 decimals of accuracy
[20:30:03][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:05][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:07][D][internal_temperature:051]: Got temperature: 63.3°C
[20:30:07][D][sensor:127]: 'Temp del ESP32 scd41-salón': Sending state 63.33334 °C with 1 decimals of accuracy
[20:30:08][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:13][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:15][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:18][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:20][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:25][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:25][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:28][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:30][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:35][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:35][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:37][D][homeassistant.sensor:024]: 'sensor.rm4_pro_salon_humidity': Got state 50.11
[20:30:37][D][sensor:127]: 'humedad_salon': Sending state 50.11000  with 1 decimals of accuracy
[20:30:38][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:40][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:43][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:45][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:48][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:50][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:53][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:55][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:30:58][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:31:00][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:31:02][D][sensor:127]: 'CO2 Salón': Sending state 1664.00000 ppm with 0 decimals of accuracy
[20:31:02][D][sensor:127]: 'Temperatura Salón SCD41': Sending state 21.96281 °C with 2 decimals of accuracy
[20:31:02][D][sensor:127]: 'Humedad Salón SCD41': Sending state 43.67828 % with 2 decimals of accuracy
[20:31:03][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:31:05][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:31:07][D][internal_temperature:051]: Got temperature: 62.8°C
[20:31:07][D][sensor:127]: 'Temp del ESP32 scd41-salón': Sending state 62.77778 °C with 1 decimals of accuracy
[20:31:08][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:31:10][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.
[20:31:15][W][esp32_ble_tracker:111]: Too many BLE events to process. Some devices may not show up.

Additional information

No response

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jerobins commented 1 year ago

I have ran into this as well. Following.