How to detect Door Sensor opening ONCE to stop alarm

Separate the steps. If an alarm needs to sound has no direct relation to time or door status. But also if the door was opened during the alarm.

So seperate it, pseudo code

if(time == alarmTime && time != lastCheckedTime){
alarmOn = true
}

if(alarmOn && doorBecomesOpen){
alarmOn = false
}

if(alarmOn){
soundAlarm(0
}

Also, when you start doing almost the same twice there is an easier way :wink:

AND link to the library please. There are tons of libraries and some even have the same name but work differently.