A Dimmer has state 0-100, that’s all. It’s pretty self evident 0 brightness is “off” and all else is “on”, so you could test the state for zero or not if you wanted.
Or get the framework to do it for you with as
Color Items have HSB state, so you could isolate the brightness component in a similar way if you really wanted.