In the case of numlock on a laptop you need to be smarter than just toggling the light; many laptops overlay a numpad over the keys, so with numlock enabled hitting 'I' will send 5 instead.
Back in the day I had some kind of plugin that toggled the caps and scroll lights based on ethernet Rx and Tx traffic. Nifty hack, but got distracting real fast.