-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.py
30 lines (23 loc) · 782 Bytes
/
actions.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
30
__author__ = 'George'
from clockwork import clockwork
import ConfigParser
from database import *
config = ConfigParser.RawConfigParser()
config.read("dashbroker.ini")
clockwork_key = config.get("ClockworkSMS", "Key")
def notifyHouse(message):
for housemate in Housemates.select().where(Housemates.active):
sendMessage(message, housemate.phoneNumber)
def sendMessage(message, phoneNumber):
client = clockwork.API(clockwork_key)
message = clockwork.SMS(
to=phoneNumber,
message=message)
response = client.send(message)
if not response.success:
print response.error_code
print response.error_description
def logButtonPress(macAddress, reason):
ButtonLog.create(reason=reason, button=macAddress)
if __name__ == "__main__":
print "Debug"