This should provide what you need:
DROP TABLE IF EXISTS #Events;
CREATE TABLE #Events
(
TriggerTime time(0) NOT NULL,
EventMessage varchar(50) NOT NULL
);
INSERT #Events (TriggerTime, EventMessage)
VALUES ('3:31:00', 'Task 1'),
('3:42:53', 'DOOR OPEN'),
('3:43:53', 'Task 2'),
('3:57:00', 'DOOR CLOSE'),
('3:58:00', 'Task 3'),
('4:10:00', 'Task 4'),
('4:13:00', 'Task 5'),
('4:20:22', 'DOOR OPEN'),
('4:21:00', 'Task 7'),
('4:24:14', 'Task 8'),
('4:27:00', 'Task 9'),
('4:28:00', 'Task 10'),
('4:43:00', 'DOOR CLOSE');
SELECT e.TriggerTime,
e.EventMessage,
CASE WHEN lo.EventMessage = 'DOOR OPEN'
THEN DATEADD(second, 0 - DATEPART(hour, lo.TriggerTime) * 60 * 60
- DATEPART(minute, lo.TriggerTime) * 60
- DATEPART(second, lo.TriggerTime), e.TriggerTime)
END AS Duration
FROM #Events AS e
OUTER APPLY
(
SELECT TOP(1) el.TriggerTime, el.EventMessage
FROM #Events AS el
WHERE el.TriggerTime < e.TriggerTime
AND el.EventMessage LIKE 'DOOR%'
AND e.EventMessage = 'DOOR CLOSE'
ORDER BY el.TriggerTime DESC
) AS lo;
There are a few important notes though:
Having just the time by itself for when the trigger time happened is problematic, unless the difference between opens and closes never crosses midnight. Otherwise, you'd need a date there as well.
SQL Server doesn't have an interval or duration data type, so I've gone with a simple way to just subtract the two times to produce another time as the output.
What I would normally do, is to subtract the start and ending times (with their dates), and get the number of seconds in total, then convert that to a duration. In the SDU Tools that I publish (free), you can find a function that converts seconds to a duration. (https://sdutools.sqldownunder.com/) You could use that, or copy the code from it.
I've allowed for the case where opens and closes get missed for some reason. (Often happens in real systems). So the code works by looking up, for each row that's a DOOR CLOSE, the latest previous row that starts with DOOR. Then in the SELECT, we process it if it was an OPEN.
Another hint is that you'll get answers quicker in these forums if you include code to create the test table and populate it, or at least editable text, rather than a picture of the data.
Hope that gets you started.