Code request for switch type

I am writing an app where I want to let the user select from all of their switches, on/of and dimmers). But, I want to turn on the dimmers using “settings.MultilevelSwitch?.setLevel(number)” rather then “on” But I don’t know how to tell if a switch is a dimmer or not.

Can someone point me in the right direction. Thanks.