esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 35 forks source link

ESP8266 + Nextion: Cannot send message because of TCP buffer space #1075

Closed Axellum closed 4 years ago

Axellum commented 4 years ago

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

In docker, Debian 10.3 in box internet (VM). ESP (ESP32/ESP8266, Board/Sonoff):

ESP8266 nodemcuv2 uart screen Nextion Affected component:

https://esphome.io/devices/nodemcu_esp32.html

Description of problem: Hello, I can't figure out why I got an error [api.connection: 670]: Cannot send message because of TCP buffer space when I exceed a certain number of sensors on the yaml of my esp. I discovered the coding of home assistant and esphome, I am not sure that it is a bugg (but I think seen what I found on the subject) or an error on my part. If you ever need, I put my code on github: https://github.com/jeelabs/esp-link/releases/tag/v2.2.3 The problem happens to me when I transfer the image number for the rain icons every 5 minutes over 1 hour of weather in France, but I'm not sure it will be linked ....

Problem-relevant YAML-configuration entries:

PASTE YAML FILE HERE

esphome:
  name: ha_dash
  platform: ESP8266
  board: nodemcuv2

  on_boot:
    priority: -180
    then:
      - lambda: |-
          id(page1).publish_state(true);
          id(page2).publish_state(false);
          id(page3).publish_state(false);

wifi:
  ssid: Axel
  password: !secret wifi_password
  fast_connect: true

api:

ota:

uart:
  rx_pin: D9
  tx_pin: D10
  baud_rate: 9600
  stop_bits: 2

logger:
  baud_rate: 0     # Disable UART logging (pins GPIO1/3 are used for Nextion communication)
  level: VERBOSE

time:
  - platform: sntp
    id: sntp_time
    timezone: Europe/Paris

status_led:
  pin:
    number: D3
    inverted: True

globals:

 - id: first_page             # First page of the display?
   type: std::string
   initial_value: ' '

 - id: display_on             # Is display on?
   type: bool

display:
  - platform: nextion
    id: teplomer
    update_interval: 8s
    lambda: |-

      if (id(somebody_home).state) {
        if (!id(display_on)) {
          it.set_backlight_brightness(50);
          id(display_on)=true;
        }

          it.send_command_printf("%s.pic=%.0f", "pluis_0mn",id(pluis_0mn).state);
          it.send_command_printf("%s.pic=%.0f", "pluis_5mn",id(pluis_5mn).state);
          it.send_command_printf("%s.pic=%.0f", "pluis_10mn",id(pluis_10mn).state);
          it.send_command_printf("%s.pic=%.0f", "pluis_15mn",id(pluis_15mn).state);
          it.send_command_printf("%s.pic=%.0f", "pluis_20mn",id(pluis_20mn).state);
          it.send_command_printf("%s.pic=%.0f", "pluis_25mn",id(pluis_25mn).state);
          it.send_command_printf("%s.pic=%.0f", "pluis_30mn",id(pluis_30mn).state);

          it.send_command_printf("%s.pic=%.0f", "pluis_35mn",id(pluis_35mn).state);

          it.send_command_printf("%s.pic=%.0f", "icon",id(today_icon).state);
          it.send_command_printf("%s.pic=%.0f", "icon_dem",id(today_icon1).state);
          it.send_command_printf("%s.pic=%.0f", "icon_2j",id(today_icon2).state);
          it.send_command_printf("%s.pic=%.0f", "Icon_3j",id(today_icon3).state);

          it.set_component_value("uc", id(processor_use).state);
          it.set_component_value("disque", id(disk_use_percent).state);
          it.set_component_value("ram", id(memory_use_percent).state);

          it.set_component_text_printf("hlever",id(freebox_download_speed).state.c_str());
          it.set_component_text_printf("hcoucher",id(freebox_upload_speed).state.c_str());

          auto time = id(sntp_time).now();
          it.set_component_text_printf("date",id(date_simple).state.c_str());
          it.set_component_text_printf("temp_ext","%2.1f",id(temp_outside).state);

          it.set_component_text_printf("humi",id(humi).state.c_str());
          it.set_component_text_printf("gas",id(gas).state.c_str());
          it.set_component_text_printf("pression",id(pression).state.c_str());
          it.set_component_text_printf("temp_int",id(temperature).state.c_str());

          it.set_component_text_printf("text_alerte",id(capbreton_weather_alert).state.c_str());

          it.set_component_text_printf("heure","%02d",time.hour);
          it.set_component_text_printf("minute","%02d",time.minute);

          it.set_component_text_printf("client",id(pi_hole_dns_unique_clients).state.c_str());

          it.set_component_text_printf("t9",id(dark_sky_overnight_low_temperature_1d).state.c_str());
          it.set_component_text_printf("t10",id(dark_sky_overnight_low_temperature_2d).state.c_str());
          it.set_component_text_printf("t11",id(dark_sky_overnight_low_temperature_3d).state.c_str());

          it.set_component_text_printf("t12",id(dark_sky_daytime_high_temperature_1d).state.c_str());
          it.set_component_text_printf("t13",id(dark_sky_daytime_high_temperature_2d).state.c_str());
          it.set_component_text_printf("t14",id(dark_sky_daytime_high_temperature_3d).state.c_str());

          it.set_component_text_printf("t15",id(dark_sky_wind_speed).state.c_str());

          it.set_component_text_printf("t_hass",id(uptime_ha).state.c_str());
          it.set_component_text_printf("t21",id(uptime_ha).state.c_str());

      } else {

        if (id(display_on)) {
          it.set_backlight_brightness(0);
          id(display_on)=false;
        }
      }

sensor:

  - platform: homeassistant   # Outside temperature
    id: temp_outside    
    entity_id: sensor.dark_sky_temperature

  - platform: homeassistant   # Forecast icon
    id: today_icon
    entity_id: sensor.today_icon

  - platform: homeassistant   # Forecast icon
    id: today_icon1
    entity_id: sensor.today_icon1

  - platform: homeassistant   # Forecast icon
    id: today_icon2
    entity_id: sensor.today_icon2

  - platform: homeassistant   # Forecast icon
    id: today_icon3
    entity_id: sensor.today_icon3

  - platform: homeassistant
    id: pluis_0mn 
    entity_id: sensor.pluis_0mn 

  - platform: homeassistant
    id: pluis_5mn
    entity_id: sensor.pluis_5mn

  - platform: homeassistant
    id: pluis_10mn 
    entity_id: sensor.pluis_10mn 

  - platform: homeassistant
    id: pluis_15mn
    entity_id: sensor.pluis_15mn

  - platform: homeassistant
    id: pluis_20mn 
    entity_id: sensor.pluis_20mn 

  - platform: homeassistant
    id: pluis_25mn
    entity_id: sensor.pluis_25mn

  - platform: homeassistant
    id: pluis_30mn 
    entity_id: sensor.pluis_30mn 

  - platform: homeassistant
    id: pluis_35mn
    entity_id: sensor.pluis_35mn

#------------------------- If I meet the line which is, I have the error, if I do not meet it all goes well.
  - platform: homeassistant
    id: pluis_40mn 
    entity_id: sensor.pluis_40mn 

  - platform: homeassistant   # Outside temperature
    id: disk_use_percent    
    entity_id: sensor.gauge_disque 

  - platform: homeassistant   # Outside temperature
    id: processor_use
    entity_id: sensor.gauge_uc

  - platform: homeassistant   # Outside temperature
    id: memory_use_percent
    entity_id: sensor.gauge_ram

text_sensor:

  - platform: homeassistant
    id: uptime_ha
    entity_id: sensor.uptime_ha

  - platform: homeassistant
    id: capbreton_weather
    entity_id: sensor.capbreton_weather

  - platform: homeassistant
    id: capbreton_next_rain
    entity_id: sensor.capbreton_next_rain

  - platform: homeassistant
    id: capbreton_rain_chance
    entity_id: sensor.capbreton_rain_chance

  - platform: homeassistant
    id: capbreton_weather_alert
    entity_id: sensor.capbreton_weather_alert

  - platform: homeassistant
    id: date_simple
    entity_id: sensor.date_simple

  - platform: homeassistant
    id: pi_hole_dns_unique_clients
    entity_id: sensor.pi_hole_dns_unique_clients

  - platform: homeassistant
    id: freebox_download_speed
    entity_id: sensor.freebox_download_speed

  - platform: homeassistant
    id: freebox_upload_speed
    entity_id: sensor.freebox_upload_speed

  - platform: homeassistant   # Outside temperature
    id: temperature    
    entity_id: sensor.temperature

  - platform: homeassistant   # Outside temperature
    id: humi    
    entity_id: sensor.humidite  

  - platform: homeassistant   # Outside temperature
    id: gas    
    entity_id: sensor.gas  

  - platform: homeassistant   # Outside temperature
    id: pression    
    entity_id: sensor.pression  

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

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

  - platform: homeassistant 
    id: dark_sky_daytime_high_temperature_3d 
    entity_id: sensor.dark_sky_daytime_high_temperature_3d

  - platform: homeassistant
    id: dark_sky_overnight_low_temperature_1d    
    entity_id: sensor.dark_sky_overnight_low_temperature_1d

  - platform: homeassistant
    id: dark_sky_overnight_low_temperature_2d    
    entity_id: sensor.dark_sky_overnight_low_temperature_2d  

  - platform: homeassistant
    id: dark_sky_overnight_low_temperature_3d    
    entity_id: sensor.dark_sky_overnight_low_temperature_3d 

  - platform: homeassistant
    id: dark_sky_wind_speed    
    entity_id: sensor.dark_sky_wind_speed

binary_sensor:

  - platform: homeassistant
    id: somebody_home
    entity_id: binary_sensor.somebody_home

  - platform: nextion
    page_id: 0
    component_id: 15
    id: reboot
    on_press:
      then:
        - homeassistant.service:
            service: script.reboot_ha

  - platform: nextion
    page_id: 0
    component_id: 1
    id: page1

  # 2. page - Lights
  - platform: nextion
    page_id: 1
    component_id: 2
    id: page2

  # 3. page - Media
  - platform: nextion
    page_id: 2
    component_id: 3
    id: page3

**Logs (if applicable):**
<!--
Please copy the debug log here. If possible, also connect to the ESP over USB and copy those logs into the backticks.
-->

PASTE DEBUG LOG HERE

[07:46:43][C][status_led:019]: Status LED: [07:46:43][C][status_led:020]: Pin: GPIO0 (Mode: OUTPUT, INVERTED)

[redacted] [07:46:43][C][wifi:284]: IP Address: 192.168.0.10

[redacted]

[07:46:43][C][wifi:291]: Signal strength: -66 dB ▂▄▆█ [07:46:43][C][wifi:295]: Channel: 13 [07:46:43][C][wifi:296]: Subnet: 255.255.255.0 [07:46:43][C][wifi:297]: Gateway: 192.168.0.254 [07:46:43][C][wifi:298]: DNS1: 192.168.0.23 [07:46:43][C][wifi:299]: DNS2: 192.168.0.254 [07:46:43][C][uart:140]: UART Bus: [07:46:43][C][uart:142]: TX Pin: GPIO1 [07:46:43][C][uart:145]: RX Pin: GPIO3 [07:46:43][C][uart:147]: Baud Rate: 9600 baud [07:46:43][C][uart:148]: Stop bits: 2 [07:46:43][C][uart:150]: Using hardware serial interface.

[07:46:43][C][logger:176]: Level: VERBOSE [07:46:43][C][logger:177]: Log Baud Rate: 0 [07:46:43][C][logger:178]: Hardware UART: UART0 [07:46:43][C][homeassistant.text_sensor:011]: Homeassistant Text Sensor 'uptime_ha' [07:46:43][C][homeassistant.text_sensor:012]: Entity ID: 'sensor.uptime_ha' (......) [07:46:44][C][homeassistant.sensor:024]: Accuracy Decimals: 1 [07:46:44][C][homeassistant.sensor:025]: Entity ID: 'sensor.gauge_ram' [07:46:45][V][api.connection:586]: Hello from client: 'Home Assistant 0.106.5 (192.168.0.27)' [07:46:45][D][api.connection:602]: Client 'Home Assistant 0.106.5 (192.168.0.27)' connected successfully! [07:46:46][V][api.connection:670]: Cannot send message because of TCP buffer space [07:46:46][V][api.connection:691]: Error: Disconnecting Home Assistant 0.106.5 (192.168.0.27) [07:46:46][D][api:067]: Disconnecting Home Assistant 0.106.5 (192.168.0.27) [07:46:48][V][api.connection:586]: Hello from client: 'Home Assistant 0.106.5 (192.168.0.23)' [07:46:48][D][api.connection:602]: Client 'Home Assistant 0.106.5 (192.168.0.23)' connected successfully! [07:46:48][V][api.connection:670]: Cannot send message because of TCP buffer space [07:46:48][V][api.connection:691]: Error: Disconnecting Home Assistant 0.106.5 (192.168.0.23) [07:46:48][D][api:067]: Disconnecting Home Assistant 0.106.5 (192.168.0.23) [07:46:52][V][api.connection:586]: Hello from client: 'Home Assistant 0.106.5 (192.168.0.27)' [07:46:52][D][api.connection:602]: Client 'Home Assistant 0.106.5 (192.168.0.27)' connected successfully! [07:46:53][V][api.connection:670]: Cannot send message because of TCP buffer space [07:46:53][V][api.connection:691]: Error: Disconnecting Home Assistant 0.106.5 (192.168.0.27) [07:46:53][D][api:067]: Disconnecting Home Assistant 0.106.5 (192.168.0.27) [07:46:54][V][api.connection:586]: Hello from client: 'Home Assistant 0.106.5 (192.168.0.23)' (....)

Additional information and things you've tried:

Sorry for my English, I use Google, and also for my working code.

Axellum commented 4 years ago

Solved by replacing with an ESP32.