And and Changes To - How will it function?

I’m building a modified version of one of the sample pistons - specifically, the one that has motion lighting control with smart monitoring of a switch state. The issue is I have two lights in the area I’d like to have dictate if motion lights are used. I’m wondering how the below code will actually return true - do both the lights have to change to off at the EXACT same time, or will it return true and fire when one of them changes to off if the other is already off?

if
    All of Basement - Sconce Lights' and Basement - TV Area Lights' switch change to off
then
    Set variable {programmatic} = false;
end if;

And, if it doesn’t work as intended, is the appropriate way to have 2 evaluations tied via OR (one changes to OFF and the other is already off)? (psudocode below)

if
(
    Basement - Sconce Lights'  is off and Basement - TV Area Lights' switch change to off
  OR
    Basement - TV Area Lights'  is off and Basement - Sconce Lights'  switch change to off  
)
then
    Set variable {programmatic} = false;
end if;

Well, hell, that’s just way too straightforward and matches earlier code :). Much thanks though - the question of when it would fire is the biggest part of this. Already changed and confirming!

1 Like