Sorry - no code violation - the code, with few exceptions, allows you to put the switch anywhere you want (like across the room from the entrance!)