Sleep 2.0 in 1.5.0 not working as expected

I should have mentioned that this was on purpose shortened to show just the sleep calls.
The real test program is of course longer, see below.
If I use the old sleep api, it works as expected, with new, it ends up breathing white.

#define __SLEEP_2_0__

SYSTEM_THREAD(ENABLED);

SystemSleepConfiguration config;
SystemSleepResult result;
unsigned long endTime = 0; 

void setup() {
    config.mode(SystemSleepMode::STOP)
          .gpio(D1, RISING)
          .duration(5s);
}
enum State { wait, sleeping, publishResult } state = sleeping;

void loop() 
{
    switch (state){
        case wait:{
            if (millis() > endTime){
                state = sleeping;
            }
        }
        break;
        case sleeping:{
            #ifdef __SLEEP_2_0__
            result = System.sleep(config);
            #else
            result = System.sleep(D2, RISING, 10);
            #endif
            state = publishResult;
        }
        break;
        case publishResult:{
            if (Particle.connected()){
                if (result.error() == SYSTEM_ERROR_NONE){
                    Particle.publish("test", "OK", PRIVATE);
                }
                else {
                    Particle.publish("test", String(result.error()).c_str(), PRIVATE);
                }
                state = wait;
                endTime = millis() + 10000UL;
            }
        }
        break;
    }
}