How to turn off BLE Device if it is connected?

Hello,

I have a BLE device with the nRF Desktop application, and I want to turn off my device if it is not used, even if it is connected to my PC. I set my CONFIG_POWER_MANAGER_TIMEOUT=2 so it goes to STATE_SUSPENDED after 2 seconds and should remain connected for the next 30 minutes.
How can I properly put it to STATE_OFF after a timeout of 30 minutes? 
I have a timer and a k_work_delayable. My function only sends two events after 30 minutes of inactivity and looks like this:

void pm_force_power_down()
{
    APP_EVENT_SUBMIT(new_force_power_down_event());
    APP_EVENT_SUBMIT(new_power_down_event());
}

After the timeout occurs, it doesn’t go to STATE_OFF and remains connected to my PC.
Is there a sample with this functionality available, or did I overlook a macro for this purpose?

Thanks in advance!

Related