mirror of
https://github.com/Death916/deathclock.git
synced 2026-04-10 03:04:40 -07:00
27 lines
631 B
Python
Executable file
27 lines
631 B
Python
Executable file
#alarm.py
|
|
# alarm component for dash app
|
|
|
|
from dash import html, dcc
|
|
import datetime
|
|
import time
|
|
|
|
class Alarm:
|
|
def __init__(self):
|
|
self.current_time = datetime.datetime.now()
|
|
self.alarms = []
|
|
self.alarm_times = []
|
|
|
|
|
|
def add_alarm(self, alarm_time,current_time):
|
|
self.alarms.append(alarm_time)
|
|
|
|
self.current_time = current_time
|
|
|
|
print(f"Alarm set for {alarm_time}")
|
|
|
|
def check_alarm(self):
|
|
current_time = datetime.datetime.now()
|
|
if current_time.time() in self.alarm_times:
|
|
print("Alarm triggered!")
|
|
return True
|
|
return False
|