Save matching devices to variable by capability

When using an if statement to find devices I am unable or don’t know how to do it, find from list devices with light capability.

Once I find them I want to save them to a variable.

Any help would be appreciated.

Thank you.

Set a Variable-Physical Devices and add all the lights to that list.

Set a Variable-Name it “matching list” or something like that.

In the If statement, use the 1st Variable to say “If any of 1st Variable…blah blah blah…set matching to 2nd Variable…

Use that list for whatever.

That’s one way of doing it but there’s more ways as well.