mirror of
https://github.com/esphome/esphome.git
synced 2026-09-16 17:48:40 +00:00
25601434d9739f8eb8101b5ad6775d789105914c
ESPHome's WiFiIPStateListener only notifies on IP acquisition (GOT_IP events), not on IP loss — on disconnect, only the WiFiConnectStateListener's disconnect path fires (see wifi_component_esp8266.cpp:952-962 and wifi_component_pico_w.cpp:340). The previous commit's `ip_was_up_` transition tracking was broken: after the first IP-up event, `ip_was_up_` latched to true and never reset, so subsequent disconnect+reconnect cycles would see has_ip=true && ip_was_up_=true and skip re-arming the polling window. Fix: always re-arm on any IP notification. The scheduler's set_interval/set_timeout with a uint32_t ID already performs atomic cancel-and-add for matching IDs (Scheduler::set_timer_common_ line 232-234), so start_polling_window_ is idempotent and needs no explicit cancel. Drop the ip_was_up_ field and cancel_polling_window_ helper entirely. The !has_ip branch (cancel on disconnect) was dead code: it would never fire because the listener doesn't receive disconnect events. Removing it; the polling window will naturally expire on its own (at most 12s of harmless MDNS.update() calls during a disconnect that isn't followed by reconnect within the window).
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
614 MiB
Languages
C++
55.8%
Python
43.6%
C
0.3%
JavaScript
0.2%
