Rift CV1 VR mode auto-entry in game

The new 4.13 release has an option to automatically enter VR mode when the headset is put on (Editor Preferences → General → Experimental → VR → Enable VR Mode Auto-Entry) by using the sensor in the Oculus Rift CV1. I want to do something similar to that in a packaged game. I know how to enter VR mode on startup or by pressing a button, but I want to enter it by putting on the Rift CV1 and I want to exit VR mode by taking it off.

So far I have found nothing that let’s me do this. Not in the head mounted display function library, not in the Oculus function library. The inputs have lots of events for the Oculus remote, but nothing for the sensor that says if someone is currently wearing the headset.

Is there a way to do what I want or am I out of luck? It doesn’t have to be a blueprint solution, a way to read out that sensor in C++ would already be enough.

I found the answer myself in the C++ interface, seemingly not exposed to blueprint yet. If I implement a AHmdWornIndicatorActor with the blueprint implementable events OnHmdUnknown, OnHmdWorn and OnHmdNotWorn and implement its Tick method like this:

void AHmdWornIndicatorActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

    int newState = EHMDWornState::NotWorn;

    if (GEngine->HMDDevice.IsValid())
        newState = GEngine->HMDDevice->GetHMDWornState();

    if (mLastState != newState)
    {
        mLastState = newState;

        switch (newState)
        {
        case EHMDWornState::Unknown:
            OnHmdUnknown();
            break;
        case EHMDWornState::Worn:
            OnHmdWorn();
            break;
        case EHMDWornState::NotWorn:
            OnHmdNotWorn();
            break;
        }
    }
}

That works. Well, kind of. If in a derived blueprint class I implement these events to indicate the sensor from the CV1 by changing f.e. material colors in a cube, it works. But as soon as I react by enabling/disabling the HMD, the state remains not worn after switching to worn and back to not worn once.