This sounds like a good use case for dynamic Group membership.
You can change an Item’s Group membership through Rules.
Given:
Group:Dimmer ControlLights
Group:Switch EnableControl
Dimmer LR_Light1_Brightness "Brightness" {channel="hue:0220:00178812ef2f:1:brightness"}
Switch LR_Light1_Brightness_Enable (EnableControl)
...
import org.eclipse.smarthome.model.script.ScriptServiceUtil
rule "Light enabled/disabled"
when
Member of EnableControl received command
then
val light = ScriptServiceUtil.getItemRegistry.getItem(triggeringItem.name.replace("_Enable", "")
if(receivedCommand == ON) ControlLights.addMember(light)
else ControlLights.removeMember(light)
end
Put ControlLights on your sitemap or HABPanel as a Dimmer/Slider/Whatever is appropriate and all of the Switches. As you toggle the Switches the Items will be added/removed from ControlLights and they will respond to the commands sent to ControlLights.