Can I get an attribute of %device%?

I have virtual switches that trigger scripts in my Home Assistant to use my RM4 pro to turn on/off the switches. I use a variable for the on/off value.

I want to use %device% so that I can use one rule for all the switches like below... But how do I get the correct %CommandVal% depending on the %device% that triggered the rule???

Below doesn't work, but is there some EASY way I can get an attribute of %device%???
I know I can do it with a big IF THEN ELSE, but that is ugly.

If I understand what you want, then %value% should work. It does for me. It is on if the triggered switch was on and off if off.

Maybe I am misunderstanding what it is you are trying to do. You just want to know if the triggered switch is on or off right?

%device% will be the switch that triggered, %value% will be on or off, I don't know of any value for %switch%

Bingo! Thank you! :+1:

I was guessing "switch" might be involved because of the "Set CommandVal to RonOfficeDeskLight switch variable setting (which worked.)