smarthomewatch: aka, pebble home automation

i really enjoyed my pebble (too bad called id is not working, yet), and i’m very happy to have been one the sponsors of the “rise of the smartwatch” series:

pair this brand new gadget with my interests in home automation, add the release of the pebble sdk, stir it with some juicy python examples, and there you are: a smarthomewatch!

first things first.

to start you need to have a working libpebble setup. i followed the pretty clear readme of this github homepage:

i followed the advice of using the lightblue library as the wrapper around bluetooth stack: looks pretty outdated, but works even on my up-to-date mountain lion powerbook.

if this is yout case, before trying to use the libpebble scripts, follow the instructions you can find here:

(that’s a fork adapted to run on macos 10.8)

as soon as i drilled down inside the clean code of the “” file, i realized how easy it would have been to tweak it, and thought: how about that ETH-RLY ethernet relay board i played with in python some weeks ago?

let’s glue them toghether… and the first smarthomewatch was born! to avoid having to set up a specific application i used the “music” menu, putting my relay list as if it was a playlist, using the play/pause button as a relay toggle.

the code i’m posting is pretty draft, looking more like a hack of the original file, rather than a proper sofware module. but hey: it works!

put it side by side the file, and run it the same way (much quicked if you pass you pebble id on the command line, like this:

./ –lightblue –pebble_id 00:18:33:B5:4D:6B

the only “feature” i added is making it aware of the watch disconnection: if the link looks down, i try to properly close the library and then try to open it every now and then. so you can leave the house with your watch and when back home you’ll get a message telling you the realys are again at your command as soon the a proper link is established.

have fun making!