Esp_sleep_get_wakeup_cause returns always 0

I’m having the same problem.
Looks like its the Serial Monitor connection. From what I understand, the Arduino Serial Monitor uses DTR and RTS control signals. These send a reset signal to the device when the monitor is connected. Since the device connects to the serial port when it wakes up, the result is the device being reset and the esp_sleep_get_wakeup_cause is 0.
I hooked up an LED (with a resistor) and added some code so it would blink out the esp_sleep_get_wakeup_cause.
When connected to the serial monitor, the esp_sleep_get_wakeup_cause was always 0. But when I turned the monitor off, the LED blinks the expected value.