defaules in substitutions now V1.2

This commit is contained in:
root
2025-08-21 20:01:39 +12:00
parent c76ca83932
commit c73e41496d
3 changed files with 78 additions and 24 deletions

View File

@@ -67,9 +67,29 @@ text_sensor:
- platform: template
name: "Last Reset Reason"
update_interval: 30s
lambda: |-
return { ESP.getResetReason().c_str() };
entity_category: diagnostic
lambda: |-
#if defined(USE_ESP8266)
return { ESP.getResetReason().c_str() };
#elif defined(USE_ESP32)
auto r = esp_reset_reason();
switch (r) {
case ESP_RST_POWERON: return { "Power-on" };
case ESP_RST_EXT: return { "External pin" };
case ESP_RST_SW: return { "Software reset" };
case ESP_RST_PANIC: return { "Exception/Panic" };
case ESP_RST_INT_WDT: return { "Interrupt WDT" };
case ESP_RST_TASK_WDT: return { "Task WDT" };
case ESP_RST_WDT: return { "Other WDT" };
case ESP_RST_DEEPSLEEP: return { "Deep sleep wake" };
case ESP_RST_BROWNOUT: return { "Brownout" };
case ESP_RST_SDIO: return { "SDIO" };
default: return { "Unknown" };
}
#else
return { "Unknown" };
#endif
###################################################################################################
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds