I tried for a long time to use CEC to get info from the TV to my Pi (to change inputs and toggle on/off). From what I've read and from what I've seen others with far more knowledge write, the protocol doesn't support it.
So I use a this USB to RS232 dongle, pyserial and a python script to test if my TV is on or off.
Edit: Some TVs also can be controlled via their Ethernet connections. Check your manual/online.