Add restriction (only if room lights are off)

I’m trying to add restriction to turn off lights in room 1 when motion is inactive ONLY when lights in room 2 are off (so when they are on, the piston shouldn’t fire)

I tried adding restriction (just below line 31): physical devices then (status, lights, switch, level, lights, on, etc…) and set value is zero or off but it doesn’t do it at all of, actually most of the time the light won’t turn off at all when adding such restrictions

Any help is appreciated