Added support for device and sensor events

Hey, 

I've made some modifications that you might want to pull in. Note that I will be doing some more in the next couple of days, so you might get some more pull requests. 

Cheers, 
Marc.