View project on Hackaday View project on GitHub

Hack Clock

A hackable alarm clock, built for experimentation and learning

"Internet of Things" Automation with IFTTT

The Hack Clock can integrate with the automation service IFTTT.com to turn your lights on when your alarm goes off, send out a tweet at the press of a button, or fire up your coffee maker at a given time.

To turn on IFTTT within your toolbox, you will need to use the Maker service within IFTTT and have it generate a new webhook key for you. Once you do, add it to /etc/hack-clock.conf as in:

"ifttt_maker_key": "sdfafd_aDAKDF_wadfs",

Once you have changed your config file, re-start the hack-clock service to read in the new file. After the restart, you should be able to add the following code to your Python file:

ifttt = IFTTT(configuration.get('ifttt_maker_key')) def wakeUp(): if not (datetime.now().weekday() in (5, 6)): ifttt.sendMakerEvent("sara_light") playMusic()

The above code will send an event to a Maker-powered IFTTT Applet, which then turns on an LIFX light:

An event to switch on an LIFX light