how do i use chat commands

how do i make it so when i type something like (light on) it will turn a light on all when i type (light off) it will turn the light off again? please help