Why Your ESPHome Device Reboots on a Schedule — and What the 49-Day Number Actually Means
If you have an ESPHome node that reboots on a schedule, the first thing to do is stop guessing at the interval. A device that drops every few minutes, every 15 minutes, or every few days is telling you something specific, and the reset reason will usually tell you which thing. The “49 days” figure that circulates in forum threads is real, but it belongs to a different problem than most people think.
Here is the short version before the procedure: ESPHome’s documented automatic reboot paths are the WiFi reboot_timeout and the native API reboot_timeout, both defaulting to 15 minutes. Neither is a 49-day watchdog. The 49.7-day number is the rollover period of a 32-bit unsigned millis() counter in Arduino-style code, and the standard subtraction idiom handles it correctly. If your device reboots every 49 days, that is a hypothesis worth testing, not a diagnosis — and the test is cheap.
Two documented reboot paths, both measured in minutes
ESPHome will reboot a node on its own in at least two documented situations, and both are configurable timeouts rather than fixed schedules.
The WiFi component reboots when no WiFi connection exists for longer than reboot_timeout. The documentation states the default is 15 minutes and notes that the low-level IP stack can get into a state where only a full reboot restores the interface. Setting it to 0s disables the behavior, but the same documentation warns that the stack may still need a reboot to recover. That is a real trade, not a formality.
The native API component reboots when no client connects for longer than its own reboot_timeout, also defaulting to 15 minutes. The documentation is specific about what counts: only a client that completes authentication holds off the reboot. A port scan or a client with a stale encryption key does not. The stated reason is the same class of problem — the ESP can believe it is on the network when it is not, and only a reboot fixes it.
So the first question for any scheduled reboot is not “what is the watchdog interval” but “which of these two timeouts is firing, and why is the condition it guards against actually true?”
Step 1: capture the reset reason before changing anything
The debug component reports the last reboot reason in human-readable form through a reset_reason text sensor. It also exposes heap and loop diagnostics as sensors: free heap, largest contiguous block, minimum free heap since boot, fragmentation, and loop time. The minimum-free and fragmentation values are the ones that matter for a device that reboots after days rather than minutes, because they show a trend rather than a snapshot.
A minimal configuration looks like this:
debug:
update_interval: 5s
text_sensor:
- platform: debug
reset_reason:
name: "Reset Reason"
sensor:
- platform: debug
free:
name: "Heap Free"
block:
name: "Heap Max Block"
min_free:
name: "Heap Min Free"
fragmentation:
name: "Heap Fragmentation"
loop_time:
name: "Loop Time"
Read the reset reason over the logger or the web server component if you have one configured. The debug component’s startup output also prints reset reason, free heap, and ESPHome version, so a serial capture of the boot sequence is enough if you can get to the device.
Two caveats on the sensors. min_free is documented as available on ESP32 and LibreTiny only. fragmentation is available on ESP8266 with Arduino 2.5.2 or later and on ESP32. If your board does not expose one of these, you are not doing anything wrong; the platform simply does not provide it.
Step 2: read the logs at the default level first
The logger defaults to DEBUG, and the documentation now describes that level as suitable for production use. That is a change worth knowing about: as of ESPHome 2026.4.0, state-change messages moved from DEBUG to VERBOSE, so the default level produces substantially less output than older guides assume. If you are following a tutorial that tells you to set INFO for performance reasons, check the version it was written against.
What you are looking for in the log around a reboot:
- WiFi disconnect messages in the minutes before the reboot, which point at the WiFi
reboot_timeout. - API client disconnects, or a complete absence of client connections, which point at the API
reboot_timeout. - Allocation failures, send-queue errors, or a backtrace, which point at a crash rather than a timeout.
Do not leave the device at VERBOSE or VERY_VERBOSE to chase this. The logger documentation is explicit that those levels are for short debugging sessions, that they slow the device, cause network timeouts, and lead to connection instability, and that ESPHome logs a warning at boot when they are active. Running a flaky device at VERY_VERBOSE for a week is a good way to create the instability you are trying to diagnose.
Step 3: separate the two failure classes
Once you have the reset reason, the problem usually falls into one of two buckets, and the fixes do not overlap.
Class A: a deliberate timeout fired. The reset reason indicates a software reboot, and the logs show a WiFi or API condition that persisted past the timeout. The firmware did what it was configured to do. The bug is in the network, the client, or the configuration — not in the reboot logic.
Class B: the device crashed. The reset reason indicates a panic or watchdog reset, and the logs show a backtrace or an allocation failure. Here the reboot is a symptom of memory pressure or a code fault, and extending the timeout will not help.
Getting this wrong is the most common way people waste an afternoon. Disabling reboot_timeout on a device that is actually crashing produces a device that hangs silently instead of rebooting, which is worse for a smart-home node because nothing alerts you.
Step 4: for Class A, fix reachability before touching the timeout
If the API timeout is firing, the question is why no authenticated client is connecting. A hypothetical that fits the pattern: Home Assistant moves to a new VLAN, the device can still reach the network but not the client, and the API reboot_timeout fires every 15 minutes. The reset reason shows a software reboot, not a panic. The fix is routing or firewall reachability, not firmware. I am describing the shape of the failure, not a case I observed.
If the WiFi timeout is firing, the ESPHome FAQ is honest about the state of the art: random reconnecting is described as a known low-level issue with no single fix, and the suggested mitigations are fast_connect for hidden networks, a static IP, and power_save_mode: light — with the caveat that the last one may make things worse in some situations. The WiFi documentation also recommends a static IP because it improves connection times, and notes that fast_connect skips the initial scan but still scans after a failed attempt.
Only after reachability is fixed should you consider changing the timeout. Extending it from 15 minutes to an hour means a genuinely disconnected device stays disconnected for an hour before it tries to recover. Disabling it entirely means the device may sit unreachable until someone power-cycles it. Both are defensible for a node on a UPS-backed network with a monitoring alert; neither is a default you should adopt because a forum post said so.
Step 5: for Class B, watch the trend, not the snapshot
A single reading of free heap tells you almost nothing. The useful signals are min_free trending down over days and fragmentation climbing. The debug documentation notes that fragmentation above roughly 50% may cause allocation failures, which is a threshold to watch rather than a guarantee.
On memory-constrained boards, the API component is a documented contributor. Each active API connection consumes approximately 500–1000 bytes of RAM while connected, and the documentation notes that an ESP8266 typically has around 40KB free after boot but can drop under 20KB once sensors and other components are configured. The same page explains that when a connection’s send queue fills, the device logs an error and disconnects that client to prevent an out-of-memory crash — so a slow client or congested network can produce disconnects that look like a connectivity problem but originate in memory pressure.
The levers, in rough order of how much they cost you:
- Lower the global log level if you are running above
DEBUGfor no reason. - Reduce
max_connectionson small boards. The documentation warns the value is compiled in and every slot costs static RAM whether used or not. - Check whether a component is polling faster than it needs to.
- Move to a board with more RAM if the trend is structural rather than a leak you can find.
What the 49-day number actually is
On a 32-bit unsigned millis() counter, the value wraps at 232 milliseconds, which is about 49.7 days. In Arduino-style code, the correct way to measure an elapsed interval is subtraction against an unsigned variable, and that idiom handles the rollover correctly. The Arduino forum thread on this topic is blunt about it: used correctly, rollover causes no problem, and the only case where it matters is when the interval being timed is itself longer than 49 days.
That is a real concern for hand-written sketches. It is not a documented ESPHome reboot cause. None of the ESPHome component documentation retrieved for this article describes a 49-day watchdog or a scheduled reboot at that interval. If your device genuinely reboots at roughly 49-day intervals, the honest position is that the cause is unidentified and the reset reason is the next thing to read — not that you have found the watchdog.
There is a plausible reason the two ideas get conflated: both involve a number near 49, both involve a device restarting, and both show up in the same search results. But a timeout measured in minutes and a counter rollover measured in weeks are not the same mechanism, and treating them as one sends you looking for a configuration option that does not exist.
A repeatable procedure
- Add the debug component with
reset_reason,free,block,min_free,fragmentation, andloop_timewhere the platform supports them. - Capture the boot log and the reset reason after the next reboot. Do not change configuration first.
- Classify: software reboot with a WiFi or API condition in the preceding logs (Class A), or panic/backtrace/allocation failure (Class B).
- Class A: fix reachability — static IP,
fast_connectfor hidden networks, VLAN and firewall rules, client authentication. Only then decide whether the timeout value is right for your environment. - Class B: watch
min_freeandfragmentationover several days, lower log verbosity, reducemax_connectionson small boards, and look for a component polling too aggressively. - If the interval is genuinely near 49 days and the reset reason does not explain it, say so and keep investigating. Do not attribute it to a watchdog that the documentation does not describe.
One more trade worth naming: if the node controls something where an unexpected reboot is worse than a stale reading — a relay holding a pump, for example — a plain mechanical timer or a hardwired switch may be the more reliable choice than a networked microcontroller with a reboot policy. That is not a failure of the smart-home approach; it is a scoping decision. The procedure above is for the nodes where the network and the firmware are genuinely the right tool.
For a broader look at which of your small systems deserve this kind of attention in the first place, see How to Audit the Small Systems That Quietly Run Your Week.
FAQ
Does ESPHome have a watchdog timer that reboots the device every 49 days?
No documented ESPHome component describes a 49-day watchdog. The documented automatic reboot paths are the WiFi and API reboot_timeout options, both defaulting to 15 minutes. The 49.7-day figure is the rollover period of a 32-bit unsigned millis() counter in Arduino-style code.
Can I just disable reboot_timeout to stop the reboots?
You can set it to 0s, and the documentation describes that as supported. But the WiFi documentation warns that the low-level IP stack may need a full reboot to recover, and the API documentation explains the timeout exists because the ESP can report a network connection that is not actually usable. Disabling it trades a reboot loop for a device that may sit unreachable until someone power-cycles it.
Why does my device reboot every 15 minutes?
That interval matches both documented defaults. Check the reset reason and the logs immediately before the reboot: a WiFi disconnect points at the WiFi timeout, and an absent or unauthenticated API client points at the API timeout. Only an authenticated client holds off the API reboot.
Is VERBOSE logging safe to leave on while I wait for the next reboot?
The logger documentation says no. VERBOSE and VERY_VERBOSE are intended for short debugging sessions, slow the device, cause network timeouts, and can produce the instability you are trying to diagnose. The default DEBUG level is described as suitable for production use.
What should I watch if I suspect a memory problem?
min_free trending downward over days and fragmentation climbing toward the roughly 50% level the documentation flags as a risk for allocation failures. A single free-heap reading is not enough to conclude anything.