BLF with day/night switch

Please tell me someone has tried this and got it to work.

I use the day/night switch in freepbx, and would like the BLF button that I have assigned to the switch code on my SPA932 to change colors depending on the state.

Ex. It’s green normally, I would like it to turn red (in use) when the system is in “night mode”.

Is this even remotely possible?

There’s a function for Asterisk 1.4 & 1.6 that sounds like it will do what you’re looking for.

http://www.voip-info.org/wiki/view/Asterisk+func+Devstate

Just make a custom lamp, give it an extension, and modify the day/night dial plan to toggle the state of the lamp.