Use brightness as a conditon

Sorry, this thread hasn’t seen any activity but I’m trying to do something very similar - assigning the brightness of a switch to a variable.

Is there a different attribute other than brightness to use?