phillip1
(Phillip)
October 3, 2022, 5:16pm
15
That’s an encouraging error.
Sounds like that’s an encryption error bad_indicator errorno=11
You need to remove & add back the ESP node to HA since you used the same node which had an encryption key originally set up. Making some assumptions here.
Yes, you are right. I always get confused with the aggregated view of the integration and forgot, that you can open one device, and then remove it.
I think your issue is duplicate:
opened 08:09PM - 27 May 22 UTC
integration: api
### The problem
Heap Free is consistently dropping in size over the course of… a few hours until the ESP will crash and reboot due to lack of heap space due to a "socket operation failed: BAD_INDICATOR errono=11" error caused by a HA instance attempting to connect in plain text. The memory decrease is related to the socket error since the heap size immediately after is lower. Possible unreleased socket memory structure after error? The issue is not the error itself but the associated heap leakage which should not be happening in this case. I have confirmed that the heap decrease is related to the socket error by stopping the erroneous connection attempts. Without the error , heap is staying consistent.
### Which version of ESPHome has the issue?
2022.5.1
### What type of installation are you using?
Home Assistant Add-on
### Which version of Home Assistant has the issue?
2021.12.4
### What platform are you using?
ESP8266
### Board
Wemos D1 mini
### Component causing the issue
api encryption
### Example YAML snippet
```yaml
substitutions:
# change the name to suit your needs. This is what esphome will use as the friendly name for your component.
# also used as a prefix for all fields
systemName: "dscalarmmodule"
esphome:
name: $systemName
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "$systemName"
password: !secret wifi_password
logger:
baud_rate: 115200
level: DEBUG
api:
password: !secret api_password
encryption:
key: !secret encryption_key
ota:
password: !secret ota_password
safe_mode: True
binary_sensor:
#zone status open/close for each zone
- platform: template
id: z1
name: "$systemName Front door(z1)"
device_class: door
text_sensor:
#general system status online/disconnected
- platform: template
id: system_status
name: "$systemName System Status"
icon: "mdi:shield"
#battery level status for wireless channels, tamper , in alarm, etc for individual zones
- platform: debug
device:
name: "Device Info"
debug:
update_interval: 30s
sensor:
- platform: debug
free:
name: "Heap Free"
fragmentation:
name: "Heap Fragmentation"
block:
name: "Heap Max Block"
loop_time:
name: "Loop Time"
```
### Anything in the logs that might be useful for us?
```txt
[0;36m[D][sensor:124]: 'Heap Free': Sending state 18944.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Max Block': Sending state 16400.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Fragmentation': Sending state 6.00000 % with 1 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Loop Time': Sending state 35.00000 ms with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Free': Sending state 18944.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Max Block': Sending state 16400.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Fragmentation': Sending state 6.00000 % with 1 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Loop Time': Sending state 43.00000 ms with 0 decimals of accuracy[0m
[0;36m[D][api:102]: Accepted 192.168.2.229[0m
[0;33m[W][api.connection:071]: 192.168.2.229: Socket operation failed: BAD_INDICATOR errno=11[0m
[0;36m[D][sensor:124]: 'Heap Free': Sending state 18840.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Max Block': Sending state 16400.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Fragmentation': Sending state 6.00000 % with 1 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Loop Time': Sending state 35.00000 ms with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Free': Sending state 18840.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Max Block': Sending state 16400.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Fragmentation': Sending state 6.00000 % with 1 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Loop Time': Sending state 42.00000 ms with 0 decimals of accuracy[0m
[0;36m[D][api:102]: Accepted 192.168.2.229[0m
[0;33m[W][api.connection:071]: 192.168.2.229: Socket operation failed: BAD_INDICATOR errno=11[0m
[0;36m[D][sensor:124]: 'Heap Free': Sending state 18736.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Max Block': Sending state 16296.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Fragmentation': Sending state 6.00000 % with 1 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Loop Time': Sending state 37.00000 ms with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Free': Sending state 18736.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Max Block': Sending state 16296.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Fragmentation': Sending state 6.00000 % with 1 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Loop Time': Sending state 35.00000 ms with 0 decimals of accuracy[0m
[0;36m[D][api:102]: Accepted 192.168.2.229[0m
[0;33m[W][api.connection:071]: 192.168.2.229: Socket operation failed: BAD_INDICATOR errno=11[0m
[0;36m[D][sensor:124]: 'Heap Free': Sending state 18632.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Max Block': Sending state 16024.00000 B with 0 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Heap Fragmentation': Sending state 7.00000 % with 1 decimals of accuracy[0m
[0;36m[D][sensor:124]: 'Loop Time': Sending state 36.00000 ms with 0 decimals of accuracy[0m
```
### Additional information
_No response_
opened 06:45PM - 02 Mar 22 UTC
closed 12:09AM - 26 Aug 22 UTC
### The problem
The Home Assistant API keeps closing the connection, see the … log output. Also, the integration is not detected in Home Assistant. When manually adding the integration, all entities are unavailable.
What I tried so far:
- Setting WiFi channel width to auto, 20MHz or 40MHz (based on another issue I found)> no effect
- Specifying an API password (or not) > no effect
- Making a very, very barebone new device (see YAML snippet) > no effect
- Defining the eps32 component like below > no effect
- Adding `version` to the frame variable definition (e.g. recommended, latest) > no effect
```yaml
esphome:
name: anothertest
esp32:
board: esp32dev
framework:
type: arduino
```
### Which version of ESPHome has the issue?
2022.2.6
### What type of installation are you using?
Home Assistant Add-on
### Which version of Home Assistant has the issue?
2022.2.9
### What platform are you using?
ESP32
### Board
DEVKIT V1
### Component causing the issue
N/A
### Example YAML snippet
```yaml
esphome:
name: esp32-test3
platform: ESP32
board: esp32dev
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: !secret ota_pass
wifi:
ssid: !secret wifi_ssid1
password: !secret wifi_pass1
power_save_mode: none
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32-Test3 Fallback Hotspot"
password: !secret fallback_wifi_pass
captive_portal:
sensor:
- platform: uptime
name: "ESP32-Test Uptime Sensor"
update_interval: 20s
- platform: wifi_signal
name: "ESP32-Test WiFi Signal Sensor"
update_interval: 20s
```
### Anything in the logs that might be useful for us?
```txt
[19:28:06][I][app:102]: ESPHome version 2022.2.6 compiled on Mar 2 2022, 16:13:46
[19:28:06][C][wifi:491]: WiFi:
[19:28:06][C][wifi:353]: Local MAC: 24:0A:C4:31:C2:9C
[19:28:06][C][wifi:354]: SSID: [redacted]
[19:28:06][C][wifi:355]: IP Address: 192.168.178.23
[19:28:06][C][wifi:357]: BSSID: [redacted]
[19:28:06][C][wifi:358]: Hostname: 'esp32-test3'
[19:28:06][C][wifi:360]: Signal strength: -46 dB ▂▄▆█
[19:28:06][C][wifi:364]: Channel: 7
[19:28:06][C][wifi:365]: Subnet: 255.255.255.0
[19:28:06][C][wifi:366]: Gateway: 192.168.178.1
[19:28:06][C][wifi:367]: DNS1: 192.168.178.1
[19:28:06][C][wifi:368]: DNS2: 0.0.0.0
[19:28:07][C][logger:233]: Logger:
[19:28:07][C][logger:234]: Level: DEBUG
[19:28:07][C][logger:235]: Log Baud Rate: 115200
[19:28:07][C][logger:236]: Hardware UART: UART0
[19:28:07][C][uptime.sensor:031]: Uptime Sensor 'ESP32-Test Uptime Sensor'
[19:28:07][C][uptime.sensor:031]: State Class: 'total_increasing'
[19:28:07][C][uptime.sensor:031]: Unit of Measurement: 's'
[19:28:07][C][uptime.sensor:031]: Accuracy Decimals: 0
[19:28:07][C][uptime.sensor:031]: Icon: 'mdi:timer-outline'
[19:28:07][C][captive_portal:144]: Captive Portal:
[19:28:07][C][mdns:084]: mDNS:
[19:28:07][C][mdns:085]: Hostname: esp32-test3
[19:28:07][C][ota:085]: Over-The-Air Updates:
[19:28:07][C][ota:086]: Address: esp32-test3.local:3232
[19:28:07][C][ota:089]: Using Password.
[19:28:07][C][api:138]: API Server:
[19:28:07][C][api:139]: Address: esp32-test3.local:6053
[19:28:07][C][api:143]: Using noise encryption: NO
[19:28:07][C][wifi_signal.sensor:009]: WiFi Signal 'ESP32-Test WiFi Signal Sensor'
[19:28:07][C][wifi_signal.sensor:009]: Device Class: 'signal_strength'
[19:28:07][C][wifi_signal.sensor:009]: State Class: 'measurement'
[19:28:07][C][wifi_signal.sensor:009]: Unit of Measurement: 'dBm'
[19:28:07][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[19:28:10][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 12.65100 s with 0 decimals of accuracy
[19:28:21][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -48.00000 dBm with 0 decimals of accuracy
[19:28:30][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 32.64700 s with 0 decimals of accuracy
[19:28:36][D][api:102]: Accepted ::FFFF:C0A8:B2A0
[19:28:36][W][api.connection:083]: Home Assistant 2022.2.9 (::FFFF:C0A8:B2A0): Connection closed
[19:28:41][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -49.00000 dBm with 0 decimals of accuracy
[19:28:50][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 52.64700 s with 0 decimals of accuracy
[19:29:01][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -47.00000 dBm with 0 decimals of accuracy
[19:29:10][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 72.64700 s with 0 decimals of accuracy
[19:29:21][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -47.00000 dBm with 0 decimals of accuracy
[19:29:30][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 92.64800 s with 0 decimals of accuracy
[19:29:36][D][api:102]: Accepted ::FFFF:C0A8:B2A0
[19:29:36][W][api.connection:083]: Home Assistant 2022.2.9 (::FFFF:C0A8:B2A0): Connection closed
[19:29:41][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -47.00000 dBm with 0 decimals of accuracy
[19:29:50][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 112.64700 s with 0 decimals of accuracy
[19:30:01][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -47.00000 dBm with 0 decimals of accuracy
[19:30:10][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 132.64700 s with 0 decimals of accuracy
[19:30:21][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -47.00000 dBm with 0 decimals of accuracy
[19:30:30][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 152.64999 s with 0 decimals of accuracy
[19:30:36][D][api:102]: Accepted ::FFFF:C0A8:B2A0
[19:30:36][W][api.connection:083]: Home Assistant 2022.2.9 (::FFFF:C0A8:B2A0): Connection closed
[19:30:41][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -47.00000 dBm with 0 decimals of accuracy
[19:30:50][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 172.64700 s with 0 decimals of accuracy
[19:31:01][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -47.00000 dBm with 0 decimals of accuracy
[19:31:10][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 192.64700 s with 0 decimals of accuracy
[19:31:21][D][sensor:125]: 'ESP32-Test WiFi Signal Sensor': Sending state -46.00000 dBm with 0 decimals of accuracy
[19:31:30][D][sensor:125]: 'ESP32-Test Uptime Sensor': Sending state 212.64999 s with 0 decimals of accuracy
[19:31:36][D][api:102]: Accepted ::FFFF:C0A8:B2A0
[19:31:36][W][api.connection:083]: Home Assistant 2022.2.9 (::FFFF:C0A8:B2A0): Connection closed
```
### Additional information
Several of the things I tried where based on issue #3075, as the behavior of the problem was very similar, but all options listed there did not solve the issue so far.
Still have other ideas if that doesn’t solve it.
Such as extracting it within ESPHome instead, and trying a different, simpler sensor.
sensor:
- platform: homeassistant
id: current_temperature
entity_id: climate.air_conditioner
attribute: current_temperature