--- title: ESPHome ESP8266 nodes stop joining Wi-Fi: reason='Association Leave' date: 2021-04-12 summary: ESPHome NodeMCU devices that had been working suddenly could not connect, logging lwIP error -16 and "Disconnected … reason='Association Leave'". The router's DHCP pool was full; giving the nodes static IPs fixed it. tags: esphome, esp8266, nodemcu, wifi, dhcp, iot environment: ESPHome (2021) on ESP8266 NodeMCU boards; consumer Wi-Fi router with a small DHCP pool author: shaun status: published aliases: Resolved-NodeMCU-failing-to-connect-reason-Association-Leave.html, Revolved.html --- ## Symptoms ESPHome nodes that had worked for months stopped joining the network. The logs repeated: ```text [I][wifi:194]: WiFi Connecting to 'xyz'... [W][wifi_esp8266:191]: wifi_apply_hostname_(somehostname): lwIP error -16 on interface st (index 0) [W][wifi_esp8266:395]: Event: Disconnected ssid='xyz' bssid=C8:0E:15:xx:xx:xx reason='Association Leave' ``` ## Cause The router's **DHCP address pool was exhausted**. The node associates, fails to get an address, and the connection is torn down with `Association Leave`, which looks like a Wi-Fi problem but is really an IP-addressing one. ## Fix Either enlarge the DHCP pool or remove stale leases on the router, or give each node a static address outside the pool in its `wifi:` block: ```yaml wifi: ssid: "xyz" password: "your-wifi-password" manual_ip: static_ip: 192.168.1.150 gateway: 192.168.1.1 subnet: 255.255.255.0 ``` Pick an address outside the router's DHCP range so it can never be handed out twice.