Apps Read Caller ID? Trigger external device?


I am an experienced programmer, but an absolute noob to Android programming, so please bear with me.

Is it possible to write an app that answers a call, obtains the Caller ID, then transmits a command via Bluetooth to activate another device?

I'm looking to write a program that automatically triggers another device (eg: turn on lights, etc) based upon whether or not it recognizes your phone number.

Any help is appreciated. TIA