def create(self, new=True, key=None): while True: try: hour = int(input('Enter the hour: ')) minute = int(input('Enter the minute: ')) except ValueError: pass else: break while True: print('Will the alarm repeat daily? [y/n]') try: opt = input('>>> ').lower() assert opt != 'y' and opt != 'n' except AssertionError: day = '*' if opt == 'n': try: day = int(input('Enter the day: ')) break except ValueError: pass if new: DAT['ALARM_ID'] += 1 key = str(DAT['ALARM_ID']) DAT[key] = alarm.Alarm(hour, minute, day, key) else: DAT[key].hour = hour DAT[key].minute = minute DAT[key].day = day DAT[key].save()
def smarthepia(): # Class c_alarm = alarm.Alarm() c_automation = automation.Automation() c_measure = measure.Sensor() c_status = status_notifier.Status() # Process p_alarm = multiprocessing.Process(target=c_alarm.run) p_alarm.start() p_automation = multiprocessing.Process(target=c_automation.run) p_automation.start() p_measure = multiprocessing.Process(target=c_measure.run) p_measure.start() # Ensure all process have started time.sleep(1) p_status = multiprocessing.Process(target=c_status.run) p_status.start() # End process (or not) p_alarm.join() p_automation.join() p_measure.join() p_status.join()
def __init__(self): super().__init__(parent=None, title='BeBe Clock Tool', size=(700, 300)) super().SetBackgroundColour(wx.WHITE) nb = wx.Notebook(self) nb.AddPage(stopwatch.StopWatch(nb), "Stopwatch") nb.AddPage(timer.Timer(nb), "Timer") nb.AddPage(alarm.Alarm(nb), "Alarm") self.Show()
def alarm_index(request): s7conn = getS7Conn() a = alarm.Alarm(s7conn) balance = "N/A" try: balance = float(sms.query_balance()) except Exception, e: logging.error("Failed to retrieve SMS account balance: %s" % e)
def create_alarm_list_and_test_alarm(): """ Inits the alarm list and an alarm void -> (Alarm, AlarmList) """ clear_alarms(ALARMS_TEST_FILE) alarms = alarm.AlarmList(ALARMS_TEST_FILE) al = alarm.Alarm(7, 0, 1, 0) return al, alarms
async def remind_me(ctx, amount, time, *message): time_reg = re.compile("\d{2}:\d{2}$") date_reg = re.compile("\d{2}/\d{2}/\d{4}$") current_time = datetime.now() mapping = { "s": "seconds", "m": "minutes", "h": "hours", "d": "days", "M": "months", "y": "years" } params = {} if time in mapping: params[mapping[time]] = int(amount) reminder_time = current_time + relativedelta(**params) elif (time_reg.match(time) is not None) and (date_reg.match(amount) is not None): reminder_time = datetime.strptime(amount + " " + time, "%d/%m/%Y %H:%M") print("Using reminder_time with dd/mm/yyyy. {0}".format( reminder_time.strftime("%b %d %Y %H:%M"))) else: await ctx.send("Wrong syntax. Please check `!help RemindMe`.") formatted_message = " ".join(message) if reminder_time != "": print(f"""New reminder created Time: {reminder_time} Message: {formatted_message} Channel: {ctx.channel.name} Channel ID: {ctx.channel.id} Guild: {ctx.guild.name} Author: {ctx.message.author.name}""") # Create alarm object and insert in DB new_alarm = alarm.Alarm(reminder_time, formatted_message, ctx.channel.name, ctx.channel.id, ctx.guild.name, ctx.message.author.id, ctx.message.author.name) sql.create_alarm(new_alarm) # Renew signal set_signal_next_alarm() reminder_format = reminder_time.strftime("%b %d %Y %H:%M") await ctx.send( f"Your reminder has been set for {reminder_format} with message \"{formatted_message}\"" )
def get_next_alarm(): cursor, sql_client = sql_connect() current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') query = "SELECT TOP 1 * FROM alarms WHERE alarms.reminder_time > \'{0}\' ORDER BY alarms.reminder_time ASC".format( current_time) try: cursor.execute(query) row = cursor.fetchone() if row: next_alarm = alarm.Alarm(row[2], row[3], row[4], row[5], row[6], row[7], row[8]) else: next_alarm = None except pyodbc.Error as msg: print(f"Error getting nest alarm: {msg}") finally: cursor.close() sql_client.close() return next_alarm
def __init__(self): super().__init__() self.frame = tk.Frame(self) self.title("Alarm") self.scale_frame = tk.Frame(self.frame) self.scale_label = tk.Label(self.scale_frame, text="Probability") self.scale = tk.Scale(self.scale_frame, length=300, orient=tk.HORIZONTAL, from_=0, to=100, tickinterval=50) self.minsize(350, 250) self.inc_buttons_frame = tk.Frame(self.frame) self.hour_inc_button = tk.Button(self.inc_buttons_frame, text="+", font=20) self.minute_inc_button = tk.Button(self.inc_buttons_frame, text="+", font=20) self.dec_buttons_frame = tk.Frame(self.frame) self.hour_dec_button = tk.Button(self.dec_buttons_frame, text="-", font=20) self.minute_dec_button = tk.Button(self.dec_buttons_frame, text="-", font=20) self.clock_frame = tk.Frame(self.frame) self.clock = tk.Label(self.clock_frame, text="00:00", font="arial 100") self.alarm = al.Alarm("Alarm") self.frame.pack(fill="both", expand=True) self.inc_buttons_frame.pack(fill="x", expand=True) self.hour_inc_button.pack(side="left", fill="x", expand=True) self.minute_inc_button.pack(side="right", fill="x", expand=True) self.clock_frame.pack(fill="both", expand=True) self.clock.pack(fill="both", expand=True) self.dec_buttons_frame.pack(fill="x", expand=True) self.hour_dec_button.pack(side="left", fill="x", expand=True) self.minute_dec_button.pack(side="right", fill="x", expand=True) self.scale_frame.pack(side="bottom", fill="x", expand=True) self.scale.pack(side="right") self.scale_label.pack(side="right") self.hour_inc_button.bind("<Button-1>", lambda x: self.hour_edit(True)) self.hour_dec_button.bind("<Button-1>", lambda x: self.hour_edit(False)) self.minute_inc_button.bind("<Button-1>", lambda x: self.minute_edit(True)) self.minute_dec_button.bind("<Button-1>", lambda x: self.minute_edit(False))
def alarm_action(request, action): s7conn = getS7Conn() a = alarm.Alarm(s7conn) if action == 'arm': a.arm() elif action == 'disarm': a.disarm() elif action == 'toggle_detector': idInt = 0 try: idInt = int(request.REQUEST["id"]) except: raise Http404 d = alarm.getDetectorByID(s7conn, idInt) d.toggle() context = { 'tag': 'lights', 'alarm': a, 'detectors': alarm.getDetectors(s7conn) } return render(request, "alarm.html", context)
def __init__(self): self.logger = logging.getLogger(__name__) try: self.myOled = oled.Oled() self.myOled.writerow(1, "Starting up") except: self.logger.error('Oled failed init.') sys.exit(0) try: self.myUbidots = myubidots.Ubidots() except: self.myOled.writerow(1, "Ubidots failed init") self.logger.error('Ubidots failed init.') sys.exit(0) try: self.myDS = DS18B20.DS18B20() except: self.myOled.writerow(1, "Sensor init failed") self.logger.error('Sensor init failed.') sys.exit(0) self.myAlarm = alarm.Alarm() self.myOled.writerow(1, "Initialised ")
def search(self): for matches in self.black_search.findall_files(self.args.files): victim = self.find_victim(matches[0].data) yield alarm.Alarm(matches, victim)
import DHT11 # Temperature and humidity sensor import PIR # Pyroelectric Infrared Motion Detector import LEDs # LEDs for status and alert import CO_Sensor # Carbon Monoxide sensor import alarm # Alarm buzzer ##################################################################### # Class Instantiations # lcd = LCD_Display.AdafruitCharLCD() # LCD kp = Matrix_Keypad.Keypad() # Keypad pir = PIR.PIR() # Motion Detector led = LEDs.LED() # Status/Alert LEDs cam = picamera.Picamera() # Video Camera co = CO_Sensor.COSensor() # Carbon Monoxide Sensor alm = alarm.Alarm() # Alarm buzzer # Constants # NULL_PIN = [0, 0, 0, 0] DIGITS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] DISABLED = "DISABLED" ENABLED = "ENABLED" FAHRENHEIT = "FAHRENHEIT" CELSIUS = "CELSIUS" def __main__(): # Setup LEDs [turns on power LED too] # led.__init__()
def __init__(self, rowcount = NO_OF_ROWS, rowlength = ROW_LENGTH, rotation = 90): self.Event = threading.Event() self.threadLock = threading.Lock() threading.Thread.__init__(self, name='mytft') self.q = Queue(maxsize=12) self.rowcount = rowcount+1 self.rowlength = rowlength self.last_prog_row = LAST_PROG_ROW self.rotation = rotation # Setup which pins we are using to control the hardware display if protoboard: # These are for the 2.2" tft soldered onto proto board. cs_pin = digitalio.DigitalInOut(board.CE0) dc_pin = digitalio.DigitalInOut(board.D18) reset_pin = digitalio.DigitalInOut(board.D23) else: # wired tft cs_pin = digitalio.DigitalInOut(board.CE0) dc_pin = digitalio.DigitalInOut(board.D17) reset_pin = digitalio.DigitalInOut(board.D23) # Setup SPI bus using hardware SPI: spi = board.SPI() self.disp = ili9341.ILI9341(spi, rotation=0,cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE) if self.disp.rotation % 180 == 90: height = self.disp.width # we swap height/width to rotate it to landscape! width = self.disp.height else: width = self.disp.width # we swap height/width to rotate it to landscape! height = self.disp.height self.image = Image.new("RGB", (width, height)) # Draw and text self.draw = ImageDraw.Draw(self.image) # Get drawing object to draw on image. # Load a TTF Font self.big_font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", BIGFONTSIZE) self.time_font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", SMALLFONTSIZE) # self.disp = TFT.ILI9341(DC, rst=RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=64000000)) # self.disp.begin() # self.disp.clear() # black self.old_text = [' ' for i in range(self.rowcount)] # used for clearing oled text # self.font = ImageFont.load_default() # self.font = ImageFont.truetype('binary/morningtype.ttf',FONTSIZE) # self.font = ImageFont.truetype('binary/secrcode.ttf',FONTSIZE) # self.font = ImageFont.truetype('binary/DS-DIGI.TTF',FONTSIZE) # self.font = [ImageFont.load_default() for i in range(self.rowcount)] # self.fontsize = [DEFAULT_FONT_SIZE for i in range(self.rowcount)] # self.fontsize[BIG_ROW] = 36 # if TESTING: # self.fontsize[2] = 24 # self.fontsize[3] = 24 # for i in range(self.rowcount): # self.font[i] = ImageFont.truetype(FONT_DIR+'Hack-Regular.ttf',self.fontsize[i]) # setup row colours self.rowcolour = [WHITE for i in range(self.rowcount)] # set the defaults self.rowcolour[0] = YELLOW # self.rowcolour[self.rowcount-1] = BLUE # self.calc_offsets() # GPIO.setmode(GPIO.BCM) # GPIO.setup(LED,GPIO.OUT) # pi_pwm=GPIO.PWM(LED,100) # pin number, frquency # pi_pwm.start(100) # duty cycle # GPIO.setup(L_BUTTON, GPIO.IN, pull_up_down = GPIO.PUD_UP) # GPIO.setup(R_BUTTON, GPIO.IN, pull_up_down = GPIO.PUD_UP) self.myalarm = alarm.Alarm() self.mypwm = pwm.PWM() self.mysystem = system.System()
else: pass except: print('No Wi-Fi config file found') wifi.hotspot() try: timezone_config_file = open('cfg/timezone.cfg', 'r') timezone = int(timezone_config_file.readline().strip()) timezone_config_file.close() print('Got timezone configuration: ' + str(timezone)) except: print('No timezone config file found, setting timezone to +3') timezone = 3 dawn_alarm = alarm.Alarm() if ntp.settime(timezone): print('Datetime set from NTP:', api.datetime_string()) dawn_alarm.reconfigure(True) else: print('Could not sync time from NTP, alarms disabled as well') effect = effects.Void() # effect = effects.AllRandom() # effect = effects.LoopNumbers(10) # effect = effects.AllHueLoop() # effect = effects.AllHueRotate() # effect = effects.AllHueSaturationRotate() # effect = effects.Matrix(40, 20) # effect = effects.Dawn(1, 1, 192)
parser = argparse.ArgumentParser() parser.add_argument("-e", "--endpoint", action="store", required=True, dest="host", help="Your AWS IoT custom endpoint") parser.add_argument("-r", "--rootCA", action="store", required=True, dest="rootCAPath", help="Root CA file path") parser.add_argument("-c", "--cert", action="store", required=True, dest="certificatePath", help="Certificate file path") parser.add_argument("-k", "--key", action="store", required=True, dest="privateKeyPath", help="Private key file path") parser.add_argument("-m", "--mode", action="store", dest="mode", default="alarm" ,help="Operation modes: %s"%str(ALLOWED_MODES)) args = parser.parse_args() host = args.host rootCAPath = args.rootCAPath certificatePath = args.certificatePath privateKeyPath = args.privateKeyPath if args.mode not in ALLOWED_MODES: parser.error("Unknown --mode option %s. Must be one of %s" % (args.mode, str(ALLOWED_MODES))) exit(2) clientId = "client_" + args.mode mqtt_client = iotclient.MQTTClient(clientId, host, rootCAPath, certificatePath, privateKeyPath) if args.mode == "alarm": alarm_obj = alarm.Alarm() mqtt_client.subscribe("remote/alarm", alarm_obj.stop) alarm_obj.play(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'alarm.wav')) mqtt_client.unsubscribe("remote/alarm") elif args.mode == "switch": switch.watch() mqtt_client.publish("remote/alarm", "stop")
def setUp(self): self.alarm = alarm.Alarm() # start with alarm disarmed self.alarm.quickdisarm()
BIGFONTSIZE = 24 # was 24 SMALLFONTSIZE = 12 # Setup which pins we are using to control the oled RESET_PIN = 15 DC_PIN = 16 # Using a 5x8 font ROW_HEIGHT = 8 ROW_LENGTH = 20 NO_OF_ROWS = 4 MAX_X_AXIS = 25 VALUEFILE = '/home/pi/master/therm/log/values.log' print("TFT control using new adafruit code") myalarm = alarm.Alarm() mypwm = pwm.PWM() # Setup which pins we are using to control the oled # These are for the 2.2" tft soldered onto proto board. cs_pin = digitalio.DigitalInOut(board.CE0) dc_pin = digitalio.DigitalInOut(board.D17) reset_pin = digitalio.DigitalInOut(board.D23) # Config for display baudrate (default max is 24mhz): BAUDRATE = 24000000 # Setup SPI bus using hardware SPI: spi = board.SPI() # disp = ili9341.ILI9341(spi, rotation=90,cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE) # 2.2", 2.4", 2.8", 3.2" ILI9341 # disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351 disp = ssd1331.SSD1331(spi, rotation=180, cs=cs_pin, dc=dc_pin)
playlist = [['http://ic7.101.ru:8000/a200', 'Relax'], ['http://ic7.101.ru:8000/a202', 'Comedy'], ['http://ic7.101.ru:8000/a101', 'Romantic'], ['http://185.39.195.90:8000/montecarlo_128', 'Royal']] ''' # 21.06.2018 comment <-- if not debug: instance = vlc.Instance('--input-repeat=-1', '--fullscreen') player = instance.media_player_new() # --> OWM_appid = '58aaaed4b1fe9293916758ce54a05b94' OWM_api = 'http://api.openweathermap.org/data/2.5/' # <-- # 20.06.2018 add --> new_alarm = alarm.Alarm('alarm') # 20.06.2018 add <-- def test_play(media, volume): # player.stop() # player.set_media(media) # print(player.is_playing()) # if player.is_playing != 1: # player.play() # print('started') # player.audio_set_volume(volume) print('Let the music play')
def __init__(self): self.logger = logging.getLogger(__name__) self.displaytype = keys.display self.cloud = keys.cloud if self.displaytype == 'oled': try: import oled self.display = oled.Oled() self.display.writerow(TITLE_ROW, "Starting up") except: self.logger.error('Oled failed init.') sys.exit(0) elif self.displaytype == 'uoled': try: import uoled print('Setting up uoled') self.display = uoled.Screen() except: print('Uoled failed init.') self.logger.error('Uoled failed init.') sys.exit(0) elif self.displaytype == 'uoledada': try: import uoledada print('Setting up uoledada') self.display = uoledada.Screen() except: print('Uoledada failed init.') self.logger.error('Uoledada failed init.') sys.exit(0) elif self.displaytype == 'uoledi2c': try: import uoledi2c print('Setting up uoledi2c') self.display = uoledi2c.Screen() except: print('Uoledi2c failed init.') self.logger.error('Uoledi2c failed init.') sys.exit(0) elif self.displaytype == '7seg': try: import sevenseg self.sevenseg = sevenseg.Sevenseg() except: self.logger.error('7seg failed init.') sys.exit(0) elif self.displaytype == 'tft': print("setting up newtft") try: import newtft # note newtft based on latest adafruit lib self.display = newtft.Screen() except: self.logger.error('newtft failed init.') sys.exit(0) else: self.logger.error('No display specified.') print('No display specified') sys.exit(0) if self.cloud == 'none': try: import dummycloud self.myCloud = dummycloud.Mydummycloud() self.display.cloud_type = 'file' print('Using dummy cloud') except: self.display.newwriterow(1, "Dummycloud failed init") self.logger.error('Dummycloud failed init.') sys.exit(0) elif self.cloud == 'ubidots': try: import myubidots self.myCloud = myubidots.Myubidots() self.display.cloud_type = 'ubidots' print('Ubidots cloud') except: self.display.newwriterow(1, "Ubidots failed init") self.logger.error('Ubidots failed init.') sys.exit(0) elif self.cloud == 'beebotte': try: import mybeebotte self.myCloud = mybeebotte.Mybeebotte(no_sensors=2) self.display.cloud_type = 'beebotte' self.display.writerow( CLOUD_ROW4, keys.beebotte_variable + ' ' + keys.beebotte_variable2) print('Beebotte cloud') except: self.display.writerow(TITLE_ROW, "Beebotte failed init") self.logger.error('Beebotte failed init.') print("Beebotte failed init.", sys.exc_info()[0]) sys.exit(0) else: self.logger.error('Cloud type not specified. Check keys file.') print('Cloud type not specified. Check keys file.') self.display.cloud_type = 'no cloud' sys.exit(0) self.cloud_error = False try: self.myDS = DS18B20.DS18B20() except: self.display.writerow(1, "Sensor init failed") self.logger.error('Sensor init failed.') sys.exit(0) self.myAlarm = alarm.Alarm() self.mySystem = system.System() hostname = self.mySystem.hostname() self.display.newwriterow(STATUS_ROW, 'Hostname:' + hostname) self.display.newwriterow(CLOUD_ROW, 'Cloud:' + self.cloud) self.log_counter = 0 self.cloud_counter = 0 self.display.newwriterow(TITLE_ROW, 'Thermometer') if BIG_TEXT == False: self.display.newwriterow(LABELS_ROW, 'Min Now Max ')
#Registering the mote with their ipv6 address, edit if necessary# ################################################################# temperature_mote = temperature_sensor.TemperatureSensor( "bbbb::c30c:0:0:1", MOTE_PORT) mote_list.append(temperature_mote) mote_ipv6[temperature_mote.ipv6] = mote_list.index(temperature_mote) humidity_mote = humidity_sensor.HumiditySensor("bbbb::c30c:0:0:2", MOTE_PORT) mote_list.append(humidity_mote) mote_ipv6[humidity_mote.ipv6] = mote_list.index(humidity_mote) detection_mote = motion_detector.MotionDetector("bbbb::c30c:0:0:3", MOTE_PORT) mote_list.append(detection_mote) mote_ipv6[detection_mote.ipv6] = mote_list.index(detection_mote) alarm_mote = alarm.Alarm("bbbb::c30c:0:0:4", MOTE_PORT) mote_list.append(alarm_mote) mote_ipv6[alarm_mote.ipv6] = mote_list.index(alarm_mote) ############################################################### readable_socket_list = [sys.stdin, serverSocket] timeout = 30 ack_timeout = 60 #Starting the main loop print("To get a list of available command, type help") while (running): print("----------------------------------------") print("Waiting for a command or incoming packet:") #Waiting for a user input or a packet on the socket of the server
import unittest import weather import simulator.buttons as buttons from menu_node import MenuNode import alarm_app from datetime import datetime import pdb import display import ledcontrol import alarm import os ALARMS_TEST_FILE = 'tests/alarms_test.json' TEST_ALARMS = [ (alarm.Alarm(7, 30, 1, 0), True), (alarm.Alarm(8, 0, 1, 2), True), (alarm.Alarm(2, 15, 4, 0), False), (alarm.Alarm(7, 10, 1, 1), True), (alarm.Alarm(7, 0, 1, 0), False), ] def clear_alarms(alarms_file): if os.path.isfile(alarms_file): os.system('rm ' + alarms_file) def create_alarm_list_and_test_alarm(): """ Inits the alarm list and an alarm
def setUp(self): self.alarm = alarm.Alarm() # start with alarm armed self.alarm.quickarm() # wait for arm time.sleep(5)
def test_alarm_gone_off_mixed(self): _, alarms = create_alarm_list_and_test_alarm() al1 = alarm.Alarm(7, 30, 0, 0) alarms.add_alarm(al1, True) al2 = alarm.Alarm(10, 0, 0, 0) alarms.add_alarm(al2, False) al3 = alarm.Alarm(15, 30, 1, 0) alarms.add_alarm(al3, True) al4 = alarm.Alarm(16, 30, 2, 1) alarms.add_alarm(al4, True) al5 = alarm.Alarm(9, 30, 0, 2) alarms.add_alarm(al5, True) # should not go off time1 = datetime(2017, 3, 20, 10, 0) # al1 should go off time2 = datetime(2017, 3, 20, 7, 30) # should not go off time3 = datetime(2017, 3, 20, 10, 0) # al3 should go off time4 = datetime(2017, 3, 21, 15, 30) # al4 should go off, since repeated daily time5 = datetime(2017, 3, 20, 16, 30) # al5 should go off, since repeated weekly time6 = datetime(2017, 3, 27, 9, 30) # should not go off time7 = datetime(2017, 3, 28, 9, 30) # should not go off time8 = datetime(2017, 3, 27, 9, 29) # should not go off time9 = datetime(2017, 3, 21, 7, 30) # should not go off time10 = datetime(2017, 3, 22, 7, 30) self.assertIsNone(alarms.get_gone_off_alarm(time1), msg="Alarm shouldn't go off but did") self.assertEquals(alarms.get_gone_off_alarm(time2), al1, msg="Alarm 1 should go off but didn't") self.assertIsNone(alarms.get_gone_off_alarm(time3), msg="Alarm shouldn't go off but did") self.assertEquals(alarms.get_gone_off_alarm(time4), al3, msg="Alarm 3 should go off but didn't") self.assertEquals(alarms.get_gone_off_alarm(time5), al4, msg="Alarm 4 should go off but didn't") self.assertEquals(alarms.get_gone_off_alarm(time6), al5, msg="Alarm 5 should go off but didn't") self.assertIsNone(alarms.get_gone_off_alarm(time7), msg="Alarm shouldn't go off but did") self.assertIsNone(alarms.get_gone_off_alarm(time8), msg="Alarm shouldn't go off but did") self.assertIsNone(alarms.get_gone_off_alarm(time9), msg="Alarm shouldn't go off but did") self.assertIsNone(alarms.get_gone_off_alarm(time10), msg="Alarm shouldn't go off but did")
# -*- coding: utf-8 -*- """ Main script for triggering sunset / sunrise features @author: Niels Petersen """ import warnings import alarm import sys import digitalio import board import RPi.GPIO as GPIO button1 = None controller = alarm.Alarm(sound_support=False) def initializeButton(): GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.add_event_detect(12, GPIO.RISING, callback=stopSunrise, bouncetime=250) def stopSunrise(channel): controller.black() exit(0) def main():
def _get_placeholder_alarm(self): today = datetime.now() al = alarm.Alarm(7, 0, today.weekday(), 0) al.increment_weekday(1) return al