How to create a customer entity using plugins

I have a device that does not belong to any entity. I hope it can control by switch and choose mode like select. There are also some values that need to be adjusted like adjusting speaker volume.All the function i want to bind to one deivce. How can I write a custom entity to implement this function?
Thanks in advance.