rkarlsba
(Roy Sigurd Karlsbakk)
April 1, 2022, 9:17pm
1
Hi all
I’m new to ESPHome and testing on an ESP8266. It worked at first, but now I get this
[23:14:13][W][wifi_esp8266:212]: wifi_apply_hostname_(esp-stua): lwIP error -16 on interface st (index 0)
[23:14:13][W][wifi_esp8266:482]: Event: Disconnected ssid='xxx' bssid=[redacted] reason='Association Leave'
[23:14:13][W][wifi:536]: Error while connecting to network.
Any ideas?
1 Like
I’ve been trying to find a solution to this issue for months, I have tried absolutely everything. Seems that the ESP32 doesn’t encounter this issue to even half the severity of the ESP8266. My recommendation would be to get an ESP32 and ditch the ESP8266 unfortunately…
[W][wifi_esp8266:212]: wifi_apply_hostname_(developing): lwIP error -16 on interface st (index 0)
[W][wifi:536]: Error while connecting to network.
I’ve had decent luck getting the ESP8266 to work better when manually setting the IP and enabling fast_connect to it can repetitively attempt connections until it finally lands one.
wifi:
ssid: "xxx"
password: "xxx"
fast_connect: true
manual_ip:
static_ip: 192.168.0.200
gateway: 192.168.0.1
subnet: 255.255.255.0
I wonder if you or @rkarlsba is using a DHT?
opened 06:02PM - 21 Dec 20 UTC
closed 04:54AM - 12 May 21 UTC
integration: dht
stale
<!-- Thanks for reporting a bug for this project. READ THIS FIRST:
- Provide … as many details as possible. Simply saying "X gives bug" or "X gives error" is not enough!
- Paste logs, configuration sample and code into the backticks (```).
- Read through the template carefully and fill out all missing details.
- Please also search for similar issues in this issue tracker first and read through the ESPHome FAQ.
DO NOT DELETE ANY TEXT from this template! Otherwise the issue may be closed without a comment.
-->
**Operating environment/Installation (Hass.io/Docker/pip/etc.):**
<!--
Please provide details about your environment below this line.
-->
pip3 and Hass.io
**ESP (ESP32/ESP8266, Board/Sonoff):**
<!--
Please provide details about which ESP you're using below.
-->
ESP8266 NodeMCU.
**ESPHome version (latest production, beta, dev branch)**
<!--
ESPHome version like v1.14 or 1.15-dev
-->
Version: 1.15.3
**Affected component:**
<!--
Please add the link to the documentation at https://esphome.io/index.html of the component in question.
-->
DHT
**Description of problem:**
WiFi connect failure may occur on some ESP8266 devices when using DHT:
```
[18:44:46][W][wifi_esp8266:191]: wifi_apply_hostname_(dht22): lwIP error -16 on interface st (index 0)
[18:44:46][W][wifi_esp8266:395]: Event: Disconnected ssid='abc' bssid=C8:0E:14:78:3A:56 reason='Association Leave'
```
**Problem-relevant YAML-configuration entries:**
```yaml
esphome:
name: dht22
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "abc"
password: "password1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Dht22 Fallback Hotspot"
password: "GdarmBnzG0lk"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "password"
ota:
password: "password"
```
**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.
-->
```
[18:52:09][I][app:029]: Running through setup()...
[18:52:09][C][wifi:033]: Setting up WiFi...
[18:52:09][D][wifi:324]: Starting scan...
[18:52:15][D][wifi:339]: Found networks:
[18:52:15][I][wifi:385]: - 'abc' (C8:0E:14:78:3A:56) ▂▄▆█
[18:52:15][D][wifi:386]: Channel: 4
[18:52:15][D][wifi:387]: RSSI: -66 dB
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX2) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:52:15][I][wifi:194]: WiFi Connecting to 'abc'...
[18:52:16][I][wifi:457]: WiFi Connected!
Now add the DHT sensor to the yaml file and keep the ESP8266 at the same distance:
sensor:
- platform: dht
pin: D2
temperature:
name: "DHT22 Temperature"
accuracy_decimals: 1
humidity:
name: "DHT22 Humidity"
accuracy_decimals: 1
model: DHT22
update_interval: 1min
[18:57:43][C][dht:011]: Setting up DHT...
[18:57:43][C][wifi:033]: Setting up WiFi...
[18:57:43][D][wifi:324]: Starting scan...
[18:57:43][D][dht:048]: Got Temperature=17.9°C Humidity=66.7%
[18:57:43][D][sensor:092]: 'DHT22 Temperature': Sending state 17.90000 °C with 1 decimals of accuracy
[18:57:43][D][sensor:092]: 'DHT22 Humidity': Sending state 66.70000 % with 1 decimals of accuracy
[18:57:49][D][wifi:339]: Found networks:
[18:57:49][I][wifi:385]: - 'abc' (C8:0E:14:78:3A:56) ▂▄▆█
[18:57:49][D][wifi:386]: Channel: 4
[18:57:49][D][wifi:387]: RSSI: -69 dB
[18:57:49][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:57:49][D][wifi:389]: - '***' (XX:XX:XX:XX:XX:XX) ▂▄▆█
[18:57:49][I][wifi:194]: WiFi Connecting to 'abc'...
[18:58:19][W][wifi:479]: Timeout while connecting to WiFi.
[18:58:19][I][wifi:194]: WiFi Connecting to 'abc'...
[18:58:19][W][wifi_esp8266:191]: wifi_apply_hostname_(dht22): lwIP error -16 on interface st (index 0)
[18:58:19][W][wifi_esp8266:395]: Event: Disconnected ssid='abc' bssid=C8:0E:14:78:3A:56 reason='Association Leave'
[18:58:19][W][wifi:485]: Error while connecting to network.
[18:58:19][W][wifi:522]: Restarting WiFi adapter...
Only 3 WiFi access points are found instead of +/- 17 when DHT added. The DHT sensor seems to affect the reliability of the WiFi network.
```
**Additional information and things you've tried:**
* Adding/removing DHT affects the stability of the WiFi connection, even without bare NodeMCU board.
* WiFi connection is stable when using BME280 instead of DHT.
Best would be (as always) to give as much details as possible so the error can be reproduced at best.
Before we begin…
This forum is not a helpdesk
The people here don’t work for Home Assistant, that’s an open source project. We are volunteering our free time to help others. Not all topics may get an answer, never mind one that helps you solve your problem.
[image]
This also isn’t a general home automation forum, this is a forum for Home Assistant and things related to it. Any question about Home Assistant, and about using things with Home Assistant, is welcome here. We can’t help you with e…
This should at least include the full yaml you experience the problems with.
poudenes
(Poudenes)
November 24, 2022, 12:32pm
4
have same issue now with some modules:
WiFi ssid is a 2.4ghz connection. When unplug from power and later on back the module will connect at a certain moment.
Config file ESPHome:
esphome:
name: meek-livingroom
esp8266:
board: nodemcuv2
logger:
api:
encryption:
key: "HIDDEN"
ota:
password: "HIDDEN"
wifi:
ssid: HIDDEN
password: HIDDEN
power_save_mode: none
reboot_timeout: 30min
fast_connect: true
mqtt:
broker: 192.168.100.24
username: HIDDEN
password: HIDDEN
client_id: esphome-livingroom
topic_prefix: esphome/livingroom
discovery: true
light:
- platform: neopixelbus
default_transition_length: 0s
type: GRB
variant: 800KBPS
pin: D4
num_leds: 2
name: "ESPHome livingroom - Neopixel1"
id: neopixel
- platform: partition
name: "ESPHome Partition - neopixel1"
default_transition_length: 1s
id: neopixel1
segments:
- id: neopixel
from: 0
to: 0
- platform: partition
name: "ESPHome Partition - neopixel2"
default_transition_length: 1s
id: neopixel2
segments:
- id: neopixel
from: 1
to: 1
switch:
- platform: gpio
pin: D1
name: "ESPHome livingroom - Switch 1"
id: switch1
- platform: gpio
pin: D1
name: "ESPHome livingroom - Switch 2"
id: switch2
# - platform: gpio
# pin: D1
# name: "ESPHome livingroom - Switch 3"
# id: switch3
binary_sensor:
- platform: gpio
pin: D5
name: "ESPHome livingroom - Touch 1"
on_press:
- switch.toggle: switch1
- if:
condition:
switch.is_on: switch1
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 0%
green: 100%
blue: 0%
- if:
condition:
switch.is_off: switch1
then:
- if:
condition:
lambda: |-
return id(goodnight).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 10%
green: 0%
blue: 10%
- if:
condition:
lambda: |-
return id(kodi).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 93%
green: 0%
blue: 93%
- if:
condition:
lambda: |-
return id(daytime).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(evening).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(appletv).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 55%
green: 55%
blue: 0%
- if:
condition:
lambda: |-
return id(tv).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 0%
green: 25%
blue: 53%
- if:
condition:
lambda: |-
return id(nintendo).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 36%
green: 28%
blue: 55%
- platform: gpio
pin: D7
name: "ESPHome livingroom - Touch 2"
on_press:
- switch.toggle: switch2
- if:
condition:
switch.is_on: switch2
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 0%
green: 100%
blue: 0%
- if:
condition:
switch.is_off: switch2
then:
- if:
condition:
lambda: |-
return id(goodnight).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 10%
green: 0%
blue: 10%
- if:
condition:
lambda: |-
return id(kodi).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 93%
green: 0%
blue: 93%
- if:
condition:
lambda: |-
return id(daytime).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(evening).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(appletv).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 55%
green: 55%
blue: 0%
- if:
condition:
lambda: |-
return id(tv).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 0%
green: 25%
blue: 53%
- if:
condition:
lambda: |-
return id(nintendo).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 36%
green: 28%
blue: 55%
- platform: gpio
pin: D7
name: "ESPHome livingroom - Touch 3"
on_press:
- switch.toggle: switch3
- if:
condition:
switch.is_on: switch3
then:
- light.turn_on:
id: neopixel3
brightness: 100%
red: 0%
green: 100%
blue: 0%
- if:
condition:
switch.is_off: switch3
then:
- if:
condition:
lambda: |-
return id(goodnight).state > 0;
then:
- light.turn_on:
id: neopixel3
brightness: 100%
red: 10%
green: 0%
blue: 10%
- if:
condition:
lambda: |-
return id(kodi).state > 0;
then:
- light.turn_on:
id: neopixel3
brightness: 100%
red: 93%
green: 0%
blue: 93%
- if:
condition:
lambda: |-
return id(daytime).state > 0;
then:
- light.turn_on:
id: neopixel3
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(evening).state > 0;
then:
- light.turn_on:
id: neopixel3
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(appletv).state > 0;
then:
- light.turn_on:
id: neopixel3
brightness: 100%
red: 55%
green: 55%
blue: 0%
- if:
condition:
lambda: |-
return id(tv).state > 0;
then:
- light.turn_on:
id: neopixel3
brightness: 100%
red: 0%
green: 25%
blue: 53%
- if:
condition:
lambda: |-
return id(nintendo).state > 0;
then:
- light.turn_on:
id: neopixel3
brightness: 100%
red: 36%
green: 28%
blue: 55%
sensor:
# SCENES
- platform: mqtt_subscribe
name: "ESPHome livingroom - Daytime"
id: daytime
accuracy_decimals: 0
topic: homeassistant/scenes/daytime
on_value:
then:
if:
condition:
lambda: 'return x > 0;'
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 100%
green: 0%
blue: 0%
- platform: mqtt_subscribe
name: "ESPHome livingroom - Evening"
id: evening
accuracy_decimals: 0
topic: homeassistant/scenes/evening
on_value:
then:
if:
condition:
lambda: 'return x > 0;'
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 100%
green: 0%
blue: 0%
- platform: mqtt_subscribe
name: "ESPHome livingroom - Goodnight"
id: goodnight
accuracy_decimals: 0
topic: homeassistant/scenes/goodnight
on_value:
then:
if:
condition:
lambda: 'return x > 0;'
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 20%
green: 31%
blue: 9%
- platform: mqtt_subscribe
name: "ESPHome livingroom - AppleTV"
topic: homeassistant/scenes/appletv
id: appletv
accuracy_decimals: 0
on_value:
then:
if:
condition:
lambda: 'return x > 0;'
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 55%
green: 55%
blue: 0%
- platform: mqtt_subscribe
name: "ESPHome livingroom - Kodi"
id: kodi
accuracy_decimals: 0
topic: homeassistant/scenes/kodi
on_value:
then:
if:
condition:
lambda: 'return x > 0;'
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 93%
green: 0%
blue: 93%
- platform: mqtt_subscribe
name: "ESPHome livingroom - Nintendo"
id: nintendo
accuracy_decimals: 0
topic: homeassistant/scenes/nintendo
on_value:
then:
if:
condition:
lambda: 'return x > 0;'
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 36%
green: 28%
blue: 55%
- platform: mqtt_subscribe
name: "ESPHome livingroom - TV"
id: tv
accuracy_decimals: 0
topic: homeassistant/scenes/tv
on_value:
then:
if:
condition:
lambda: 'return x > 0;'
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 0%
green: 25%
blue: 53%
# MOTION
- platform: mqtt_subscribe
name: "ESPHome livingroom - Motion"
id: motion
accuracy_decimals: 0
topic: homeassistant/motion/livingroom
on_value:
then:
if:
condition:
lambda: 'return x > 0;'
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 0%
green: 0%
blue: 100%
else:
- if:
condition:
switch.is_on: switch1
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 0%
green: 100%
blue: 0%
else:
- if:
condition:
lambda: |-
return id(daytime).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(goodnight).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 10%
green: 0%
blue: 10%
- if:
condition:
lambda: |-
return id(evening).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(kodi).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 93%
green: 0%
blue: 93%
- if:
condition:
lambda: |-
return id(appletv).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 55%
green: 55%
blue: 0%
- if:
condition:
lambda: |-
return id(tv).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 0%
green: 25%
blue: 53%
- if:
condition:
lambda: |-
return id(nintendo).state > 0;
then:
- light.turn_on:
id: neopixel1
brightness: 100%
red: 36%
green: 28%
blue: 55%
- if:
condition:
switch.is_on: switch2
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 0%
green: 100%
blue: 0%
else:
- if:
condition:
lambda: |-
return id(daytime).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(goodnight).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 10%
green: 0%
blue: 10%
- if:
condition:
lambda: |-
return id(evening).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(kodi).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 93%
green: 0%
blue: 93%
- if:
condition:
lambda: |-
return id(appletv).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 55%
green: 55%
blue: 0%
- if:
condition:
lambda: |-
return id(tv).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 0%
green: 25%
blue: 53%
- if:
condition:
lambda: |-
return id(nintendo).state > 0;
then:
- light.turn_on:
id: neopixel2
brightness: 100%
red: 36%
green: 28%
blue: 55%