Typo in devwiki.electricimp.com/doku.php?id=electricimpapi:device

device.on() – set up an event handler for events sent by the agent

should be:

device.on() – set up an event handler for events sent by the imp

Fixed, thanks!