Refactoring code and define entity type

  * Add new three files for direct/switch/device.
  * Define entity type