esphome / esphome/feature-requests

Is it possible to detect reset cause?

Open
#1,156 0 comments 4 reactions 0 assignees View on GitHub
Core
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

I would like to add actions based on reset cause - especially, I would like to detect reset by wifi not available (to go to deep sleep for 1hr) and reset by timer/RST_pin (to proceed normally). It looks like I cannot detect reset cause. Following code does not work, always returns zero:

```
on_boot:
priority: 900
then:
- lambda: |-
rst_info *xyz;
byte reset_reason;
xyz = ESP.getResetInfoPtr();
reset_reason = (*xyz).reason;
ESP_LOGD("main", "Reset reason: %f", reset_reason);
```

**Please describe your use case for this integration and alternatives you've tried:**

**Additional context**

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the on_boot lambda and its use of ESP.getResetInfoPtr() in the issue, then check how reset-reason information is exposed on the relevant ESP platform. Done means a documented, usable way to distinguish reset causes, including unavailable Wi-Fi, timer, and RST_pin cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.