$group(#switch) returns either on or off, depending on the group status.
See /help $group.