How to trigger when sleep starts

Hi

I’m a bit confused about intents. I want to trigger an action when I fall asleep (eg stopping an audio book). What’s the right intent to trigger on for this? Is it:

com.urbandroid.sleep.TRACKING_LIGHT_SLEEP_AUTO

Would I also need to trigger on rem or deep sleep, or would light sleep always trigger first?

Ideally I’d like one intent I can use to trigger on when no longer awake, regardless of what technical phase of sleep it is.

… I’m not quite sure what the sleep tracking started intent is… Does that fire when the button is pressed to actually start the tracking, or when it tracks that I have fallen asleep?

Thanks in advance!

Tom