Here is an example of a virtual RGBW light / bulb. HubitatPublic/virtualRGBW.groovy at master 路 hubitat/HubitatPublic 路 GitHub
If you take out all the color control stuff it will basically be a dimmer. Take out the level and it will be a Switch.
Here is another good one, if you turn off all the options it is basically just a switch and it has an auto-off built in already: [RELEASE] Virtual Switch Universal Device Type (uDTH) - good for Alexa, IFTTT, HSM, and other integrations