At the bottom of the edit data point page for an existing point, you'll see the event detectors section. Select 'State' from the dropdown, and hit the add button.
In my image, the properties of the state detector are shown on the right. I have given it an alias, the state that it is detecting, and the duration in that state. There is information about the state detectors inside the blue question mark bubble in the section. Save your data point after you've added the detector.
Then, go to the event handlers page (the sprocket / gear icon), and find the point you've created the detector on in the Point Event Detectors section. Expand it and find the detector we created. Click it, and you'll be able to create a handler by configuring the setup and saving the detector. I have guessed at what I think your situation requires in the images.