-
Notifications
You must be signed in to change notification settings - Fork 1
/
quick_alert.py
29 lines (27 loc) · 878 Bytes
/
quick_alert.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
__author__ = 'Aran'
import os
import win32com
import pyttsx
import pythoncom
from xml.dom import minidom
import urllib
import time
from utilities import *
def cal_alert(event_name, time_till):
pythoncom.CoInitialize()
# Checks for light on before alerting
kill = True
for light in HueCommand(0, []).get_states([1, 2, 3]):
if light['on'] == True:
kill = False
if kill:
return
# Todo may remove the on lights check...
engine = pyttsx.init()
rate = engine.getProperty('rate')
engine.setProperty('rate', rate-10)
engine.say('Uhh run... your event '+str(event_name)+'... starts in '+str(time_till)+'... minutes')
HueCommand(0, [BulbState(1, {'alert' : 'select'}),
BulbState(2, {'alert' : 'select'}),
BulbState(3, {'alert' : 'select'})]).execute()
engine.runAndWait()