Ken Guest’s online diary

December 25, 2015

USB Lamp tweaks.

Filed under: phing,python — kenguest @ 22:04

My wife got me a cheeky webmail notifier (an USB lamp that changes colour) as a part of my over-generous Christmas present.

After a little diversion to Christian’s write-up, I downloaded the  usblamp project from GitHub and made a few little pythonic tweaks I decided to share:

  1. is more configurable (the mailbox and lamp colour had been hard-coded).
  2. The lamp is turned off once new emails have been opened.
  3. closes cleanly, turning off the lamp too –
  4. usblamp recognises ‘pink’ as a colour, which my wife kinda insisted on 🙂 [ e.g. $ usblamp pink works 🙂 ]

So now my lamp turns pink when I receive a new email from Aisling, and turns off once I read it.

There is one issue that I haven’t addressed: what if the lamp is already on, and set to some other colour when it is supposed to switch on in If, for example, I have phing switching it to red because a build has failed, I might want it to flash between the two colours.

I guess that’s something I’ll have to leave for another day.


Blog at