Determine Object type in a Group (Dimmer or Switch)

Bartus has the correct solution. Or at least the most standard solution.

Another thing to keep in mind with naming Items: Design Pattern: Associated Items.

Using VSCode with the openHAB extension type in the name of an Item and wait half a second and a dialog will pop up with all the methods and data. But be aware, not everything you see in the list is intended to be called from the Rules DSL so it may or may not work.