There is actually a seperate wakeup reason for timer:
enum esp_sleep_source_t
Sleep wakeup cause.
Values:
enumerator ESP_SLEEP_WAKEUP_UNDEFINED
In case of deep sleep, reset was not caused by exit from deep sleep.
enumerator ESP_SLEEP_WAKEUP_ALL
Not a wakeup cause, used to disable all wakeup sources with esp_sleep_disable_wakeup_source.
enumerator ESP_SLEEP_WAKEUP_EXT0
Wakeup caused by external signal using RTC_IO.
enumerator ESP_SLEEP_WAKEUP_EXT1
Wakeup caused by external signal using RTC_CNTL.
enumerator ESP_SLEEP_WAKEUP_TIMER
Wakeup caused by timer.
enumerator ESP_SLEEP_WAKEUP_TOUCHPAD
Wakeup caused by touchpad.
enumerator ESP_SLEEP_WAKEUP_ULP
Wakeup caused by ULP program.
enumerator ESP_SLEEP_WAKEUP_GPIO
Wakeup caused by GPIO (light sleep only on ESP32, S2 and S3)
enumerator ESP_SLEEP_WAKEUP_UART
Wakeup caused by UART (light sleep only)
enumerator ESP_SLEEP_WAKEUP_WIFI
Wakeup caused by WIFI (light sleep only)
enumerator ESP_SLEEP_WAKEUP_COCPU
Wakeup caused by COCPU int.
enumerator ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG
Wakeup caused by COCPU crash.
enumerator ESP_SLEEP_WAKEUP_BT
Wakeup caused by BT (light sleep only)
So check wakeup_reason using the function call and ESP_SLEEP_WAKEUP_TIMER should be by timer and ESP_SLEEP_WAKEUP_UNDEFINED should be by reboot… Let us know how you go.
Thanks! Indeed it’s the best solution, I knew about this function from Arduino API, but didn’t think it was available from ESPHome lambas, but it works perfectly: